In the following partial script created by afni_proc, how the mask_anat is being created? Is the 3dmask_tool also creates a mask in addition to perform operations on masks?
Will this mask be different from the anatomy mask created by 3dautomask and resampled to epi grid?
# ================================== mask ==================================
# create 'full_mask' dataset (union mask)
foreach run ( $runs )
3dAutomask -dilate 1 -prefix rm.mask_r$run pb03.$subj.r$run.blur+orig
end
# create union of inputs, output type is byte
3dmask_tool -inputs rm.mask_r*+orig.HEAD -union -prefix full_mask.$subj
# ---- create subject anatomy mask, mask_anat.$subj+orig ----
# (resampled from aligned anat)
3dresample -master full_mask.$subj+orig -input anat_al_keep+orig \
-prefix rm.resam.anat
# convert to binary anat mask; fill gaps and holes
3dmask_tool -dilate_input 5 -5 -fill_holes -input rm.resam.anat+orig \
-prefix mask_anat.$subj