Renaming ROIs in ROI extraction


I am trying to extract two ROIs from activation clusters I get as a main effect and three ROIS from clusters I got from an interaction effect. I would then like to combine these two masks into a single combined masks (with the combined 5 ROIs).

So far, I’ve made the two separate masks (one from the main effect and one from the interaction) by using the “SaveMsk” option under “Rpt”. I’ve called these “DTS_Clust-mask+tlrc.BRIK” and SBDDTS_Clust-mask+tlrc.BRIK, respectively. I know can combine the two masks using:

3dcalc -a ‘DTS_Clust-mask+tlrc.BRIK’ -b ‘SBDDTS_Clust-mask+tlrc.BRIK’ -expr ‘step(a) +2*step(b)’ -prefix mask_combined

I would like to track which ROI comes from the main effect, and which ROI comes from the interaction by naming each ROI.

So, how do I rename these ROIs so I can identify which belongs to which?

Thank you


There is a bit of tutorial for working with ROIs (combining them into files, making surfaces for viewing, attaching labels, and more) here:

For your case specifically, it seems like you already have ROIs defined in a file-- each ROI is defined as being a set of voxels with a given integer (NB: each ROI need not be contiguous, as I would guess is the case for your example). In your case, I guess it isn’t guaranteed that your ROIs don’t overlap. I will guesstimate that your ‘a’ dset in 3dcalc is the main effect, and the ‘b’ dset is the interaction effect.

You can make a simple text file of two columns: first, number values (which will be the numerical value of each ROI, i.e., what value each voxel comprising that ROI has), and second the label that you want each ROI to have. I will make one here that also includes the possible overlap, and say you put this into a file called “list_rois.txt”:

1   main_eff
2   interact_eff
3   main_inter_olap

Then, you can make an AFNI-formatted labeltable and attach it to your ROI map file in one fell swoop:

@MakeLabelTable                  \
    -lab_file  list_rois.txt 1 0   \
    -labeltable           \
    -dset       mask_combined+tlrc

If you open your dset mask_combined+tlrc in AFNI now and click on one of those ROIs, you should see the appropriate label in the GUI. Note that the default colorbar when you overlay this file will likely even be an ROI-appropriate one (many ~random colors changing with each integer value).