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', strategy='mean')

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.

imgs: 4D Niimg-like object

See input images.

labels_img: Niimg-like object

See 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 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”.

strategy: str

The name of a valid function to reduce the region with. Must be one of: sum, mean, median, mininum, maximum, variance, standard_deviation

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].