Create a mask from a huge cluster

Hi all,

I have a functional localizer data to define middle temporal area. I did 3dDeconvolve and set threshold at a p=.001 on AFNI GUI. Then I did ‘clusterize’ on GUI with default NN level and number of voxels.

As shown in an attached image, I can see the four big clusters, and two of them are the bilateral MT areas which I’m looking for, but results from ‘clusterize’ provide me one huge cluster including those (apparently) four chunks.

What I want to create is the two masks each only for the left and right MT.

I tried to adjust the level of threshold in order to separate the left, right MT from the huge cluster, then there are issues like 1)some people have only hemisphere MT survived (i.e. left MT only) even if I can see bilateral MT at a p=.001 threshold, 2) the survived cluster’s voxel number gets smaller, and 3) the adjusted threshold levels are different between each hemisphere’s MT or among participants.

I would appreciate it if you could give me any advice on how to make a mask for each MT area in this situation.

Four your information, I didn’t normalize epi data to MNI or other normalized space in accordance with a custom in visual neuroscience field.

Thank you always!!


Hi Mpark-

You have a few options. The main two that come to my mind are:

A) Take the large ROI and divide it into multiple ROIs using at Atlas.

Many ways to do this, but to divide this into the most simple steps: 1) use whereami to create an ROI of an atlas region / Freesurfer segmentation[/url]. [i]Repeat this step for Left and Right and any other sub-regions you’d like[/i] 2) Use Clusterize / [url=]3dROIMaker[/url] / [url=]3dClusterize[/url] to create your clusters. 3) Use 3dcalc to multiply your Clusterize map with the anatomical ROI you made in (1). And finally 3) [url=]combine your new ROIs into a joint map using either 3dcalc or 3dTstat[/url]. You can then use this combined ROI mask with all your regions of interest for extracting values via [url=]3dROIstats or other programs.

B) Use 3dROIMaker with -mask option to take the highest % or number of voxels in the ROIs (created above using whereami) for each atlas region to get a focal point within the ROI of “hottest” voxels. I’ve found this useful for pulling out localizer activation for use with say rsFMRI data and the Legendary Paul Taylor was kind enough to add it back in 2013/2014.

For either of these steps, you’ll likely need to use 3dfractionize to reduce the dimensions / resolution of your ROI dataset to match your functional dataset.

Let me know if you get stuck in those and I can write out more code or even do a blog post.


Noticed that you said you aren’t normalizing the data to MNI or standard space. You can still use this approach by taking those atlas regions back to subject space using the inverse transform out of or @SSWarper.

If you use the Freesurfer segmentation, those are already in your subject space after you run @SUMA_Make_Spec_FS - though the principle is pretty similar and the results depending on the regions will be close.


Adding on to Pete’s numerous good suggestions…

For the regions you showed in the image, you can probably separate them with 3dmask_tool using erosion and dilation. That is one way to remove small necks of regions. So you might. try

3dmask_tool -dilate_inputs -3 3 -prefix MTlocal_nonecks.nii.gz -inputs MTclusts.nii.gz

Almost every atlas has some region related to MT/V5, and you can use these instead of the functional localizer or in combination if you want. You can peruse the list of atlas regions with whereami -show_atlas_code, or use whereami in the AFNI GUI to find the regions listed at the same coordinate (see example below). The Brainnetome and MNI_Glasser_HCP atlases have very different definitions for example. The HCP temporal regions are described here:

whereami -space MNI -49 67 4
++ Input coordinates orientation set by default rules to RAI
+++++++ nearby Atlas structures +++++++

Original input data coordinates in MNI space

Focus point (LPI)=
    48.51 mm [R], -64.73 mm [P],   6.93 mm [S] {TLRC}
    49.00 mm [R], -67.00 mm [P],   4.00 mm [S] {MNI}
    49.00 mm [R], -71.00 mm [P],   9.00 mm [S] {MNI_ANAT}

Atlas MNI_Glasser_HCP_v1.0: Glasser HCP 2016 surface-based parcellation
   Focus point:  R_Medial_Superior_Temporal_Area
 * Within 1 mm: R_Area_FST
 * Within 2 mm: R_Area_V4t
 * Within 3 mm: R_Middle_Temporal_Area
 * Within 5 mm: R_Area_PH
 * Within 7 mm: R_Area_TemporoParietoOccipital_Junction_2

