Get the brain mask using 3dAutomask

Dear AFNI experts,

I was using 3dAutomask to get the mask of brain from the epi dataset. I met the problem that some of the skull was included in the mask. Is this acceptable? I’m not sure if the later analysis would be affected if I use this mask. And is there some way to have a cleaner mask?

Many thanks,

Hi, Dong-

Yes, this is a classic case of “identifying brain/nonbrain looks easy to the eye, but the computer doesn’t quite get it”. Whether this will have deep affects on further analysis, depends on what you are trying to do. And note that 3dAutomask is often meant to be a quick-and-convenient approximation, and not a quantitative brain masking approach. So, what are you aiming to do?

Re. ways of improving/tweaking 3dAutomask: You could use the “-clfrac …” option, such as “-clfrac 0.6”. Perhaps “-peels 2” might help. But note that these kinds of refinements can be very scanner-by-scanner and subject-by-subject.


There are also the -erode and -dilate options that can be useful.

If you are dealing with human brain images, and are willing to run somewhat longer CPU times, then the @SSwarper script with the “-skipwarp” option might be best – as a preprocessor. Then run 3dAutomask on the anatSS.SUBJECT-ID.nii output.