Dynamic Resting State Functional Connectivity

Hello AFNI Experts,

I am planning on doing a dynamic resting state functional connectivity analysis. I have a number of questions related to this, bear with me!

1.) The papers that I have read regress CSF and WM as well as bandpass, so I plan on doing example # 11 with afni proc py adding back in the bandpass. Some papers have used used the CONN tool box, which does the bandpass as a second step after regressing out CSF, WM, motion, outliers, etc. Is there an advantage to doing bandpass as a second step or am I okay with keeping it in the first-level regression model?
2.) Is there a way/possible pipeline you might propose for conducting the sliding-window dynamic resting state connectivity analysis using AFNI tools? For example, lets say I wanted to segment the timecourse into 36 s windows, sliding the onset of each window by 18 secs (not sure how to go about this step in AFNI), then make whole brain correlation maps for each time course (which I know there are a number of tools I could use, 3dfim+, 3dTcorr, etc.), Fischers Z transform (easy enough to do with AFNI), then estimate dynamic connectivity by taking the standard deviation in beta values at each voxel (unsure, perhaps a 3dcalc function?)
3.) I am combining two data sets with resting state data. One data set has a 6 minute scan and the other has a 5 minute scan. In the group analysis, I will be conducting a regression analysis, examining whether resting state connectivity is predictive of psychiatric symptoms. Will I run into issues with the data sets having a different length? Is it necessary to truncate the longer scan to make them equal length?

Thanks and sorry for the long message!


Hello Emily,

  1. It is recommendable that all regressions are carried out in one step, i.e. including the CSF and WM and bandpass regressors together. In such a way, the fitting can properly deal with possible correlations between the regressors. This is properly handled by several AFNI programs, for instance, 3dTproject. Otherwise, you will have to orthogonalize the regressors of the second step with respect to the regressors of the first step. See https://www.ncbi.nlm.nih.gov/pubmed/23747457

  2. I think there is not AFNI program that does sliding window correlation. Therefore, I’d suggest to create a script with a FOR loop that splits the data in time segments, then do all the relevant calculations with 3dfim+, 3dcalc, etc, and save the results with 3dbucket.

  3. In the regression analysis, you can add a covariate proportional to the length of the data. If you perform sliding window correlations, then the number of windows is more relevant than the length. In any case, any estimate will be more noisy in the shorter datasets as there are less number of observations.

Hope this helps,

The InstaCorr plugin interface to afni does sliding window
correlations. In the Help window in the “setup” interface
for that, see “CONTROLS” → Start,End → “NEW FEATURE”
for light details. I do not know of a batch way to do that, not

  • rick

Hello AFNI experts,

I am getting back into dyanamic resting state connectivity and have a few more questions.

1.) In 3dmaskave, where I extract the time course for my seed, can I specify what subbricks I want to extract from? For example, say I wanted to extract the amygdala time course for the first 36 seconds of resting state. I have data with a TR of 2. Could I extract the amygdala time course from subricks 0-17?
2.) Same question with respect to 3dfim+. Let’s say I want to correlate my truncated amygdala time course with the first 36 seconds of the rest of the brain. Can I specify which subricks of the data I want to correlate? I am basically trying to see how I can segment the data with AFNI tools.
3.) If neither of these things can happen, how can I simply segment the data into different time bins?
4.) Is there a way (perhaps with 3dcalc) to calculate the standard deviation of the resulting fischer-z tranformed correlational maps for each of the time bins?

If any sort of segmentation is not possible with AFNI commands and I need to use Instacorr. I would put 0, 18 in the start end for the first 36 secs? Is there a way where I can feed in my seed time course that I already extracted with 3dmaskave?

Thanks and sorry for all the questions!!


Hi Emily,

  1. AFNI programs can use sub-brick selection on input datasets,
    so running 3dmaskave on EPI+tlrc’[0…17]’ will take just those
    first 18 time points as input.

  2. Yes, 3dfim+ should work the same way (though we do not
    really encourage use of that program anymore).

  3. N/A

  4. Given a dataset that is a time series of Fischer-z
    correlations, consider using “3dTstat -stdev” to get
    the standard deviation of the correlation maps.

Does this cover what you need?

  • rick