3dTcorrMap output filtering

Hello AFNI experts,

I am using 3dTcorrMap in my analysis to compute the voxel-wise connectivity maps using the following command:

3dTcorrMap -input all_runs.MCSA1_notlrc.rest+orig.BRIK -mask mask_GM_resam+orig.BRIK -Mean Global_1019 -Pmean Global_Pos -Cexpr ‘step(r-0.27)*r’ TCa027 -CorrMap ind_map -Hist 1000 histo1000

Question 1. How can I set the maximum number of CPU cores for it? My system has 50 cores but it uses only 15.

The final output file “ind_map” is of size 1.3TB (777546 sub-bricks) with almost 95% of the zero sub-bricks due to masked input data.
I am using the following script to extract the 37860 non-zero volumes by using their index.

3dcopy mask_GM_resam+orig.BRIK new_ind+orig
echo Start
while read p; do
echo $p
#3dTcat ind_map+orig.BRIK[$p] -glueto new_ind+orig # this doesn’t work because of the memory constraint (eventhough we have 256GB RAM on the system)
3dcalc -a ind_map+orig.BRIK[$p] -expr ‘a’ -prefix selected
3dTcat selected+orig.BRIK -glueto new_ind+orig
rm selected+*
done < $filename

This script takes almost 12 mins to extract one non-zero volume from the ind_map+orig.BRIK and copy it to new_ind+orig.BRIK.
This will finally take (37860*12)/60/24 = 315.5 days to finish the job for one subject.

Question 2. Do you know any method to speed up this copy and concatenation process and is it possible to use the HDF5 file format to save the output of the 3dTcorrMap?

Waiting for your reply.
Thank you

Hi, Naveed-

To address your question #1: this program uses OpenMP to parallelize. You can set the number of threads (constrained by number of threads on your computer) with an environment variable.

For example, if using bash, you can put this into your ~/.bashrc file:


and analogously for tcsh.

I don’t know about #2. I’m just guessing that “no” is the answer about HDF5, but someone else can weigh in on that.


Thank you Paul.
I have another question.
Should I use errts.MCSA1_notlrc.rest.tproject+orig.BRIK or errts.MCSA1_notlrc.rest.anaticor+orig.BRIK for correlation analysis?

Hi Naveed,

Use the anaticor version. Note that it is created later in the
processing stream.

  • rick

Thank you Rick