GSR in AFNI proc - how to apply GSR based on a ROI?

Dear all,

I am interested in comparing ROI-based results with vs. without the application of global signal regression (GSR).
In other words, I am more interested in the signal component of the global signal, and not so much in the noise.

AFNI proc allows to run GSR via the option

-regress_roi brain

I assume that this option computes the global signal by taking all voxels of the brain. Is there a way to apply GSR based on a specific ROI?
Phrased differently, instead of computing the global signal (an average time-series) based on all voxels’ time-series, is there an option to regress the global signal based on a specific ROI, such as only based on the thin cerebral cortex sheet without subcortical regions? I have such a ROI of course, but I don’t know how one could apply GSR in AFNI proc not based on all brain voxels, but only based on the global signal from a specific ROI.


Hi Philipp,

ROI (average or multiple PC) regression can be done via -regress_ROI or -regress_ROI_PC, where masks are passed via either -anat_follower_ROI or -mask_import (or via the internal 3dSeg generation).

Example 11 shows use of -anat_follower_ROI (with FreeSurfer ROIs), which can then be applied with either -regress_ROI or -regress_ROI_PC. In this case, the ROIs start of in “original anat” space, and are warped to the final space on the EPI grid.

Example 11b shows use of -mask_import, which can be similarly applied. This ROI must already be in the final space on the EPI grid. It will not be warped at all. A “brain” mask could even start as a standard space mask this way.

You can even give multiple ROIs to apply this way, and even mixing -regress_ROI and -regress_ROI_PC across them. Note that the default use of “brain” means the EPI brain mask, not the anatomical one, if that matters.

Getting to your case, assuming the cortex sheet is like a FreeSurfer mask, pass it with -anat_follower_ROI and apply it with -regress_ROI, e.g.

-anat_follower_ROI   cortex  epi  FS_cortex.nii.gz \
-regress_ROI            cortex

Does that seem reasonable?

  • rick

Hi and thank you.

Example 11b applies for my case, because I do not use freesurfer data, but a ROI that I created in AFNI (a NIFTI file). This ROI file is based on the anatomical MNI152 template (but only using the cerebral cortex, not the whole brain) and hence the same for every subject.

Based on my understanding, the code should then look as follows, correct?

-mask_import cc cerebral_cortex.nii \
-regress_ROI cc \

In this case, AFNI proc would take the “cerebral_cortex.nii” ROI file and apply GSR based only on the voxels within that ROI (instead of using all brain voxels to compute the global signal), is that correct?

Yes, that is right. Just recall that the mask needs to be on the final (EPI) grid.

  • rick

Thank you.


one more question came up. When exactly does AFNI proc compute the global signal? If I have the following blocks in AFNI proc including the anaticor fast method

-blocks despike tshift blur mask scale regress \

is the global signal computed after despiking, tshift, blurring, anaticor etc. or does AFNI compute the global signal based on the raw functional run (or somewhere in between the single processing steps)?

Offhand, I don’t really use global signal so I am not sure and don’t have an example handy, but it is useful to note that creates a script (default name: proc*) so that these things can be investigated by the user in detail. The script is even commented.

If you add your specific AP command here we could look at it to see, as well.


Indeed, just track the follow_ROI dataset(s), and note EPI inputs. But ROI averages should come from just the volreg output (i.e. on the final grid). They do not get subjected to blurring, in particular.

  • rick

Thanks Paul and Rick!