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.2dev: 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

Boolean array giving voxels to process. integer arrays also accepted, In this array, zero means False, non-zero means True.

background_labelnumber, optional

Label to use for “no region”. Default=0.

orderstr, optional

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

Returns:
imgnibabel.nifti1.Nifti1Image

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