kwneuro.dti module

class kwneuro.dti.Dti(volume)

Bases: object

A diffusion tesnor image.

Parameters:

volume (VolumeResource)

static estimate_from_dwi(dwi, mask=None)

Estimate a DTI from a DWI.

Parameters:
  • dwi (Dwi) – The source DWI

  • mask (VolumeResource | None) – Optionally, a boolean 3D volume that has indicates where the fit should take place, such as a brain mask.

Return type:

Dti

get_eig()

Get eigenvalues and eigenvectors of the diffusion tensors. Returns 3D volumes with the same spatial shape as the DTI.

Returns eigenvalues (evals), eigenvectors (evecs). Each is returned as a VolumeResource.

The evals have shape (H,W,D,3).

The evecs have shape (H,W,D,9), where the final axis provides the three components of the eigenvector that goes with the first eigenvalue, followed by the three components of the eigenvector that goes with the second value, and so on for a total of 9 components.

Return type:

tuple[VolumeResource, VolumeResource]

get_fa_md()

Get fractional anisotropy and mean diffusivity images.

Returns 3D volumes for FA and MD, as VolumeResources.

Return type:

tuple[VolumeResource, VolumeResource]

load()

Load any on-disk resources into memory and return a DTI with all loadable resources loaded.

Return type:

Dti

save(path)

Save all resources to disk and return a Dti with all resources being on-disk.

Parameters:

path (Path | str) – The desired file save location, a nifti file path.

Return type:

Dti

Returns: A Dti with its internal resources being on-disk.

volume: VolumeResource

The DTI image volume. It is a 4D volume, with the first three dimensions being spatial and the final dimension indexing the lower triangular entries of a symmetric matrix, in dipy order (Dxx, Dxy, Dyy, Dxz, Dyz, Dzz).