Removing an ROI from a whole brain mask

Hi all,

I was wondering how to remove an ROI from a whole brain mask. I created the whole brain mask using 3dAutomask with each subject’s functional data, which seemed to work pretty well. I also have another ROI I created.

To get the whole brain and ROI mean activation values, I used each mask with 3dROIstats to draw from the stats output of 3dDeconvolve. However, as I want to see how activation outside the ROI is correlated with activation in the ROI, I need to make a whole brain mask in which this ROI is removed. Any suggestions about how to do this, preferably using commands rather than the GUI, would be most appreciated.


How about subtracting the ROI mask away from the whole brain? The following assumes that the ROI is wholly contained within the brain mask:

3dcalc -a BRAIN_MASK -b ROI_MASK  -expr 'step(a) -step(b)' -prefix BRAIN_SANS_ROI

Or you could do the following if that might not be the case (regions with value <0 after subtraction would be removed):

3dcalc -a BRAIN_MASK -b ROI_MASK  -expr 'step(step(a) -step(b))' -prefix BRAIN_SANS_ROI

Also, you give the whole brain region outside of the ROI a value of ‘1’ everywhere, and the ROI region a value of 2, and then you could just run a single 3dROIstats command to get the mean of each (because ROIstats treats each region of distinct integers as a distinct ROI). Then you could modify the first case above to be:

3dcalc -a BRAIN_MASK -b ROI_MASK  -expr 'step(a) + step(b)' -prefix BRAIN_HIGHLIGHT_ROI


I went with the second option. It seems to work quite well, thanks!