Extracting Voxels Of Func Map With Lesion Cut

I have NIFTI files of anat, func and lesion areas for 1 subject. I made nilearn plot_stat_map for all nifty and have a result in image:

What i m trying to have is: crop regions of func (blue,red green) with lesion area, so the region of lesion should be clean of func inside countour, but with anat background. What is the way to do it?

Best Vyacheslav

What was my solution:

resampled_lesion_motor = nilearn.image.reample_to_image(motor, lesion) #resampling to same dim     lesion and motor maps
motor_data = motor.get_data().copy()
motor_data[resampled_lesion_motor.get_data().astype(bool)] = 0 #zeroing region with get
motor_wo_lesion = image.new_img_like(motor, motor_data)

As it seen it on image motor( after ICA map) was cropped with lesion map.


1 Like