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.datasets.fetch_icbm152_brain_gm_mask(data_dir=None, threshold=0.2, resume=True, n_iter=2, verbose=1)[source]

Download ICBM152 template first, then loads the ‘gm’ mask.

The default template of fMRIPrep is the asymmetrical ICBM152 2009, release c (MNI152NLin2009cSAsym). The NiLearn template is asymmetrical ICBM152 2009, release a. If you wish to use the exact same release as fMRIPrep, please refer to TemplateFlow (

Added in version 0.2.5.

data_dirpathlib.Path or str, optional

Path where data should be downloaded. By default, files are downloaded in a nilearn_data folder in the home directory of the user. See also nilearn.datasets.utils.get_data_dirs.

thresholdfloat, default=0.2

Values of the ICBM152 grey-matter template above this threshold will be included.

resumebool, default=True

Whether to resume download of a partly-downloaded file.

n_iter: int, default=2

Number of repetitions of dilation and erosion steps performed in scipy.ndimage.binary_closing function.

Added in version 0.8.1.

verboseint, default=1

Verbosity level (0 means no message).

gm_mask_imgNifti1Image, image corresponding to the brain grey matter

from ICBM152 template.

See also


for details regarding the ICBM152 template.


for details about version of MNI152 template and related.


This function relies on ICBM152 templates where we particularly pick grey matter template and threshold the template at .2 to take one fifth of the values. Then, do a bit post processing such as binary closing operation to more compact mask image.


It is advised to check the mask image with your own data processing.

Examples using nilearn.datasets.fetch_icbm152_brain_gm_mask

Understanding parameters of the first-level model

Understanding parameters of the first-level model

Voxel-Based Morphometry on OASIS dataset

Voxel-Based Morphometry on OASIS dataset