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.img_to_signals_maps#

nilearn.regions.img_to_signals_maps(imgs, maps_img, mask_img=None, keep_masked_maps=True)[source]#

Extract region signals from image.

This function is applicable to regions defined by maps.

Parameters:
imgslist of Niimg-like objects

See Input and output: neuroimaging data representation. Input images.

maps_imgNiimg-like object

See Input and output: neuroimaging data representation. Regions definition as maps (array of weights). shape: imgs.shape + (region number, )

mask_imgNiimg-like object, optional

See Input and output: neuroimaging data representation. Mask to apply to regions before extracting signals. Every point outside the mask is considered as background (i.e. outside of any region).

keep_masked_mapsbool, optional

If True, masked atlas with invalid maps (maps that contain only zeros after applying the mask) will be retained in the output, resulting in corresponding time series containing zeros only. If False, the invalid maps will be removed from the trimmed atlas, resulting in no empty time series in the output.

Deprecated since version 0.10.2: The ‘True’ option for keep_masked_maps is deprecated. The default value will change to ‘False’ in 0.13, and the keep_masked_maps parameter will be removed in 0.15.

Returns:
region_signalsnumpy.ndarray

Signals extracted from each region. Shape is: (scans number, number of regions intersecting mask)

labelslist

maps_img[…, labels[n]] is the region that has been used to extract signal region_signals[:, n].