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.connected_label_regions#
- 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.
- Parameters
- labels_imgNifti-like image
A 3D image which contains regions denoted as labels. Each region is assigned with integers.
- min_size
float
, optional Minimum region size (in mm^3) in volume required to keep after extraction. Removes small or spurious regions.
- connect_diag
bool
, optional 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. Default=True.
- labels1D
numpy.ndarray
orlist
ofstr
, 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.
- Returns
- new_labels_img
nibabel.nifti1.Nifti1Image
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.
- new_labels_img
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.
Notes
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