Function for computing DTI and DKI spherical harmonics from diffusion and kurtosis tensors
- designer.tractography.odf.dkiodfcartesian(odf, x, y, z)¶
Convert DKI ODF coefficients at voxel to Cartesian form.
- Parameters
odf (array_like(dtype=float64)) – ODF coefficients at a voxel. There are 29 coefficients for DKI ODFs
x (array_like(dtype=float64)) – Cartesian x coordinates
y (array_like(dtype=float64)) – Cartesian y coordinates
z (array_like(dtype=float64)) – Cartesian z coordinates
- Returns
cart – ODF in cartesian form
- Return type
array_like(dtype=float64)
- designer.tractography.odf.dkiodfspherical(odf, phi, theta)¶
Convert DKI ODFs coefficients at voxel to spherical form.
- Parameters
odf (array_like(dtype=float64)) – ODF coefficients at a voxel. There are 29 coefficients for DKI ODFs
phi (array_like(dtype=float64)) – Polar phi angles
theta (array_like(dtype=float64)) – Polar theta angles
- Returns
spherical – ODF in spherical form
- Return type
array_like(dtype=float64)
- designer.tractography.odf.dtiodfspherical(odf, phi, theta, radial_weight=4)¶
Convert DTI ODFs coefficients at voxel to spherical form.
- Parameters
odf (array_like(dtype=float64)) – ODF coefficients at a voxel. There are 29 coefficients for DKI ODFs
phi (array_like(dtype=float64)) – Polar phi angles
theta (array_like(dtype=float64)) – Polar theta angles
radial_weight (float) – Radial weighting power for detecting directional differences (Default: 4)
- Returns
spherical – ODF in spherical form
- Return type
array_like(dtype=float64)
- class designer.tractography.odf.odfmodel(dt, kt=None, mask=None, scale=None, res='med', l_max=6, radial_weight=4, nthreads=None)¶
Bases:
object
DTI/DKI tractograpy class for computing ODFs and preparing spherical harmonics for DTI or DKI fiber tracking.
- dkiodf(form='spherical', fa_t=0.9)¶
Computes DKI ODFs for the whole brain.
- Parameters
form (str; optional; {‘spherical’, ‘cartesial’, ‘coefficient’}) – Form of ODF to return in (Default: ‘spherical’)
fa_t (float64; optional) – In rare cases the diffusion tensor may be extremely isotropic with very small eigenvalues, causing the kurtosis dODF to have erratic behavior with very large values, as the kurtosis dODF evaluates the inverse of D. Setting a threshold removes negative eigenvalues while preserving principal orientation in voxels where FA >= threshold (Default: 0.95)
- Return type
DKI ODF in defined form
- dkiodfhelper(dt, kt, radial_weight=4, fa_t=None, form='spherical')¶
Computes DKI fODF coefficient at a voxel. This function is intended to parallelize computations across the brain.
- Parameters
dt (array_like(dtype=float)) – Diffusion tensor containing 6 elements
kt (array_like(dtype=float)) – Kurtosis tensor containing 15 elements
radial_weighing (float; optional) – Radial weighting power for detecting directional differences (Default: 4)
fa_t (float64) – In rare cases the diffusion tensor may be extremely isotropic with very small eigenvalues, causing the kurtosis dODF to have erratic behavior with very large values, as the kurtosis dODF evaluates the inverse of D. Setting a threshold removes negative eigenvalues while preserving principal orientation in voxels where FA >= threshold
form (str; optional; {‘spherical’, ‘cartesian’, ‘coefficient’}) – Form of ODF to return in (Default: ‘spherical’)
- Returns
odf – DKI ODFs in either coefficient, spherical, or cartesian form
- Return type
array_like(dtype=float)
- dtiodf(form='spherical')¶
Computed DTI ODFs for the whole brain (ellipsoids)
- Parameters
form (str; optional; {‘spherical’, ‘cartesian’, ‘coefficient’}) – Form of ODF to return in (Default: ‘spherical’)
- Return type
DTI ODF in defined form
- dtiodfhelper(dt, form='spherical')¶
Computes DTI fODF coefficient at a voxel. This function is intended to parallelize computations across the brain. Use only for diffusion ellipsoids.
- Parameters
dt (array_like(dtype=float)) – Diffusion tensor containing 6 elements
radial_weighing (float; optional) – Radial weighting power for detecting directional differences (Default: 4)
form (str; optional; {‘spherical’, ‘coefficient’}) – Form of ODF to return in (Default: ‘spherical’)
- Returns
odf – DKI ODFs in either coefficient, spherical, or cartesian form
- Return type
array_like(dtype=float)
- odf2sh(odf)¶
Converts whole-brain ODFs to spherical harmonics sampled at direction set specified by resolution. Only the real portion is returned.
- Parameters
odf (4D ODF file containing spherical ODFs)
- Returns
sh – Shperical harmonic expansion of ODF
- Return type
array_like(dtype=float64)
- odf2shhelper(odf, B, scale)¶
Helper function to parallelize computation spherical harmonic expansion at a voxel.
- Parameters
odf (array_like(dtype=float64)) – Spherical ODF values at a voxel
B (array_like(dtype=complex)) – Spherical harmonic basis set to compute expansion
scale (float64) – Value of dMRI metric to multiply ODF with to control stopping criteria in tractography
- Returns
sh
- Return type
Shpherical harmonic expansion of ODF at voxel
- odfmaxhelper(odf)¶
Find local maxima of ODF over spherical grid at voxel
- Parameters
odf (array_like(dtype=float64)) – Spherical ODF values at a voxel
- Returns
odfmax (array_like(dtype=float64)) – Local maxima of ODF over spherical grid in descending order
dirmax (array_like(dtype=float64)) – Corresponding direction vector where local ODF maxima occur
- savenii(var, path)¶
Write out NifTI output of associated spherical harmonic file
- Parameters
var (array_like) – variable to write out
path (str) – Path to output file
- Return type
None; writes out file
- designer.tractography.odf.shbasis(deg, phi, theta, method='scipy')¶
Computes shperical harmonic bases for all orders (even and odd), using functions defined by scipy, Tournier, or Descoteaux.
- Parameters
deg (list of ints) – Degrees of harmonic
phi (array_like) – (n, ) vector denoting polar coordinates
theta (array_like) – (n, ) vector denoting azimuthal coordinates
method (str; optional; {scipy, tournier, descoteaux}) – Define method for SH basis set
- Returns
Harmonic samples at theta and phi at specified order
- Return type
complex array_like