Hello everyone! I’m having some issues combining masks. I have a set of masks of segmentations from Freesurfer, and a hand drawn PAG mask that was drawn on an MNI template. For example, the amygdala ROI from freesurfer is in NIFTI format and aligns to both +orig and +tlrc volumes of my anatomy. The PAG only aligns to +tlrc (since that where it was drawn). All of my analyses at this point are in MNI space so this is fine.
I resampled both the amygdala and PAG to the same grid, and using 3dcalc I can make a mask that has all the ROIs that came from Freesurfer (like the amygdala), but when I add in the PAG I’m running into errors from 3dcalc:
3dcalc -overwrite -a FS_amygdala_MNI_resample_NPU.nii -b PAG_mask_NPU_blur2.nii -expr ‘ispositive(a) + ispositive(b)’ -prefix PAG_centric_network_mask.nii
*+ WARNING: Template space of PAG_mask_NPU_blur2.nii does not match space of first dataset
Continuing anyway, but be sure the datasets really do match
** FATAL ERROR: dataset PAG_mask_NPU_blur2.nii differs in size [17183259 voxels] from others 
I saw in a previous post to check the header information using 3dinfo:
3dinfo -av_space -space -d3 -orient -o3 -prefix FS_amygdala_MNI_resample_NPU.nii PAG_mask_NPU_blur2.nii
+orig ORIG 0.859400 0.859400 1.800000 RAI -108.000000 -151.992004 -20.358101 FS_amygdala_MNI_resample_NPU.nii
+tlrc MNI 0.859400 0.859400 1.800000 RAI -108.000000 -151.992004 -20.358101 PAG_mask_NPU_blur2.nii
Even though the view and space of the amygdala mask is ORIG, it still aligns very well to my MNI space aligned datasets (I think I read that’s the default view for NIFTI files though). I tried 3drefit to change the view and space of the PAG before redoing 3dcalc, but this pushes the PAG way out of alignment.
I’ve tried both 3dresample and 3dfractionize to switch between grids for the freesurfer ROIs and for the PAG, and it doesn’t seem like any combination of resampling and header updating I’ve tried works, one of the masks is always out of alignment.
The strange thing to me is that in the visualization GUI I can overlay the amygdala and PAG masks in the same screen and they appear to be aligned appropriately and in the same space.
I’m stumped… any suggestions for how to get these 2 masks to cooperate with one another?