Module Contents#


track(params_file[, directions, max_angle, sphere, ...])


_tracking(tracker, seeds, dg, stopping_criterion, ...)

Helper function

AFQ.tractography.track(params_file, directions='prob', max_angle=30.0, sphere=None, seed_mask=None, seed_threshold=0, n_seeds=1, random_seeds=False, rng_seed=None, stop_mask=None, stop_threshold=0, step_size=0.5, min_length=50, max_length=250, odf_model='CSD', tracker='local')[source]#


params_filestr, nibabel img.

Full path to a nifti file containing CSD spherical harmonic coefficients, or nibabel img with model params.


How tracking directions are determined. One of: {“det” | “prob”} Default: “prob”

max_anglefloat, optional.

The maximum turning angle in each step. Default: 30

sphereSphere object, optional.

The discretization of direction getting. default:

seed_maskarray, optional.

Float or binary mask describing the ROI within which we seed for tracking. Default to the entire volume (all ones).

seed_thresholdfloat, optional.

A value of the seed_mask below which tracking is terminated. Default to 0.

n_seedsint or 2D array, optional.

The seeding density: if this is an int, it is is how many seeds in each voxel on each dimension (for example, 2 => [2, 2, 2]). If this is a 2D array, these are the coordinates of the seeds. Unless random_seeds is set to True, in which case this is the total number of random seeds to generate within the mask. Default: 1


Whether to generate a total of n_seeds random seeds in the mask. Default: False.


random seed used to generate random seeds if random_seeds is set to True. Default: None

stop_maskarray or str, optional.

If array: A float or binary mask that determines a stopping criterion (e.g. FA). If tuple: it contains a sequence that is interpreted as: (pve_wm, pve_gm, pve_csf), each item of which is either a string (full path) or a nibabel img to be used in particle filtering tractography. A tuple is required if tracker is set to “pft”. Defaults to no stopping (all ones).

stop_thresholdfloat or tuple, optional.

If float, this a value of the stop_mask below which tracking is terminated (and stop_mask has to be an array). If str, “CMC” for Continuous Map Criterion [Girard2014].

“ACT” for Anatomically-constrained tractography [Smith2012].

A string is required if the tracker is set to “pft”. Defaults to 0 (this means that if no stop_mask is passed, we will stop only at the edge of the image).

step_sizefloat, optional.

The size of a step (in mm) of tractography. Default: 0.5

min_length: int, optional

The miminal length (mm) in a streamline. Default: 20

max_length: int, optional

The miminal length (mm) in a streamline. Default: 250

odf_modelstr, optional

One of {“DTI”, “CSD”, “DKI”}. Defaults to use “DTI”

trackerstr, optional

Which strategy to use in tracking. This can be the standard local tracking (“local”) or Particle Filtering Tracking ([Girard2014]). One of {“local”, “pft”}. Default: “local”

list of streamlines ()



Girard, G., Whittingstall, K., Deriche, R., & Descoteaux, M. Towards quantitative connectivity analysis: reducing tractography biases. NeuroImage, 98, 266-278, 2014.

AFQ.tractography._tracking(tracker, seeds, dg, stopping_criterion, params_img, step_size=0.5, min_length=40, max_length=200, random_seed=None)[source]#

Helper function