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
.niior.nii.gzfile, 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 itsEchoTime,InversionTimeandRepetitionTimein seconds and itsFlipAnglein 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;timingsin milliseconds and degrees, one per contrast, NaN where no sidecar states one; andheader, the first file’s NIfTI header.- Return type:
Images
- Raises:
ValueError – If the files differ in shape or geometry.