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.

8.5.20. nilearn.image.threshold_img

nilearn.image.threshold_img(img, threshold, mask_img=None, copy=True)

Threshold the given input image, mostly statistical or atlas images.

Thresholding can be done based on direct image intensities or selection threshold with given percentile.

New in version 0.2.

Parameters:

img : a 3D/4D Niimg-like object

Image contains of statistical or atlas maps which should be thresholded.

threshold : float or str

If float, we threshold the image based on image intensities meaning voxels which have intensities greater than this value will be kept. The given value should be within the range of minimum and maximum intensity of the input image. If string, it should finish with percent sign e.g. “80%” and we threshold based on the score obtained using this percentile on the image data. The voxels which have intensities greater than this score will be kept. The given string should be within the range of “0%” to “100%”.

mask_img : Niimg-like object, default None, optional

Mask image applied to mask the input data. If None, no masking will be applied.

copy : bool

If True, input array is not modified. True by default: the filtering is not performed in-place.

Returns:

Nifti1Image

Thresholded image of the given input image.