Atlas Brainnetome_1.0: Brainnetome MPM
   Focus point:  V5/MT+_right
 * Within 3 mm: A37dl_right
            -AND-  A39c_right
 * Within 5 mm: A37vl_right

Atlas CA_ML_18_MNI: Macro Labels (N27-MNI)
   Focus point:  Right Middle Temporal Gyrus
 * Within 5 mm: Right Middle Occipital Gyrus
 * Within 7 mm: Right Inferior Temporal Gyrus

Atlas CA_MPM_22_MNI: Eickhoff-Zilles MPM atlas
   Focus point:  Area_hOc5_(V5/MT)
 * Within 2 mm: Area_hOc4la

Atlas DD_Desai_MPM: Maximum probability maps of Desai DD and FS maps
   Focus point:  Right-Cerebral-White-Matter
 * Within 3 mm: ctx_rh_G_occipital_middle
 * Within 4 mm: ctx_rh_G_temporal_middle
 * Within 6 mm: ctx_rh_S_temporal_sup

Atlas DKD_Desai_MPM: Maximum probability maps of Desai DKD and FS maps
   Focus point:  Right-Cerebral-White-Matter
 * Within 2 mm: ctx-rh-lateraloccipital
 * Within 3 mm: ctx-rh-middletemporal
            -AND-  ctx-rh-inferiorparietal

Atlas CA_GW_18_MNIA: Cytoarch. Prob. Maps for gray/white matter
   Focus point:  grey   (p = 0.68)
            -AND-  white   (p = 0.31)

Atlas CA_N27_LR: Left/Right (N27) 1.8
   Focus point:  Right Brain

Atlas TT_Daemon: Talairach-Tournoux Atlas
   Focus point:  Right Middle Temporal Gyrus
            -AND-  Right Brodmann area 37
 * Within 3 mm: Right Middle Occipital Gyrus
            -AND-  Right Brodmann area 19
            -AND-  Right Brodmann area 39
 * Within 5 mm: Right Inferior Temporal Gyrus

******** Please use results with caution! ********
******** Brain anatomy is quite variable! ********
******** The database may contain errors! ********

As Pete said, to move these atlas regions to the native space of your subject, you would invert the transformations of the dataset computed by @SSwarper or An example script is shown here for @SSwarper:,165893,166041

Also an example using is shown here on one of the later slides:

Note the atlas should be in the space of the template to which you have aligned. Also you should use a nearest neighbor interpolation with “3dNwarpApply -ainterp NN”.

Thanks for the great suggestions, Peter and Daniel!

I’m doing one by one you’ve suggested.
As for the suggestion by Peter, I’ve noticed I have subject’s Freesurfer atlas after making retinotopic map. So I successfully did the whole procedure and created the conjunction of freesurfer atlas and my four chunks mask.
But I noticed that the T1.nii in SUMA generated after doing Freesurfer things is not aligned with my T1 file after preprocessing procedure (skull strip, deoblique etc.).
Can I align the SUMA files (e.g. apar.aseg.nii) to my epi or skull-stripped T1 data?

Currently, I’m looking at 3dmask_tool, and I’ve got a mask of the two occipital clusters (‘A mask after 3dmask_tool’ in the attached) among the four clusters (‘A huge cluster’ in the attached).
But what if I want to create a mask the removed, temporal side of two cluster which is the bilateral MT+ (‘These are my interest’ in the attached)?
If this is possible, it would be the best way for my situation!!

Plus, what’s the meaning of level for ‘-dilate_inputs’ in 3dmask_tool?

Thank you all so much! Your advice always helpful!

My recommendation is to reprocessing using Subject_SurfVol.nii as your “anat” dataset in with the -anat_has_skull set to “no”. Then make sure that you have things aligning to the anatomical via -volreg_align_e2a. I’ve found this is generally the safest and also benefits from all of the AFNI automated QC images.

As an alternative, you can use @SUMA_AlignToExperiment and specify your follower datasets to include your aparc and aseg datasets.

Also if you’re not already doing so, we generally recommend using the -NIFTI flag in your @SUMA_Make_Spec_FS commands.

What 3dmask_tool command are you using? That’s a different slice than your first post, but I would expect a different result with the command options I posted. You can, of course, just erode and do no dilations to make the clusters slightly smaller. You can also put spheres around centers of the clusters (3dCM or @measure_erosion_thick to find centers). With a localizer task, you are somewhat free to make your own choices, as long as it’s done in a principled way that makes sense.