phys2cvr.utils.check_nifti_dim

phys2cvr.utils.check_nifti_dim(fname, data, dim=4)[source]

Remove extra dimensions.

Parameters:
fnamestr

The name of the file representing data

datanp.ndarray

The data which dimensionality needs to be checked

dimint, optional

The amount of dimensions expected/desired in the data.

Returns:
np.ndarray

If len(data.shape) = dim, returns data. If len(data.shape) > dim, returns a version of data without the dimensions above dim.

Raises:
ValueError

If data has less dimensions than dim