nifreeze.data.dmri module

Representing data in hard-disk and memory.

class nifreeze.data.dmri.DWI(self, dataobj=None, affine=None, brainmask=None, bzero=None, gradients=None, em_affines=None, fieldmap=None, filepath=NOTHING) None[source]

Bases: object

Data representation structure for dMRI data.

Method generated by attrs for class DWI.

__len__()[source]

Obtain the number of high-b orientations.

affine

Best affine for RAS-to-voxel conversion of coordinates (NIfTI header).

brainmask

A boolean ndarray object containing a corresponding brainmask.

bzero

A b=0 reference map, preferably obtained by some smart averaging. If the \(B_0\) fieldmap is set, this b=0 reference map should also be unwarped.

dataobj

A numpy ndarray object for the data array, without b=0 volumes.

em_affines

List of nitransforms.linear.Affine objects that bring DWIs (i.e., no b=0) into alignment.

fieldmap

A 3D displacements field to unwarp susceptibility distortions.

classmethod from_filename(filename)[source]

Read an HDF5 file from disk.

get_filename()[source]

Get the filepath of the HDF5 file.

gradients

A 2D numpy array of the gradient table in RAS+B format.

plot_gradients(**kwargs)[source]

Visualize diffusion gradient.

plot_mosaic(index=None, **kwargs)[source]

Visualize one direction of the dMRI dataset.

set_transform(index, affine, order=3)[source]

Set an affine, and update data object and gradients.

to_filename(filename, compression=None, compression_opts=None)[source]

Write an HDF5 file to disk.

to_nifti(filename, **kwargs)[source]

Write a NIfTI 1.0 file to disk.

nifreeze.data.dmri.load(filename, gradients_file=None, b0_file=None, brainmask_file=None, fmap_file=None, bvec_file=None, bval_file=None, b0_thres=50)[source]

Load DWI data.