Calculate weights for each streamline/node in a bundle, based on a
Mahalanobis distance from the core the bundle, at that node (mean, per
default).
Parameters:
bundleStreamlines
The streamlines to weight.
n_pointsint, optional
The number of points to resample to. If the `bundle` is an array, this
input is ignored.
return_mahalanobisbool, optional
Whether to return the Mahalanobis distance instead of the weights.
statcallable, optional.
The statistic used to calculate the central tendency of streamlines in
each node. Can be one of {np.mean, np.median} or other functions
that have similar API.`
Returns:
warray of shape (n_streamlines, n_points)
Weights for each node in each streamline, calculated as its relative
inverse of the Mahalanobis distance, relative to the distribution of
coordinates at that node position across streamlines.
The collection of streamlines (possibly already resampled into an array
for each to have the same length) with which we are resampling. See
Note below about orienting the streamlines.
affinearray_like (4, 4)
The mapping from voxel coordinates to streamline points.
The voxel_to_rasmm matrix, typically from a NIFTI file.
n_points: int, optional
The number of points to sample along the bundle. Default: 100.
orient_by: streamline, optional
A streamline to use as a standard to orient all of the streamlines in
the bundle according to.
weights1D array or 2D array or callable, optional
Weight each streamline (1D) or each node (2D) when calculating the
tract-profiles. Must sum to 1 across streamlines (in each node if
relevant). If callable, this is a function that calculates weights.
profile_statcallable, optional
The statistic used to average the profile across streamlines.
If weights is not None, this must take weights as a keyword argument.
The default, np.average, is the same as np.mean but takes weights
as a keyword argument.
weights_kwargkey-word arguments
Additional key-word arguments to pass to the weight-calculating
function. Only to be used if weights is a callable.
Returns:
ndarraya 1D array with the profile of data along the length of
bundle
Notes
Before providing a bundle as input to this function, you will need to make
sure that the streamlines in the bundle are all oriented in the same
orientation relative to the bundle (use orient_by_streamline()).
Create a mapping of dwi volume index to its nearest neighbor.
An approximate q-space is used (the deltas are not included).
Note that neighborhood is not necessarily bijective. One neighbor
is found per dwi volume.
Parameters:
gtab: dipy.core.gradients.GradientTable
Gradient table.
Returns:
neighbors: list of tuple
A list of 2-tuples indicating the nearest q-space neighbor
of each dwi volume.
Calculate the Neighboring DWI Correlation (NDC) from dMRI data.
Using a mask is highly recommended, otherwise the FOV will influence the
correlations. According to Yeh et al.[3], an NDC less than 0.4
indicates a low quality image.