kwneuro.dwi module

class kwneuro.dwi.Dwi(volume, bval, bvec)

Bases: object

A diffusion weighted image.

Parameters:
bval: BvalResource

The DWI b-values

bvec: BvecResource

The DWI b-vectors

compute_mean_b0()

Compute the mean of the b=0 images of a DWI.

Return type:

InMemoryVolumeResource

static concatenate(dwis)

Concatenate a list of `Dwi`s into a single (loaded) DWI.

The affine and metadata of the first Dwi in the list will be used to concatenate volumes.

Parameters:

dwis (list[Dwi])

Return type:

Dwi

denoise()

Denoise using Patch2Self from DIPY.

Return type:

Dwi

estimate_dti(mask=None)

Estimate diffusion tensor image from this DWI

Parameters:

mask (VolumeResource | None)

Return type:

Dti

estimate_noddi(mask=None, dpar=0.0017, n_kernel_dirs=500)

Estimate NODDI model parameters from this DWI. See Noddi.estimate_from_dwi for details.

Parameters:
Return type:

Noddi

extract_brain()

Extract brain mask. This is meant to be convenient rather than efficient. Using this in a loop could result in unnecessary repetition of file I/O operations. For efficiency, see kwneuro.masks.brain_extract_batch.

Return type:

InMemoryVolumeResource

get_gtab()

Get the GradientTable for this DWI.

Return type:

GradientTable

load()

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

Return type:

Dwi

save(path, basename)

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

Parameters:
  • path (Path | str) – The desired save directory.

  • basename (str) – The desired file basenames, i.e. without an extension.

Return type:

Dwi

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

volume: VolumeResource

The DWI image volume. It is assumed to be a 4D volume, with the first three dimensions being spatial and the final dimension indexing the diffusion weightings.