I’m trying to create a mask, which including all the cortical voxels. I’ve tried “whereami -mask_atlas_region”, which seems can only extract one region as an ROI, like hippo and amy. Is there any way that I can get a mask of the whole cerebral cortex based on atlas?
If you are aligning to the template MNI152_2009_template.nii.gz (part of AFNI binaries), then you can use the #4 sub-brick of that as a gray matter plus CSF mask. You can align to that template using the @SSwarper script supplied with AFNI, for example.
In general, a gray matter mask can only be useful if reasonably high-order nonlinear registration (e.g., 3dQwarp) is used to align the brain to a template. Otherwise, there is too much inter-subject variability for this idea to be useful.