Tractography Parameters#
This page documents the configuration options for controlling tractography in pyAFQ. These parameters can be set in your configuration file or passed as arguments when using the API.
Example Usage#
from AFQ.api.group import GroupAFQ
import AFQ.data.fetch as afd
import os.path as op
afd.organize_stanford_data()
myafq = GroupAFQ(
bids_path=op.join(afd.afq_home, 'stanford_hardi'),
preproc_pipeline='vistasoft',
tracking_params=dict(
n_seeds=25000,
random_seeds=True,
rng_seed=2025,
trx=True)
)
Tractography Parameter Reference#
- AFQ.tractography.tractography.track(params_file, directions='prob', max_angle=30.0, sphere=None, seed_mask=None, seed_threshold=0.5, thresholds_as_percentages=False, n_seeds=1, random_seeds=False, rng_seed=None, stop_mask=None, stop_threshold=0.5, step_size=0.5, minlen=50, maxlen=250, odf_model='CSD', basis_type='descoteaux07', legacy=True, tracker='local', trx=False)[source]
Tractography
- Parameters
- params_filestr, nibabel img.
Full path to a nifti file containing CSD spherical harmonic coefficients, or nibabel img with model params.
- directionsstr
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: dipy.data.default_sphere.
- 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 above which tracking is seeded. 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
- random_seedsbool
Whether to generate a total of n_seeds random seeds in the mask. Default: False.
- rng_seedint
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).
- thresholds_as_percentagesbool, optional
Interpret seed_threshold and stop_threshold as percentages of the total non-nan voxels in the seed and stop mask to include (between 0 and 100), instead of as a threshold on the values themselves. Default: False
- step_sizefloat, optional.
The size of a step (in mm) of tractography. Default: 0.5
- minlen: int, optional
The miminal length (mm) in a streamline. Default: 20
- maxlen: int, optional
The miminal length (mm) in a streamline. Default: 250
- odf_modelstr or Definition, optional
Can be either a string or Definition. If a string, it must be one of {“DTI”, “CSD”, “DKI”, “GQ”, “RUMBA”}. If a Definition, we assume it is a definition of a file containing Spherical Harmonics coefficients. Defaults to use “CSD”
- basis_typestr, optional
The spherical harmonic basis type used to represent the coefficients. One of {“descoteaux07”, “tournier07”}. Deafult: “descoteaux07”
- legacybool, optional
Whether to use the legacy implementation of the direction getter. See Dipy documentation for more details. Default: True
- 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”
- trxbool, optional
Whether to return the streamlines compatible with input to TRX file (i.e., as a LazyTractogram class instance). Default: False
- Returns
- list of streamlines ()
References
- Girard2014(1,2)
Girard, G., Whittingstall, K., Deriche, R., & Descoteaux, M. Towards quantitative connectivity analysis: reducing tractography biases. NeuroImage, 98, 266-278, 2014.
- Smith2012
Smith RE, Tournier JD, Calamante F, Connelly A. Anatomically-constrained tractography: improved diffusion MRI streamlines tractography through effective use of anatomical information. Neuroimage. 2012 Sep;62(3):1924-38. doi: 10.1016/j.neuroimage.2012.06.005. Epub 2012 Jun 13.