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.connected_label_regions(labels_img, min_size=None, connect_diag=True, labels=None)[source]

Extract connected regions from a brain atlas image defined by labels (integers).

For each label in a parcellation, separates out connected components and assigns to each separated region a unique label.

labels_imgNifti-like image

A 3D image which contains regions denoted as labels. Each region is assigned with integers.

min_sizefloat, optional

Minimum region size (in mm^3) in volume required to keep after extraction. Removes small or spurious regions.

connect_diagbool, default=True

If ‘connect_diag’ is True, two voxels are considered in the same region if they are connected along the diagonal (26-connectivity). If it is False, two voxels are considered connected only if they are within the same x, y, or z direction.

labels1D numpy.ndarray or list of str, optional

Each string in a list or array denote the name of the brain atlas regions given in labels_img input. If provided, same names will be re-assigned corresponding to each connected component based extraction of regions relabelling. The total number of names should match with the number of labels assigned in the image.


A new image comprising of regions extracted on an input labels_img.

new_labelslist, optional

If labels are provided, new labels assigned to region extracted will be returned. Otherwise, only new labels image will be returned.

See also


For an example of atlas with labels.


A class can be used for region extraction on continuous type atlas images.


A function used for region extraction on continuous type atlas images.


The order of the names given in labels should be appropriately matched with the unique labels (integers) assigned to each region given in labels_img (also excluding ‘Background’ label).

Examples using nilearn.regions.connected_label_regions

Breaking an atlas of labels in separated regions

Breaking an atlas of labels in separated regions