3dNetCorr: Whole brain connectivity

HI, AFNI experts,

I am thinking to use 3dNetCorr to do the whole brain network analysis (something like graph theoretical analysis) - is this possible? I do not understand the example of this command very well.

@ROI_Corr_Mat -ts s620_rest_r1+orig
-roi SUMA/aparc.a2005s+aseg.nii
-prefix s620_matrix_all_ROIs

My understanding is that this function can be used for either rest stated based data or task based data. For the <-ts>, the input is the EPI data, while for the input for <-roi>, I am not clear whether we can and must provide multiple ROIs. If it is only with one ROI, it does not make sense to see the ROIs correlation. If we can do with multiple ROIs, then it is equal to say that we can do the functional connectivity with multiple ROIs, using this method. Am I correct? Any good pointers for me?

My further question is whether we can use this command to extract the BOLD signal for each ROI? Perhaps we have to go back to use 3dROIstates to get it.

Thank you very much,

Hi, Juan-

I can’t really advise on @ROI_Corr_Mat.

3dNetCorr can calculate both correlation matrices (all pairwise combinations of correlation coefficients of average time series in a map of ROIs), as well as whole brain (WB) connectivity maps for each ROI’s average time series. The correlation matrices are calculated by default, and the WB maps are also generated with a switch. You can calculate WB maps even if you enter just a single ROI (the 1x1 correlation matrix wouldn’t be so interesting), but if you have a bunch of ROIs, you can also just get all results at once.

Looking at the help of 3dNetCorr, there is an example for doing what you would want (probably):

      3dNetCorr                                  \
         -inset REST_in_DWI.nii.gz               \
         -in_rois ROI_ICMAP_GM+orig              \
         -fish_z                                 \
         -ts_wb_corr                             \
         -mask mask_DWI+orig                     \
         -prefix FMRI/REST_corr

line by line, this describes:
entering a subject’s 4D (time series) data set;
entering a map of ROIs (all voxels with value ‘1’ are in that ROI, all voxels with value ‘2’ in another one, etc.);
asking the program to Fisher Z-transform the correlation matrix;
asking the program to output whole brain correlation maps of each ROI’s average time series as a Pearson ‘r’ value (‘-ts_wb_Z’ would get you Fisher Z-transformed version of that, if you preferred);
and then you can enter a whole brain map (probably useful if doing a whole brain corr map);
… and last but not least, the output prefix for file names.

You can also output each ROI’s average time series into a simple text file, if you wished; if your ROIs are labelled going in, then the output correlation matrices will store those labels, as well.


Thank you very very much, PT.

All your suggestion is very instructional and professional - I appreciate your help very much!!!


We aim to please.


Hi, Pt,

One more question:

On your example script, 1) the input for “-inset” (in your example, it is "REST_in_DWI.nii.gz "). As I said before, I assume that this script can be for both rest-state fMRI and task based fMRI. With regard to the input file, I do not exactly know your meaning of the 4D data. I think it should be the output from the standardized preprocessing (i.e., the input is the same to those for the 3dDeconvolve step). We do this for each subject. Am I correct? Or it should be the output from the 3dDeconvolve step?

Since we do it one subject by one subject, we then have to extract the mean data from the whole group subjects - We can get the mean from all of the subjects. Is this method correct?

  1. the input for the “-in_rois” (in your example, it is “ROI_ICMAP_GM+orig”). I assume that we can just put several ROIs together and get this file. For instance, I can get it via this way.
    3dcalc -a ‘TT_Daemon::amygdala’ -b ‘TT_Daemon::Hippocampus’ … -expr ‘step(a)+2step(b)+3step(c)+…’ -prefix ROI_ICMAP

  2. the input for the mask, I can get it from the mean of all subjects… Or we can just use NN27 or something else?
    For instance, I can get it from this way.
    3dmask_tool -input Sub*/*BrainMask+tlrc.HEAD
    -prefix mask_overlap.7
    -frac 0.7

Could you correct me if I am wrong?
Thank you very much,

Hi, Juan-

Interesting that “one more question” comes enumerated as 1, 2, 3…

OK, to it then:

  1. the “-inset” can be any time series data: task, resting, or anything else.

1b) “4D” data = four dimensional data, essentially, any time series data set. Three dimensions are spatial (x, y, z), and since each whole brain volume was acquired many times (t = 0, 1TR, 2TR, 3*TR, …), there is another dimension along the time axis, t.

1c) Yes, make sense to do per subject.

1d) As to what time series you use, I guess it depends-- it should probably be your “final” time series; if you are using 3dDeconvolve to regress out motion, low-order polynomials (i.e., low frequency “base line”), and any other regressors of non-interest, then you might want to use the output from 3dDeconvolve. Using standard afni_proc.py nomenclature (hopefully you are making your life easier by building your processing with Rick’s wonderful program!), for resting data this would probably be the errts* file, and for task-based data, the fitts* file.

1e) Sure, you could calculate the mean of different quantities. You could also go the multivariate modeling route, using Gang’s 3dMVM function. See, for example:

  1. Yep. A single ROI is just a set of voxels having the same integer value (they need not be contiguous), and you can certainly construct an “ROI map” in the manner described.

  2. I believe you are asking what to use for the outer/whole brain limits across your group? You could probably use either method you suggest: TT_N27 mask limits if you’ve warped everyone there, or the 3dmask_tool 70% overlap of individual masks. Marginally, the latter seems a bit preferable to me, deriving the boundaries from your subjects themselves and their actual data (postalignment).


Thank you very much, PT!!! Now all are really clear to me.