Problems creating union of ROIs


I have separate ROIs for the two sides of the hippocampus and am trying to combine them using nilearn. So far I’ve managed to binarize them using nilearn.image.math_img :

R_mask_img = load_img("…")
R_mask = math_img(‘img > 0’, img=R_mask_img)

and when I plot the individual sides, they look great, but when I try to combine them using the code:
bilat_mask = nilearn.masking.intersect_masks([L_mask, R_mask], threshold=0) and plot the result, it only shows a region on the left side of the brain (regardless of which order I put the masks in mask_img list).

Can someone give me insight into what might be going on? Thanks!

I think you can simply add two masks.

mask = math_img('img1 + img2', img1=R_mask, img2=L_mask)
1 Like

That worked! thank you so much!!