mne.random_parcellation(subject, n_parcel, hemi, subjects_dir=None, surface='white', random_state=None)[source]

Generate random cortex parcellation by growing labels.

This function generates a number of labels which don’t intersect and cover the whole surface. Regions are growing around randomly chosen seeds.


The FreeSurfer subject name.


Total number of cortical parcels.


Hemisphere id (ie ‘lh’, ‘rh’, ‘both’). In the case of ‘both’, both hemispheres are processed with (n_parcel // 2) parcels per hemisphere.

subjects_dirstr | pathlib.Path | None

The path to the directory containing the FreeSurfer subjects reconstructions. If None, defaults to the SUBJECTS_DIR environment variable.


The surface along which to do the computations, defaults to 'white' (the gray-white matter boundary).

random_stateNone | int | instance of RandomState

If random_state is an int, it will be used as a seed for RandomState. If None, the seed will be obtained from the operating system (see RandomState for details). Default is None.

labelslist of Label

Random cortex parcellation.