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.

7.8.3. nilearn.regions.img_to_signals_labels

nilearn.regions.img_to_signals_labels(imgs, labels_img, mask_img=None, background_label=0, order='F')

Extract region signals from image.

This function is applicable to regions defined by labels.

labels, imgs and mask shapes and affines must fit. This function performs no resampling.

Parameters:

imgs: 4D Niimg-like object

labels_img: Niimg-like object

See http://nilearn.github.io/manipulating_images/input_output.html regions definition as labels. By default, the label zero is used to denote an absence of region. Use background_label to change it.

mask_img: Niimg-like object

See http://nilearn.github.io/manipulating_images/input_output.html Mask to apply to labels before extracting signals. Every point outside the mask is considered as background (i.e. no region).

background_label: number

number representing background in labels_img.

order: str

ordering of output array (“C” or “F”). Defaults to “F”.

Returns:

signals: numpy.ndarray

Signals extracted from each region. One output signal is the mean of all input signals in a given region. If some regions are entirely outside the mask, the corresponding signal is zero. Shape is: (scan number, number of regions)

labels: list or tuple

corresponding labels for each signal. signal[:, n] was extracted from the region with label labels[n].