I’m sure there’s a simple solution but all of the ones I’m coming up with seem to be much more complicated than need be:
I have an atlas that is warped to subject space (mice). I’d like to drop several of the ROIs and save the resultant atlas subset. Code options for selecting an ROI and creating a mask/atlas are easily available. Code for subsetting (dropping) regions seems much more cumbersome.
Anyone have any quick code for doing so? I’ll take any language.
I think nilearn.image.math_img can do what you want. I assume your atlas is a 3D nifti with different voxel values corresponding to different regions, rather than a 4D probabilistic atlas.
Also easy in AFNI with these commands. You can copy selected regions with either indices or labels. The new dataset can get the same labels too.
3dcalc -a ~/abin/MNI_Glasser_HCP_v1.0.nii.gz’<L_Area_anterior_32_prime,R_Area_anterior_32_prime>’ -expr a -datum short -nscale -prefix ant32prime.nii.gz -overwrite