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.

7.7.5. nilearn.masking.intersect_masks

nilearn.masking.intersect_masks(mask_imgs, threshold=0.5, connected=True)

Compute intersection of several masks

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


mask_imgs: list of Niimg-like objects

See 3D individual masks with same shape and affine.

threshold: float, 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.

connected: bool, optional

If true, extract the main connected component


grp_mask: 3D nibabel.Nifti1Image

intersection of all masks.