SUMA gmrois labels

Is there a file containing the labels of all areas in the aparc.a2009s+aseg_REN_gmrois.nii.gz ?
I want to create a cerebral-cortex-only gray matter mask, thus I need to remove all sub-cortex areas from the aparc.a2009s+aseg_REN_gmrois.nii.gz.

Thank you in advance!

Hi, Maya-

There are a couple ways to get this info.

To see the labeltable in an ROI file that has them (and those REN files have 'em), you can run:

3dinfo -labeltable aparc.a2009s+aseg_REN_gmrois.nii.gz

In your AFNI binaries directory, you can also see the files used to create those labels, which are called:


The numbers match the respective output names.

In tcsh you could do:

set aa = `which afni`
cat ${aa:h}/afni_fs_aparc+aseg_2009.txt

… for example.

I think the cerebellum values in the full atlas are:

# FS_NUM  STRING_LABEL                         TISS__TYPE  REN_VAL    COLOR_LUT
7         Left-Cerebellum-White-Matter         tiss__wmat        5    220 248 164 0
8         Left-Cerebellum-Cortex               tiss__gm          6    230 148 34  0
46        Right-Cerebellum-White-Matter        tiss__wmat       25    220 248 164 0
47        Right-Cerebellum-Cortex              tiss__gm         26    230 148 34  0

Only the GM ones will be in the REN_gmrois one, so you just need to excise ROI #6 and 26. You could do this with 3dcalc in different ways; one is to use the full dataset and subtract away the ROIs you don’t want, which seems useful here since it is a short list:

3dcalc \
    -a aparc.a2009s+aseg_REN_gmrois.nii.gz \
    -b aparc.a2009s+aseg_REN_gmrois.nii.gz"<Left-Cerebellum-Cortex,Right-Cerebellum-Cortex>" \
    -expr 'a-b' \
   -prefix aparc.a2009s+aseg_REN_gmrois_CORT.nii.gz

If you are only excising some integer values and not renumbering otherwise, you can reattach the original labeltable. To reattach a labeltable and integer-valued colormap (for looking at it in the AFNI GUI) afterward, you can:

3drefit -copytables aparc.a2009s+aseg_REN_gmrois.nii.gz aparc.a2009s+aseg_REN_gmrois_CORT.nii.gz
3drefit -cmap INT_CMAP aparc.a2009s+aseg_REN_gmrois_CORT.nii.gz

These are often convenient to do.


Thank you!
It helped a lot.

Is there any easy way to remove all subcortex regions from the mask along with the cerebellum? or I should remove them by their labels?

Hi, Maya-

Well, you could just keep listing each region you don’t want to have in that comma-separated list within the angle bracket. The benefit of that is you can clearly check and doublecheck your list.

Though, I think that the FreeSurfer ROI labelling might help this. If I am not mistaken, the numbering 1-255 within both of their default parcellations covers the non-cortex and is the same. The cortical numbers differ in their two parcellations (what are referred to as the “2000” and “2009” in the AFNI translation). In the afni_fs_aparc+aseg_2009.txt file, it looks like you want to keep all ROIs with value >48—is that right? (These are the FS ROIs the values >11100.)

If so, then you could do this:

# keep only ROIs with value >48
3dcalc \
    -a aparc.a2009s+aseg_REN_gmrois.nii.gz \
    -expr 'a*step(a-48)' \
    -prefix aparc.a2009s+aseg_REN_gmrois_CORT_ONLY.nii.gz 

3drefit -copytables aparc.a2009s+aseg_REN_gmrois.nii.gz \
3drefit -cmap INT_CMAP aparc.a2009s+aseg_REN_gmrois_CORT_ONLY.nii.gz

… and that should provide the cortex-only ROIs for that parcellation?


Yes, it’s working great.
Thank you!

Rockin’, thanks for letting us know.