cortical mask for 3dTtest

Hello any experts,

I have some questions in 3dTtest -mask. I have aligned all my single subject data to the MNI152 space (MNI152_T1_2009c+tlrc) by afni_proc. I have already established whole-brain functional connectivity (PPI) using seed regions. Now, I intend to conduct a 3dTtest to assess differences between two conditions.
1)My question is that I just want it to be focused on the cortical voxels in 3dTtest. In this context, I'm wondering which mask I should employ?
2)I try to use 3drefit and 3dsample to make aparc.a2009s+aseg_REN_gmrois.nii.gz(I know this is part of suma_MNI152_2009) fit the MNI152_T1_2009c+tlrc and use aparc.a2009s+aseg_REN_gmrois.nii.gz as the cortical mask, is this mask right?
3)or maybe you can tell my some other masks that would be better.


Hi, Fuying-

As one option, if all your datasets are in MNI152 space currently, then one option would be to use a cortical mask of the MNI template brain:

3dcalc -a MNI152_T1_2009c+tlrc. -expr 'bool(a)' -prefix MASK_MNI.nii.gz

After that, you might just need to resample the result to the EPI data grid, like with this (where DSET_EPI would be replaced by a final EPI dataset after processing):

3dresample  \
   -input MASK_MNI.nii.gz \
   -master DSET_EPI \
   -prefix MASK_MNI_ON_EPI_GRID.nii.gz

The practical challenge of that approach is that not all subjects may have data throughout the mask. So we have a second option to consider:
When running, we typically estimate a mask_epi_anat* dataset, and that provides a good measure of where there is EPI data for that subject. More of using this dataset is described here:

  • Taylor PA, Chen G, Glen DR, Rajendra JK, Reynolds RC, Cox RW (2018).
    FMRI processing with AFNI: Some comments and corrections on ‘Exploring
    the Impact of Analysis Software on Task fMRI Results’.
    bioRxiv 308643; doi:10.1101/308643

In the code associated with that paper (see here) we show an example of using 3dmask_tool to take the intersection of all group masks for analysis (the -input .. here is just one way to glob for all mask_epi_anat*HEAD dsets across all subjects---you might have a different recipe to list all of them):

3dmask_tool                                             \
    -prefix mask.nii.gz                                 \
    -input `ls ${path_proc}/sub-*/mask_epi_anat.*.HEAD` \
    -frac 1.0

In other cases, we have used a 70% overlap to define a group mask area, such as in this paper, which has associated 3dmask_tool example here, where one just changes that fraction value from 1.0 to 0.7 in the command.

Finally, as a third option, while I can see why masking brain results for 3dttest++ makes sense, note that there is also a case to be made for showing unmasked results, as described here:

  • Taylor PA, Reynolds RC, Calhoun V, Gonzalez-Castillo J, Handwerker DA, Bandettini PA, Mejia AF, Chen G (2023). Highlight Results, Don’t Hide Them: Enhance interpretation, reduce biases and improve reproducibility. Neuroimage 274:120138. doi: 10.1016/j.neuroimage.2023.120138


Hi ptaylor,

Thank you so much for the instruction. I’ll try these.