For backwards compatibility, we continue to support this form of the Tensor fitting.
Methods
ad | |
fa | |
ind | |
lower_triangular(tensor[, b0]) | Returns the six lower triangular values of the tensor and a dummy variable |
md | |
odf | |
rd | |
trace(evals[, axis]) | Trace of a diffusion tensor. |
Calculates the 3x3 diffusion tensor for each voxel
Fractional anisotropy (FA) calculated from cached eigenvalues.
Parameters : | fill_value : float
nonans : Bool
|
---|---|
Returns : | fa : array (V, 1)
|
Notes
FA is calculated with the following equation:
FA = \sqrt{\frac{1}{2}\frac{(\lambda_1-\lambda_2)^2+(\lambda_1- \lambda_3)^2+(\lambda_2-\lambda_3)^2}{\lambda_1^2+ \lambda_2^2+\lambda_3^2} }
Quantizes eigenvectors with maximum eigenvalues on an evenly distributed sphere so that the can be used for tractography.
Returns : | IN : array, shape(x,y,z) integer indices for the points of the evenly distributed sphere representing tensor eigenvectors of : maximum eigenvalue : |
---|
Mean diffusitivity (MD) calculated from cached eigenvalues.
Returns : | md : array (V, 1)
|
---|
Notes
MD is calculated with the following equation:
MD = \frac{\lambda_1+\lambda_2+\lambda_3}{3}
Diffusion Tensor
Methods
fit |
Fit method of the DTI model class
Parameters : | data : array
mask : array
|
---|
Axial Diffusivity (AD) of a diffusion tensor. Also called parallel diffusivity.
Parameters : | evals : array-like
axis : int
|
---|---|
Returns : | ad : array
|
Notes
AD is calculated with the following equation:
AD = \lambda_1
Color fractional anisotropy of diffusion tensor
Parameters : | fa : array-like
evecs : array-like
|
---|---|
Returns : | rgb : Array with 3 channels for each color as the last dimension.
|
Notes
it is computed from the clipped FA between 0 and 1 using the following formula
rgb = abs(max(eigen_vector)) \times fa
Returns eigenvalues and eigenvectors given a diffusion tensor
Computes tensor eigen decomposition to calculate eigenvalues and eigenvectors (Basser et al., 1994a).
Parameters : | tensor : array (3, 3)
min_diffusivity : float
|
---|---|
Returns : | eigvals : array (3,)
eigvecs : array (3, 3)
|
Constructs design matrix for DTI weighted least squares or least squares fitting. (Basser et al., 1994a)
Parameters : | gtab : array with shape (3,g)
bval : array with shape (g,)
dtype : string
|
---|---|
Returns : | design_matrix : array (g,7)
|
Fractional anisotropy (FA) of a diffusion tensor.
Parameters : | evals : array-like
axis : int
|
---|---|
Returns : | fa : array
|
Notes
FA is calculated using the following equation:
FA = \sqrt{\frac{1}{2}\frac{(\lambda_1-\lambda_2)^2+(\lambda_1- \lambda_3)^2+(\lambda_2-\lambda_3)^2}{\lambda_1^2+ \lambda_2^2+\lambda_3^2}}
Returns a tensor given the six unique tensor elements
Given the six unique tensor elments (in the order: Dxx, Dxy, Dyy, Dxz, Dyz, Dzz) returns a 3 by 3 tensor. All elements after the sixth are ignored.
Parameters : | D : array_like, (..., >6)
|
---|---|
Returns : | tensor : ndarray (..., 3, 3)
|
Returns the six lower triangular values of the tensor and a dummy variable if b0 is not None
Parameters : | tensor : array_like (..., 3, 3)
b0 : float
|
---|---|
Returns : | D : ndarray
|
Mean Diffusivity (MD) of a diffusion tensor. Also, called Apparent diffusion coefficient (ADC)
Parameters : | evals : array-like
axis : int
|
---|---|
Returns : | md : array
|
Notes
MD is calculated with the following equation:
MD = \frac{\lambda_1 + \lambda_2 + \lambda_3}{3}
Computes ordinary least squares (OLS) fit to calculate self-diffusion tensor using a linear regression model [1].
Parameters : | design_matrix : array (g, 7)
data : array ([X, Y, Z, ...], g)
min_signal : default = 1
|
---|---|
Returns : | eigvals : array (..., 3)
eigvecs : array (..., 3, 3)
|
See also
WLS_fit_tensor, decompose_tensor, design_matrix
Notes
This function is offered mainly as a quick comparison to WLS.
y = \mathrm{data} \\ X = \mathrm{design matrix} \\ \hat{\beta}_\mathrm{OLS} = (X^T X)^{-1} X^T y
References
[1] | Chung, SW., Lu, Y., Henry, R.G., 2006. Comparison of bootstrap approaches for estimation of uncertainties of DTI parameters. NeuroImage 33, 531-541. |
Find the closest orientation of an evenly distributed sphere
Parameters : | evecs : ndarray odf_vertices : None or ndarray
|
---|---|
Returns : | IN : ndarray |
Radial Diffusivity (RD) of a diffusion tensor. Also called perpendicular diffusivity.
Parameters : | evals : array-like
axis : int
|
---|---|
Returns : | rd : array
|
Notes
RD is calculated with the following equation:
RD = \frac{\lambda_2 + \lambda_3}{2}
Calculates parameters for creating a Tensor instance
Calculates tensor parameters from the six unique tensor elements. This function can be passed to the Tensor class as a fit_method for creating a Tensor instance from tensors stored in a nifti file.
Parameters : | data : array_like (..., 6)
|
---|---|
Returns : | dti_params :
|
Trace of a diffusion tensor.
Parameters : | evals : array-like
axis : int
|
---|---|
Returns : | trace : array
|
Notes
Trace is calculated with the following equation:
MD = \lambda_1 + \lambda_2 + \lambda_3
Computes weighted least squares (WLS) fit to calculate self-diffusion tensor using a linear regression model [R6].
Parameters : | design_matrix : array (g, 7)
data : array ([X, Y, Z, ...], g)
min_signal : default = 1
|
---|---|
Returns : | eigvals : array (..., 3)
eigvecs : array (..., 3, 3)
|
See also
Notes
In Chung, et al. 2006, the regression of the WLS fit needed an unbiased preliminary estimate of the weights and therefore the ordinary least squares (OLS) estimates were used. A “two pass” method was implemented:
- calculate OLS estimates of the data
- apply the OLS estimates as weights to the WLS fit of the data
This ensured heteroscadasticity could be properly modeled for various types of bootstrap resampling (namely residual bootstrap).
y = \mathrm{data} \\ X = \mathrm{design matrix} \\ \hat{\beta}_\mathrm{WLS} = \mathrm{desired regression coefficients (e.g. tensor)}\\ \\ \hat{\beta}_\mathrm{WLS} = (X^T W X)^{-1} X^T W y \\ \\ W = \mathrm{diag}((X \hat{\beta}_\mathrm{OLS})^2), \mathrm{where} \hat{\beta}_\mathrm{OLS} = (X^T X)^{-1} X^T y
References
[R6] | (1, 2) Chung, SW., Lu, Y., Henry, R.G., 2006. Comparison of bootstrap approaches for estimation of uncertainties of DTI parameters. NeuroImage 33, 531-541. |