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.

8.8.1. nilearn.regions.connected_regions

nilearn.regions.connected_regions(maps_img, min_region_size=1350, extract_type='local_regions', smoothing_fwhm=6, mask_img=None)[source]

Extraction of brain connected regions into separate regions.


The region size should be defined in mm^3. See the documentation for more details.

New in version 0.2.

maps_imgNiimg-like object

An image of brain activation or atlas maps to be extracted into set of separate brain regions.

min_region_sizefloat, optional

Minimum volume in mm3 for a region to be kept. For example, if the voxel size is 3x3x3 mm then the volume of the voxel is 27mm^3. Default=1350mm^3, which means we take minimum size of 1350 / 27 = 50 voxels.

extractor{‘local_regions’, ‘connected_components’}, optional

This option can take two values:

  • ‘connected_components’: each component/region in the image is extracted automatically by labelling each region based upon the presence of unique features in their respective regions.

  • ‘local_regions’: each component/region is extracted based on their maximum peak value to define a seed marker and then using random walker segmentation algorithm on these markers for region separation.


smoothing_fwhmfloat, optional

To smooth an image to extract most sparser regions. This parameter is passed _smooth_array and exists only for extract_type ‘local_regions’. Default=6.

mask_imgNiimg-like object, optional

If given, mask image is applied to input data. If None, no masking is applied.


Gives the image in 4D of extracted brain regions. Each 3D image consists of only one separated region.


An array of list of indices where each index denotes the identity of each extracted region to their family of brain maps.

See also


A function can be used for extraction of regions on labels based atlas images.


A class can be used for both region extraction on continuous type atlas images and also time series signals extraction from regions extracted. Examples using nilearn.regions.connected_regions