Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

nilearn.masking.unmask#

nilearn.masking.unmask(X, mask_img, order='F')[source]#

Take masked data and bring them back into 3D/4D.

This function can be applied to a list of masked data.

Parameters:
Xnumpy.ndarray (or list of)

Masked data. shape: (samples #, features #). If X is one-dimensional, it is assumed that samples# == 1.

mask_imgNiimg-like object

See Input and output: neuroimaging data representation. Must be 3-dimensional.

Returns:
datanibabel.nifti1.Nifti1Image

Unmasked data. Depending on the shape of X, data can have different shapes:

  • X.ndim == 2: Shape: (mask.shape[0], mask.shape[1], mask.shape[2], X.shape[0])

  • X.ndim == 1: Shape: (mask.shape[0], mask.shape[1], mask.shape[2])

Examples using nilearn.masking.unmask#

Example of pattern recognition on simulated data

Example of pattern recognition on simulated data