Hi all!
I’ve figured out how to use 3dTcorr1D, but I would like to learn how to use 3dNetCorr so that I can run multiple ROIs at once for resting state functional connectivity analysis.
The steps I use for 3dTcorr1D are as follows:
#create 5mm radius ROI around peak fmri task activation
3dUndump -prefix task_5mmROI -master $subj_anat+tlrc. -srad 5 -orient RAI -xyz task_peak_xyz.txt
#resample ROI mask to match volumes of data set
3dresample -master $subj_rest_run1.nii.gz -prefix task_resamp -inset task_5mmROI+tlrc.
#use resampled mask to extract time series of ROI and redirect output to 1D file
3dmaskave -mask task_resamp+tlrc. $subj.rest_run1.nii.gz > maskave_taskROI.1D
#pearson correlation for input data set and 1d file of time series for ROI
3dTcorr1D -mask $subj.REF.mask.FBrain.MNI.nii.gz -prefix Tcorr_rest_run1_taskROI -ok_1D_text $subj.rest_run1.nii.gz maskave_taskROI.1D
This is the example I tried to take from 3dNetCorr -help :
3dNetCorr
-inset $subj.rest_run1.nii.gz
[b]-in_rois ??? NEED HELP??? [/b]
-fish_z
-ts_wb_corr
-mask $subj.REF.mask.FBrain.MNI.nii.gz
-prefix FMRI/REST_corr
how do I create the ROI time series file differently for 3dNetCorr? Do I still need to do 3dmaskave as a step? If so, how do I transform that output to .BRIK/.HEAD files?
Thank you!!
Howdy-
3dNetCorr works by taking a time series data set (“-inset TTT”) and a map of ROIs (“-in_rois RRR”). TTT and RRR must have the same grid. 3dNetCorr will calculate the average time series of each ROI in RRR, and store the correlation value (Pearson r or Fisher-transformed Z) in a correlation matrix.
The format of the ROI file RRR is as follows. A network is a set of ROIs in a single volume, and the number of ROIs in a network determines the size of the correlation matrix; a volume that has 10 ROIs (i.e., a network of 10 ROIs) will have a 10x10 correlation matrix in its output. Each ROI is defined as the set of voxels having the same integer value. So, if RRR contains information about a single network, it will have a single volume. If that network has 10 regions, then there will be, say, some voxels with values 1, some voxels with value 2, etc. up to 10. Essentially, each integer labels the ROI; note that the integer values do not have to be consecutive (1…N), but could be any positve integers.
If you want to look at multiple networks with a single call to 3dNetCorr, separate networks can be defined in separate volumes that are input. Thus, RRR could have multiple volumes, each one treated as a separate network and getting a separate correlation matrix output. In each volume, an ROI of the network is defined in the same way: just a set of voxels with the same integer value.
In your above example, if your created ROIs all have the same value and are not touching, then you could use 3dROIMaker to assign each a different integer value. Or, if your created ROIs all have different integer values after your 3dUndump command, then you should be good to go with 3dNetCorr.
–pt
Thanks for your feedback. I tried running 3dNetCorr with these parameters :
3dNetCorr
-inset pc09.p64_rest_run1_MEICA.spc.nii.gz
-in_rois test_resamp_addtROI_2func+tlrc. test_resamp_audcatROI_2func+tlrc.
-fish_z -ts_wb_corr -mask p64_rest_run1.REF.mask.FBrain.MNI.nii.gz
-prefix test_p64_netcorr
and I got this error:
++ Reading in.
++ Allocating…
++ User didn’t enter mask: will make my own, based on where I find nonzero time series.
++ Applying mask to ROIs.
++ Labelling regions internally.
++ No refset labeltable for naming things.
++ Getting volumes.
++ Calculating average time series.
++ Calculating correlation matrix.
++ Writing output: NETCORR …
*** glibc detected *** 3dNetCorr: munmap_chunk(): invalid pointer: 0x00000000008a4eb7 ***
======= Backtrace: =========
/lib64/libc.so.6[0x3770675dee]
3dNetCorr[0x477066]
3dNetCorr[0x40b79f]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x377061ed1d]
3dNetCorr[0x408459]
======= Memory map: ========
00400000-0092c000 r-xp 00000000 00:18 194457613 /usr/local/apps/afni/current/linux_openmp_64/3dNetCorr
00b2c000-00b76000 rw-p 0052c000 00:18 194457613 /usr/local/apps/afni/current/linux_openmp_64/3dNetCorr
00b76000-00bcf000 rw-p 00000000 00:00 0
01fe4000-27489000 rw-p 00000000 00:00 0 [heap]
3770200000-3770220000 r-xp 00000000 fd:01 393407 /lib64/ld-2.12.so
3770420000-3770421000 r–p 00020000 fd:01 393407 /lib64/ld-2.12.so
3770421000-3770422000 rw-p 00021000 fd:01 393407 /lib64/ld-2.12.so
3770422000-3770423000 rw-p 00000000 00:00 0
3770600000-377078a000 r-xp 00000000 fd:01 400596 /lib64/libc-2.12.so
377078a000-377098a000 —p 0018a000 fd:01 400596 /lib64/libc-2.12.so
377098a000-377098e000 r–p 0018a000 fd:01 400596 /lib64/libc-2.12.so
377098e000-3770990000 rw-p 0018e000 fd:01 400596 /lib64/libc-2.12.so
3770990000-3770994000 rw-p 00000000 00:00 0
3770a00000-3770a83000 r-xp 00000000 fd:01 410346 /lib64/libm-2.12.so
3770a83000-3770c82000 —p 00083000 fd:01 410346 /lib64/libm-2.12.so
3770c82000-3770c83000 r–p 00082000 fd:01 410346 /lib64/libm-2.12.so
3770c83000-3770c84000 rw-p 00083000 fd:01 410346 /lib64/libm-2.12.so
3770e00000-3770e02000 r-xp 00000000 fd:01 410258 /lib64/libdl-2.12.so
3770e02000-3771002000 —p 00002000 fd:01 410258 /lib64/libdl-2.12.so
3771002000-3771003000 r–p 00002000 fd:01 410258 /lib64/libdl-2.12.so
3771003000-3771004000 rw-p 00003000 fd:01 410258 /lib64/libdl-2.12.so
3771200000-3771208000 r-xp 00000000 fd:01 1360346 /usr/lib64/libXp.so.6.2.0
3771208000-3771407000 —p 00008000 fd:01 1360346 /usr/lib64/libXp.so.6.2.0
3771407000-3771408000 rw-p 00007000 fd:01 1360346 /usr/lib64/libXp.so.6.2.0
3771600000-3771615000 r-xp 00000000 fd:01 410327 /lib64/libz.so.1.2.3
3771615000-3771814000 —p 00015000 fd:01 410327 /lib64/libz.so.1.2.3
3771814000-3771815000 r–p 00014000 fd:01 410327 /lib64/libz.so.1.2.3
3771815000-3771816000 rw-p 00015000 fd:01 410327 /lib64/libz.so.1.2.3
3773200000-3773224000 r-xp 00000000 fd:01 1352579 /usr/lib64/libxcb.so.1.1.0
3773224000-3773424000 —p 00024000 fd:01 1352579 /usr/lib64/libxcb.so.1.1.0
3773424000-3773425000 rw-p 00024000 fd:01 1352579 /usr/lib64/libxcb.so.1.1.0
3773600000-3773737000 r-xp 00000000 fd:01 1323296 /usr/lib64/libX11.so.6.3.0
3773737000-3773937000 —p 00137000 fd:01 1323296 /usr/lib64/libX11.so.6.3.0
3773937000-377393d000 rw-p 00137000 fd:01 1323296 /usr/lib64/libX11.so.6.3.0
3773a00000-3773a02000 r-xp 00000000 fd:01 1313334 /usr/lib64/libXau.so.6.0.0
3773a02000-3773c02000 —p 00002000 fd:01 1313334 /usr/lib64/libXau.so.6.0.0
3773c02000-3773c03000 rw-p 00002000 fd:01 1313334 /usr/lib64/libXau.so.6.0.0
3774200000-3774298000 r-xp 00000000 fd:01 1360315 /usr/lib64/libfreetype.so.6.3.22
3774298000-3774497000 —p 00098000 fd:01 1360315 /usr/lib64/libfreetype.so.6.3.22
3774497000-377449d000 rw-p 00097000 fd:01 1360315 /usr/lib64/libfreetype.so.6.3.22
3774600000-3774626000 r-xp 00000000 fd:01 410416 /lib64/libexpat.so.1.5.2
3774626000-3774825000 —p 00026000 fd:01 410416 /lib64/libexpat.so.1.5.2
3774825000-3774828000 rw-p 00025000 fd:01 410416 /lib64/libexpat.so.1.5.2
3774a00000-3774a11000 r-xp 00000000 fd:01 1360289 /usr/lib64/libXext.so.6.4.0
3774a11000-3774c11000 —p 00011000 fd:01 1360289 /usr/lib64/libXext.so.6.4.0
3774c11000-3774c12000 rw-p 00011000 fd:01 1360289 /usr/lib64/libXext.so.6.4.0
3774e00000-3774e34000 r-xp 00000000 fd:01 1360316 /usr/lib64/libfontconfig.so.1.4.4
3774e34000-3775034000 —p 00034000 fd:01 1360316 /usr/lib64/libfontconfig.so.1.4.4
3775034000-3775036000 rw-p 00034000 fd:01 1360316 /usr/lib64/libfontconfig.so.1.4.4
3775200000-3775225000 r-xp 00000000 fd:01 1360317 /usr/lib64/libpng12.so.0.49.0
3775225000-3775425000 —p 00025000 fd:01 1360317 /usr/lib64/libpng12.so.0.49.0
3775425000-3775426000 rw-p 00025000 fd:01 1360317 /usr/lib64/libpng12.so.0.49.0
3775600000-3775609000 r-xp 00000000 fd:01 1360303 /usr/lib64/libXrender.so.1.3.0
3775609000-3775808000 —p 00009000 fd:01 1360303 /usr/lib64/libXrender.so.1.3.0
3775808000-3775809000 rw-p 00008000 fd:01 1360303 /usr/lib64/libXrender.so.1.3.0
3776200000-3776216000 r-xp 00000000 fd:01 410365 /lib64/libgcc_s-4.4.7-20120601.so.1
3776216000-3776415000 —p 00016000 fd:01 410365 /lib64/libgcc_s-4.4.7-20120601.so.1
3776415000-3776416000 rw-p 00015000 fd:01 410365 /lib64/libgcc_s-4.4.7-20120601.so.1
377d200000-377d211000 r-xp 00000000 fd:01 1347097 /usr/lib64/libXpm.so.4.11.0
377d211000-377d410000 —p 00011000 fd:01 1347097 /usr/lib64/libXpm.so.4.11.0
377d410000-377d411000 rw-p 00010000 fd:01 1347097 /usr/lib64/libXpm.so.4.11.0
377e200000-377e214000 r-xp 00000000 fd:01 1360347 /usr/lib64/libXft.so.2.3.2
377e214000-377e414000 —p 00014000 fd:01 1360347 /usr/lib64/libXft.so.2.3.2
Fatal Signal 6 (SIGABRT) received
Bottom of Debug Stack
** AFNI version = AFNI_18.0.00 Compile date = Jan 4 2018
** [[Precompiled binary linux_openmp_64: Jan 4 2018]]
** Program Death **
I have no clue what to make of this, help would be much appreciated 
Hmmm, that is full of doom & gloom.
What is the output of:
afni -ver
?
–pt
Precompiled binary linux_openmp_64: Jan 4 2018 (Version AFNI_18.0.00)
Hmm, that is weird, esp. because there is a line in the screen message:
++ User didn't enter mask: will make my own, based on where I find nonzero time series.
… even though from your command it does look like you put in a mask explicitly.
I’d like to look at this data if you don’t mind-- I will PM you instructions for uploading it, if that is fine.
–pt
Howdy-
OK, I see the issue, which I should have noticed from the command entered… The “-in_rois …” option takes only a single file name as argument (that is why the program isn’t finding the mask, either); that single file contains a map of all ROIs in the network. I believe at the moment that the two files entered after it contain separate ROIs; those need to be combined into a single file, for example using 3dcalc (if they don’t overlap):
3dcalc -a test_resamp_addtROI_2func+tlrc. -b test_resamp_audcatROI_2func+tlrc. -expr 'a+2*b' -prefix MY_NETWORK.nii.gz
… and then you could run 3dNetCorr like:
3dNetCorr \
-inset pc09.p64_rest_run1_MEICA.spc.nii.gz \
-in_rois MY_NETWORK.nii.gz \
-fish_z -ts_wb_corr -mask p64_rest_run1.REF.mask.FBrain.MNI.nii.gz \
-prefix test_p64_netcorr
–pt
That was extremely helpful, THANK YOU! I was able to make a ROI file with 14 ROIs and do 3dNetCorr on that… so awesome!