phys2cvr.io.load_nifti_get_mask

phys2cvr.io.load_nifti_get_mask(fname, is_mask=False, dim=3)[source]

Load a nifti-like file and returns its data, its image, and a 3d mask.

Support all nibabel supported filetypes

Parameters:
fnamestr

The filename to read in

is_maskbool, optional

If the file contains a mask. Default: False

dimint

The number of dimensions expected in fname

Returns:
datanp.ndarray

Data from nifti file.

masknp.ndarray

If is_mask is False, np.ndarray of one dimension less than data, in which any element that has at least a value different from zero in the last dimension of data is True. If is_mask is True, mask is a boolean representation of data.

imgnib.img

Image object from nibabel.