scilpy.tracking package

scilpy.tracking.propagator module

scilpy.tracking.seed module

scilpy.tracking.tracker module

scilpy.tracking.utils module

class scilpy.tracking.utils.TrackingDirection(cartesian, index=None)[source]

Bases: list

Tracking direction use as 3D cartesian direction (list(x,y,z)) and has an index to work with discrete sphere.

scilpy.tracking.utils.add_mandatory_options_tracking(p)[source]

Args that are required in both scil_tracking_local and scil_tracking_local_dev scripts.

scilpy.tracking.utils.add_out_options(p)[source]

Options that are available in both scil_tracking_local and scil_tracking_local_dev scripts.

scilpy.tracking.utils.add_seeding_options(p)[source]

Options that are available in both scil_tracking_local and scil_tracking_local_dev scripts.

scilpy.tracking.utils.add_tracking_options(p)[source]

Options that are available in both scil_tracking_local and scil_tracking_local_dev scripts.

scilpy.tracking.utils.add_tracking_ptt_options(p)[source]
scilpy.tracking.utils.get_direction_getter(in_img, algo, sphere, sub_sphere, theta, sh_basis, voxel_size, sf_threshold, sh_to_pmf, probe_length, probe_radius, probe_quality, probe_count, support_exponent, is_legacy=True)[source]

Return the direction getter object.

Parameters:
  • in_img (str) – Path to the input odf file.

  • algo (str) – Algorithm to use for tracking. Can be ‘det’, ‘prob’, ‘ptt’ or ‘eudx’.

  • sphere (str) – Name of the sphere to use for tracking.

  • sub_sphere (int) – Number of subdivisions to use for the sphere.

  • theta (float) – Angle threshold for tracking.

  • sh_basis (str) – Name of the sh basis to use for tracking.

  • voxel_size (float) – Voxel size of the input data.

  • sf_threshold (float) – Spherical function-amplitude threshold for tracking.

  • sh_to_pmf (bool) – Map sherical harmonics to spherical function (pmf) before tracking (faster, requires more memory).

  • probe_length (float) – The length of the probes. Shorter probe_length yields more dispersed fibers.

  • probe_radius (float) – The radius of the probe. A large probe_radius helps mitigate noise in the pmf but it might make it harder to sample thin and intricate connections, also the boundary of fiber bundles might be eroded.

  • probe_quality (int) – The quality of the probe. This parameter sets the number of segments to split the cylinder along the length of the probe (minimum=2).

  • probe_count (int) – The number of probes. This parameter sets the number of parallel lines used to model the cylinder (minimum=1).

  • support_exponent (float) – Data support exponent, used for rejection sampling.

  • is_legacy (bool, optional) – Whether or not the SH basis is in its legacy form.

Returns:

dg – The direction getter object.

Return type:

dipy.direction.DirectionGetter

scilpy.tracking.utils.get_theta(requested_theta, tracking_type)[source]
scilpy.tracking.utils.sample_distribution(dist, random_generator: Generator)[source]
Parameters:
  • dist (numpy.array) – The empirical distribution to sample from.

  • random_generator (numpy Generator)

Returns:

ind – The index of the sampled element.

Return type:

int

scilpy.tracking.utils.save_tractogram(streamlines_generator, tracts_format, ref_img, total_nb_seeds, out_tractogram, min_length, max_length, compress, save_seeds, verbose)[source]

Save the streamlines on-the-fly using a generator. Tracts are filtered according to their length and compressed if requested. Seeds are saved if requested. The tractogram is shifted and scaled according to the file format.

Parameters:
  • streamlines_generator (generator) – Streamlines generator.

  • tracts_format (TrkFile or TckFile) – Tractogram format.

  • ref_img (nibabel.Nifti1Image) – Image used as reference.

  • total_nb_seeds (int) – Total number of seeds.

  • out_tractogram (str) – Output tractogram filename.

  • min_length (float) – Minimum length of a streamline in mm.

  • max_length (float) – Maximum length of a streamline in mm.

  • compress (float) – Distance threshold for compressing streamlines in mm.

  • save_seeds (bool) – If True, save the seeds used for the tracking in the data_per_streamline property.

  • verbose (bool) – If True, display progression bar.

scilpy.tracking.utils.tqdm_if_verbose(generator: Iterable, verbose: bool, *args, **kwargs)[source]
scilpy.tracking.utils.verify_seed_options(parser, args)[source]
scilpy.tracking.utils.verify_streamline_length_options(parser, args)[source]