nigsp.operations.nifti.unmask

nigsp.operations.nifti.unmask(data, mask, shape=None, asdata=None)[source]

Unmask 1D or 2D into an nD based on shape or asdata.

Parameters:
datanumpy.ndarray (1D or 2D)

The data to unmask.

masknumpy.ndarray

The nD mask to use to unwrap (unmask) the data. All elements different from 0 will be used as entries for data.

shapeNone or list of int, optional

List indicating shape of nD array.

asdataNone or numpy.ndarray, optional

Array to take the same shape of.

Returns:
numpy.ndarray

The unmasked nD array version of data.

Raises:
ValueError

If both shape and asdata are empty If the first dimension of data and the number of available voxels in mask do not match. If the mask shape does not match the first (mask)