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.regions.signals_to_img_labels#

nilearn.regions.signals_to_img_labels(signals, labels_img, mask_img=None, background_label=0, order='F')[source]#

Create image from region signals defined as labels.

The same region signal is used for each voxel of the corresponding 3D volume.

labels_img, mask_img must have the same shapes and affines.

Changed in version 0.9.2: Support 1D signals.

Parameters:
signalsnumpy.ndarray

1D or 2D array. If this is a 1D array, it must have as many elements as there are regions in the labels_img. If it is 2D, it should have the shape (number of scans, number of regions in labels_img).

labels_imgNiimg-like object

See Input and output: neuroimaging data representation. Region definitions using labels.

mask_imgNiimg-like object, optional

See Input and output: neuroimaging data representation. Boolean array giving voxels to process. integer arrays also accepted, In this array, zero means False, non-zero means True.

background_labelnumber, default=0

Label to use for “no region”.

orderstr, default=”F”

Ordering of output array (“C” or “F”).

Returns:
imgnibabel.nifti1.Nifti1Image

Reconstructed image. dtype is that of “signals”, affine and shape are those of labels_img.