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.13.14. nilearn.glm.threshold_stats_img

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, optional

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. Default=0.001.

thresholdfloat, optional

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

height_controlstring, or None optional

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

cluster_thresholdfloat, optional

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

two_sidedBool, optional

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


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

This function is experimental. It may change in any future release of Nilearn.