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.
8.8.2. nilearn.regions.connected_label_regions¶
nilearn.regions.
connected_label_regions
(labels_img, min_size=None, connect_diag=True, labels=None)¶Extract connected regions from a brain atlas image defined by labels (integers).
For each label in an parcellations, separates out connected components and assigns to each separated region a unique label.
Parameters: labels_img : Nifti-like image
A 3D image which contains regions denoted as labels. Each region is assigned with integers.
min_size : float, in mm^3 optional (default None)
Minimum region size in volume required to keep after extraction. Removes small or spurious regions.
connect_diag : bool (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.
labels : 1D numpy array or list of str, (default None), 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.
NOTE: 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).
Returns: new_labels_img : Nifti-like image
A new image comprising of regions extracted on an input labels_img.
new_labels : list, optional
If labels are provided, new labels assigned to region extracted will be returned. Otherwise, only new labels image will be returned.
See also
nilearn.datasets.fetch_atlas_harvard_oxford
- For an example of atlas with labels.
nilearn.regions.RegionExtractor
- A class can be used for region extraction on continuous type atlas images.
nilearn.regions.connected_regions
- A function used for region extraction on continuous type atlas images.