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.glm.threshold_stats_img(stat_img=None, mask_img=None, alpha=0.001, threshold=3.0, height_control='fpr', cluster_threshold=0, two_sided=True)[source]#

Compute the required threshold level and return the thresholded map.

stat_imgNiimg-like object or None, optional

Statistical image (presumably in z scale) whenever height_control is ‘fpr’ or None, stat_img=None is acceptable. If it is ‘fdr’ or ‘bonferroni’, an error is raised if stat_img is None.

mask_imgNiimg-like object, optional,

Mask image

alphafloat or list, default=0.001

Number controlling the thresholding (either a p-value or q-value). Its actual meaning depends on the height_control parameter. This function translates alpha to a z-scale threshold.

thresholdfloat, default=3.0

Desired threshold in z-scale. This is used only if height_control is None.

height_controlstring, or None optional, default=’fpr’

False positive control meaning of cluster forming threshold: None|’fpr’|’fdr’|’bonferroni’

cluster_thresholdfloat, default=0

cluster size threshold. In the returned thresholded map, sets of connected voxels (clusters) with size smaller than this number will be removed.

two_sidedBool, default=True

Whether the thresholding should yield both positive and negative part of the maps. In that case, alpha is corrected by a factor of 2.


The stat_map thresholded at the prescribed voxel- and cluster-level.


The voxel-level threshold used actually.

See also


Apply an explicit voxel-level (and optionally cluster-level) threshold without correction.


If the input image is not z-scaled (i.e. some z-transformed statistic) the computed threshold is not rigorous and likely meaningless

Examples using nilearn.glm.threshold_stats_img#

Statistical testing of a second-level analysis

Statistical testing of a second-level analysis

Voxel-Based Morphometry on OASIS dataset

Voxel-Based Morphometry on OASIS dataset

Example of generic design in second-level models

Example of generic design in second-level models