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.

nilearn.masking.intersect_masks#

nilearn.masking.intersect_masks(mask_imgs, threshold=0.5, connected=True)[source]#

Compute intersection of several masks.

Given a list of input mask images, generate the output image which is the threshold-level intersection of the inputs.

Parameters
mask_imgslist of Niimg-like objects

See https://nilearn.github.io/stable/manipulating_images/input_output.html # noqa:E501 3D individual masks with same shape and affine.

thresholdfloat, optional

Gives the level of the intersection, must be within [0, 1]. threshold=1 corresponds to keeping the intersection of all masks, whereas threshold=0 is the union of all masks. Default=0.5.

connectedbool, optional

If connected is True, only the largest connect component is kept. Default=True.

Returns
grp_mask3D nibabel.nifti1.Nifti1Image

Intersection of all masks.