io.read_nifti

Contents

io.read_nifti#

bartorch.io.read_nifti()#

Read NIfTI images, and the timings of their BIDS sidecars, as contrasts.

Parameters:

path (str or sequence of str) – A .nii or .nii.gz file, or several of the same shape and geometry, one per contrast as BIDS stores the echoes of a multi-echo acquisition. A JSON sidecar beside a file, of the same name, gives its EchoTime, InversionTime and RepetitionTime in seconds and its FlipAngle in degrees.

Returns:

A named tuple of image, (contrasts, z, y, x) where the volumes of every file follow each other; affine, the file’s (4, 4) from voxel indices (x, y, z) to RAS millimetres; timings in milliseconds and degrees, one per contrast, NaN where no sidecar states one; and header, the first file’s NIfTI header.

Return type:

Images

Raises:

ValueError – If the files differ in shape or geometry.