average time series from multiple ROIs

Hi All,

I have a rsfMRI time series and I have one nii file that has 400 ROIs encompassing the different cortical regions. I want to extract the mean timeseries from each of the 400 ROIs. Is there one command that will get me the average time series for each of the 400 ROIs ?

Many thanks


Sure, 3dROIstats is what you’re looking for.

Thanks a lot Peter.

I ran the following

3dROIstats -mask Parcellations/MNI/Schaefer2018_200Parcels_7Networks_order_FSLMNI152_2mm.nii.gz rsfMRI.nii.gz > test.1D

Schaefer2018_200Parcels_7Networks_order_FSLMNI152_2mm.nii.gz has 200 ROIs

rsfMRI.nii.gz has 187 volumes.

I have attached a snapshot of the 1D file.

When I try to plot the 1D file using 1Dplot, I get the following error

1dplot test.1D
++ 1dplot: AFNI version=AFNI_21.1.19 (Jun 25 2021) [64-bit]
++ Authored by: RWC et al.

** Error: Failed parsing data row 0 of 1D file ‘test.1D’
Check for illegal non-numeric characters in:
‘File Sub-brick Mean_1 Mean_2 Mean_3 Mean_4 Mean_5 …’
You can have text entries set to 0 with -ok_1D_text or by
setting environment variable AFNI_1D_ZERO_TEXT to YES.
** FATAL ERROR: Can’t read input file ‘test.1D’ iarg=1

Can you suggest what am I doing wrong ?

Many thanks



1dplot -ok_1D_text test.1D{1..$}

That will turn the labels into 0’s and then ignore that first row (of now zeros) in the file.