Giving credit

4.4.1.3. 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

Parameters :

masks_imgs: list of 3D nifti-like images :

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

Returns :

grp_mask: 3D nifti-like image :

intersection of all masks.