foa3d.odf

foa3d.odf.compute_odf_map(fbr_vec, px_sz, odf, odi, fbr_dnst, vec_tnsr_eig, scale, norm, deg=6, vx_thr=0.5, vec_thr=1e-06)

Compute the spherical harmonics coefficients iterating over super-voxels of fiber orientation vectors.

Parameters
  • fbr_vec (NumPy memory-map object (axis order=(Z,Y,X,C), dtype=float)) – fiber orientation vectors

  • px_sz (numpy.ndarray (shape=(3,), dtype=float)) – adjusted isotropic pixel size [μm]

  • odf (NumPy memory-map object (axis order=(X,Y,Z,C), dtype=float32)) – initialized array of ODF spherical harmonics coefficients

  • odi (dict) –

    orientation dispersion dictionary

    odi_pri: NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)

    primary orientation dispersion index

    odi_sec: NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)

    secondary orientation dispersion index

    odi_tot: NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)

    total orientation dispersion index

    odi_anis: NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)

    orientation dispersion index anisotropy

  • fbr_dnst (NumPy memory-map object (axis order=(Z,Y,X), dtype=float)) – initialized fiber density image

  • vec_tnsr_eig (NumPy memory-map object (axis order=(Z,Y,X,C), dtype=float32)) – initialized array of orientation tensor eigenvalues

  • scale (int) – side of the ODF super-voxel [px]

  • norm (numpy.ndarray (dtype: float)) – 2D array of spherical harmonics normalization factors

  • deg (int) – degrees of the spherical harmonics series expansion

  • vx_thr (float) – minimum relative threshold on the sliced voxel volume

  • vec_thr (float) – minimum relative threshold on non-zero orientation vectors

Returns

  • odf (numpy.ndarray (axis order=(X,Y,Z,C), dtype=float32)) – volumetric map of real-valued spherical harmonics coefficients

  • fbr_dnst (numpy.ndarray (axis order=(Z,Y,X), dtype=float)) – fiber density image

foa3d.odf.compute_orientation_dispersion(vec_tnsr_eig, odi_pri, odi_sec, odi_tot, odi_anis)

Compute orientation dispersion parameters.

Parameters
  • vec_tnsr_eig (NumPy memory-map object (axis order=(Z,Y,X,C), dtype=float32)) – orientation tensor eigenvalues computed from an ODF super-voxel

  • odi_pri (NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)) – primary orientation dispersion index

  • odi_sec (NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)) – secondary orientation dispersion index

  • odi_tot (NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)) – total orientation dispersion index

  • odi_anis (NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)) – orientation dispersion index anisotropy

Return type

None

foa3d.odf.compute_vec_tensor_eigen(fbr_vec)

Compute the eigenvalues of the 3x3 orientation tensor obtained from a reshaped super-voxel of fiber orientation vectors.

Parameters

fbr_vec (numpy.ndarray (shape=(N,3), dtype=float)) – fiber orientation vectors (reshaped super-voxel of shape=(Nz,Ny,Nx), i.e. N=Nz*Ny*Nx)

Returns

vec_tensor_eigen – orientation tensor eigenvalues in ascending order

Return type

numpy.ndarray (shape=(3,), dtype=float32)

foa3d.odf.generate_odf_background(bg_mrtrix, fbr_vec, scale, iso_fbr=None)

Generate the down-sampled background image required to visualize the 3D ODF map in MRtrix3.

Parameters
  • bg_mrtrix (numpy.ndarray (axis order=(X,Y,Z), dtype=uint8)) – initialized background array for ODF visualization in MRtrix3

  • fbr_vec (numpy.ndarray (axis order=(Z,Y,X,C), dtype=float32)) – fiber orientation vectors

  • scale (int) – side of the ODF super-voxel [px]

  • iso_fbr (numpy.ndarray (axis order=(Z,Y,X), dtype=uint8)) – isotropic fiber image

Return type

None

foa3d.odf.init_odf_arrays(vec_img_shp, tmp_dir, scale, deg=6, exp_all=False)

Initialize the output datasets of the ODF analysis stage.

Parameters
  • vec_img_shp (tuple) – vector volume shape [px]

  • tmp_dir (str) – path to temporary folder

  • scale (int) – fiber ODF resolution (super-voxel side [px])

  • deg (int) – degrees of the spherical harmonics series expansion

  • exp_all (bool) – export all images

Returns

  • odf (NumPy memory-map object (axis order=(X,Y,Z,C), dtype=float32)) – initialized array of ODF spherical harmonics coefficients

  • odi (dict) –

    dispersion image dictionary

    odi_pri: NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)

    initialized array of primary orientation dispersion parameters

    odi_sec: NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)

    initialized array of secondary orientation dispersion parameters

    odi_tot: NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)

    initialized array of total orientation dispersion parameters

    odi_anis: NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)

    initialized array of orientation dispersion anisotropy parameters

  • fbr_dnst (NumPy memory-map object (axis order=(Z,Y,X), dtype=float)) – initialized fiber density image

  • bg_mrtrix (NumPy memory-map object (axis order=(X,Y,Z), dtype=uint8)) – initialized background for ODF visualization in MRtrix3

  • vec_tensor_eigen (NumPy memory-map object (axis order=(Z,Y,X,C), dtype=float32)) – initialized fiber orientation tensor eigenvalues

foa3d.odf.mask_orientation_dispersion(vec_tnsr_eig, odi)

Suppress orientation dispersion background.

Parameters
  • vec_tnsr_eig (NumPy memory-map object (axis order=(Z,Y,X,C), dtype=float32)) – orientation tensor eigenvalues computed from an ODF super-voxel

  • odi (dict) –

    orientation dispersion dictionary

    odi_pri: NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)

    array of primary orientation dispersion parameters

    odi_sec: NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)

    array of secondary orientation dispersion parameters

    odi_tot: NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)

    array of total orientation dispersion parameters

    odi_anis: NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)

    array of orientation dispersion anisotropy parameters

Return type

None