Implementation of the Parallel Transport Tractography (PTT) algorithm by
Aydogan and Shi[1]. PTT Default parameter values are slightly different
than in Trekker to optimise performances. The rejection sampling
algorithm also uses fewer samples to estimate the maximum of the posterior, and
fewer tries to obtain a suitable propagation candidate. Moreover, the initial
tangent direction in this implementation is always obtained from the voxel-wise
peaks.
Peaks are defined as points on the odf that are greater than at least one
neighbor and greater than or equal to all neighbors. Peaks are sorted in
descending order by their values then filtered based on their relative size
and spacing on the sphere. An odf may have 0 peaks, for example if the odf
is perfectly isotropic.
Parameters:
odf1d ndarray
The odf function evaluated on the vertices of sphere
sphereSphere
The Sphere providing discrete directions for evaluation.
relative_peak_thresholdfloat in [0., 1.]
Only peaks greater than min+relative_peak_threshold*scale are
kept, where min=max(0,odf.min()) and
scale=odf.max()-min.
min_separation_anglefloat in [0, 90]
The minimum distance between directions. If two peaks are too close
only the larger of the two is returned.
is_symmetricbool, optional
If True, v is considered equal to -v.
Returns:
directions(N, 3) ndarray
N vertices for sphere, one for each peak
values(N,) ndarray
peak values
indices(N,) ndarray
peak indices of the directions on the sphere
Notes
If the odf has any negative values, they will be clipped to zeros.
Probabilistic direction getter from a distribution of directions
on the sphere
Parameters:
shcoeffarray
The distribution of tracking directions at each voxel represented
as a function on the sphere using the real spherical harmonic
basis. For example the FOD of the Constrained Spherical
Deconvolution model can be used this way. This distribution will
be discretized using sphere and tracking directions will be
chosen from the vertices of sphere based on the distribution.
max_anglefloat, [0, 90]
The maximum allowed angle between incoming direction and new
direction.
sphereSphere
The set of directions to be used for tracking.
pmf_thresholdfloat [0., 1.]
Used to remove direction from the probability mass function for
selecting the tracking direction.
basis_typename of basis
The basis that shcoeff are associated with.
dipy.reconst.shm.real_sh_descoteaux is used by default.
relative_peak_thresholdfloat in [0., 1.]
Used for extracting initial tracking directions. Passed to
peak_directions.
min_separation_anglefloat in [0, 90]
Used for extracting initial tracking directions. Passed to
peak_directions.
legacy: bool, optional
True to use a legacy basis definition for backward compatibility
with previous tournier07 and descoteaux07 implementations.
sh_to_pmf: bool, optional
If true, map sherical harmonics to spherical function (pmf) before
tracking (faster, requires more memory).
Peaks are defined as points on the odf that are greater than at least one
neighbor and greater than or equal to all neighbors. Peaks are sorted in
descending order by their values then filtered based on their relative size
and spacing on the sphere. An odf may have 0 peaks, for example if the odf
is perfectly isotropic.
Parameters:
odf1d ndarray
The odf function evaluated on the vertices of sphere
sphereSphere
The Sphere providing discrete directions for evaluation.
relative_peak_thresholdfloat in [0., 1.]
Only peaks greater than min+relative_peak_threshold*scale are
kept, where min=max(0,odf.min()) and
scale=odf.max()-min.
min_separation_anglefloat in [0, 90]
The minimum distance between directions. If two peaks are too close
only the larger of the two is returned.
is_symmetricbool, optional
If True, v is considered equal to -v.
Returns:
directions(N, 3) ndarray
N vertices for sphere, one for each peak
values(N,) ndarray
peak values
indices(N,) ndarray
peak indices of the directions on the sphere
Notes
If the odf has any negative values, they will be clipped to zeros.
Peaks are defined as points on the odf that are greater than at least one
neighbor and greater than or equal to all neighbors. Peaks are sorted in
descending order by their values then filtered based on their relative size
and spacing on the sphere. An odf may have 0 peaks, for example if the odf
is perfectly isotropic.
Parameters:
odf1d ndarray
The odf function evaluated on the vertices of sphere
sphereSphere
The Sphere providing discrete directions for evaluation.
relative_peak_thresholdfloat in [0., 1.]
Only peaks greater than min+relative_peak_threshold*scale are
kept, where min=max(0,odf.min()) and
scale=odf.max()-min.
min_separation_anglefloat in [0, 90]
The minimum distance between directions. If two peaks are too close
only the larger of the two is returned.
is_symmetricbool, optional
If True, v is considered equal to -v.
Returns:
directions(N, 3) ndarray
N vertices for sphere, one for each peak
values(N,) ndarray
peak values
indices(N,) ndarray
peak indices of the directions on the sphere
Notes
If the odf has any negative values, they will be clipped to zeros.
Fit the model to data and computes peaks and metrics
Parameters:
modela model instance
model will be used to fit the data.
datandarray
Diffusion data.
sphereSphere
The Sphere providing discrete directions for evaluation.
relative_peak_thresholdfloat
Only return peaks greater than relative_peak_threshold*m where m
is the largest peak.
min_separation_anglefloat in [0, 90] The minimum distance between
directions. If two peaks are too close only the larger of the two is
returned.
maskarray, optional
If mask is provided, voxels that are False in mask are skipped and
no peaks are returned.
return_odfbool
If True, the odfs are returned.
return_shbool
If True, the odf as spherical harmonics coefficients is returned
gfa_thrfloat
Voxels with gfa less than gfa_thr are skipped, no peaks are returned.
normalize_peaksbool
If true, all peak values are calculated relative to max(odf).
sh_order_maxint, optional
Maximum SH order (l) in the SH fit. For sh_order_max, there
will be
(sh_order_max+1)*(sh_order_max+2)/2
SH coefficients (default 8).
sh_basis_type{None, ‘tournier07’, ‘descoteaux07’}
None for the default DIPY basis,
tournier07 for the Tournier 2007 :footcite:p:Tournier2007` basis,
and descoteaux07 for the Descoteaux 2007 :footcite:p:Descoteaux2007`
basis
(None defaults to descoteaux07).
legacy: bool, optional
True to use a legacy basis definition for backward compatibility
with previous tournier07 and descoteaux07 implementations.
npeaksint
Maximum number of peaks found (default 5 peaks).
Bndarray, optional
Matrix that transforms spherical harmonics to spherical function
sf=np.dot(sh,B).
invBndarray, optional
Inverse of B.
parallel: bool
If True, use multiprocessing to compute peaks and metric
(default False). Temporary files are saved in the default temporary
directory of the system. It can be changed using importtempfile
and tempfile.tempdir='/path/to/tempdir'.
num_processes: int, optional
If parallel is True, the number of subprocesses to use
(default multiprocessing.cpu_count()). If < 0 the maximal number of
cores minus num_processes+1 is used (enter -1 to use as many
cores as possible). 0 raises an error.
Returns:
pamPeaksAndMetrics
An object with gfa, peak_directions, peak_values,
peak_indices, odf, shm_coeffs as attributes
Orientation distribution function (spherical function) represented
on a sphere of M points.
sphereSphere
A discrete Sphere. The M points on the sphere correspond to the points
of the odfs.
affinearray (4, 4)
The mapping between voxel indices and the point space for positions.
relative_peak_thresholdfloat, optional
Only peaks greater than min+relative_peak_threshold*scale are
kept, where min=max(0,odf.min()) and
scale=odf.max()-min. The relative_peak_threshold should
be in the range [0, 1].
min_separation_anglefloat, optional
The minimum distance between directions. If two peaks are too close
only the larger of the two is returned. The min_separation_angle
should be in the range [0, 90].
is_symmetricbool, optional
If True, v is considered equal to -v.
npeaksint, optional
The maximum number of peaks to extract at from each position.
Randomly samples direction of a sphere based on probability mass
function (pmf).
The main constructors for this class are current from_pmf and from_shcoeff.
The pmf gives the probability that each direction on the sphere should be
chosen as the next direction. To get the true pmf from the “raw pmf”
directions more than max_angle degrees from the incoming direction are
set to 0 and the result is normalized.
Methods
from_pmf(pmf, max_angle, sphere[, pmf_threshold])
Constructor for making a DirectionGetter from an array of Pmfs
from_shcoeff(shcoeff, max_angle[, sphere, ...])
Probabilistic direction getter from a distribution of directions on the sphere
initial_direction(point)
Returns best directions at seed location to start tracking.