3dttest++: Clustsim and ETAC questions

Hi! Sorry for a multi-question post but since they are related I felt bad posting several separate posts.

I have tried the different approaches to apply multiple comparisons error corrections and ran into some questions:

  1. Approach1: 3dFWHMx + 3dClustSim. Detrend?
    To use 3dFWHMx -acf -mask GM+tlrc. with our without -detrend does, according to the documentation depend on if your data has been de-trended during pre-proc or not. So a data-set that has been detrended (I think via 3ddespike) does not have to be de-trended, and if you do it anyway it should not make a big difference.

When I run (on detrended data, as far as I know)
a) 3dFWHMx -ACF NULL -mask GM+tlrc -input errts.sjb*.fanaticor+tlrc and
b) 3dFWHMx -detrend -ACF NULL -mask GM+tlrc -input errts.sjb*.fanaticor+tlrc and
The acf-parameters become:
a) 0.5581857308 3.1542607692 10.8851776923 (no detrend)
b) 0.7097887692 3.1102161538 11.3432861538 (detrend)

Why would the difference of acf parameters be so big? b) has a much higher first value, while the second two values are bit lower. The average of the 3 values is higher for the detrended data). This affect the 3dClustSim output (see below)

  1. 3dClustSim: different ACF params
    If I use the two different ACF-sets above I obviously get different tables. What we see is more conservative table values (you need bigger clusters for a given p-value) for the acf with the average lower values. Is this reasonable? Aren’t high acf values representing higher spatial smoothness / autocorrelations giving a higher risk for false positives and would then give a more conservative table? Or do I think about it wrong? The 4th ACF value (not showed) is a bit lower for the -detrended data.

Output (bi-sided, NN=1, but same trend for all settings):
No Detrend

3dClustSim -acf 0.5581857308 3.1542607692 10.8851776923 -mask DMN_network_anat_bool_fit+tlrc

# CLUSTER SIZE THRESHOLD(pthr,alpha) in Voxels
# -NN 1  | alpha = Prob(Cluster >= given size)
#  pthr  | .10000 .05000 .02000 .01000
# ------ | ------ ------ ------ ------
 0.050000   101.4  121.6  154.5  183.0
 0.020000    45.4   55.4   69.4   81.1
 0.010000    28.0   33.8   42.4   49.4
 0.005000    18.3   22.1   27.6   32.4
 0.002000    11.1   13.6   17.2   19.6
 0.001000     8.0    9.7   12.2   14.4
 0.000500     5.8    7.2    9.1   10.6
 0.000200     3.9    4.9    6.3    7.5
 0.000100     3.0    3.8    4.9    5.7


3dClustSim -acf 0.7097887692 3.1102161538 11.3432861538 -mask DMN_network_anat_bool_fit+tlrc.

# CLUSTER SIZE THRESHOLD(pthr,alpha) in Voxels
# -NN 1  | alpha = Prob(Cluster >= given size)
#  pthr  | .10000 .05000 .02000 .01000
# ------ | ------ ------ ------ ------
 0.050000    72.1   87.4  105.4  125.2
 0.020000    33.8   39.9   48.7   56.5
 0.010000    21.4   25.3   30.7   34.9
 0.005000    14.4   16.9   20.6   23.6
 0.002000     9.2   11.0   13.2   15.3
 0.001000     6.8    8.1    9.8   11.1
 0.000500     5.1    6.1    7.8    9.0
 0.000200     3.7    4.5    5.5    6.4
 0.000100     2.8    3.5    4.4    5.1

Should not the higher acf-values give a more conservative threshold since the smoothness is higher? It’s just the first value that is higher for detrend, but that is where the biggest difference is.

  1. What thresholds to use:
    I’m I right that even though the 3dClustsim gives a cluster size for e.g. p > 0.05 you should not use that. You should only use the p-values < 0.002 (ideally 0.001) with this approach?

  2. I also want to use ETAC but I don’t get the expected output.
    my command

3dttest++ -paired -prefix AvP_opt_anaticor -mask $mask_anat -ETAC -ETAC_blur 4 6 -ETAC_opt NN=1:hpow=0:sid=1:pthr=0.01,0.05,0.002,0.01:name=robin \

a) what is the meaning of hpow? Did not understand the manual.

b) According to the manual I should get

P+tlrc.HEAD                         normal 3dttest++ output from input datasets
P.B4.0.nii                          3dttest++ output from blurred datasets
P.B7.0.nii                            (4 and 7 mm, respectively)
Px.B4.0.5percent.txt                voxel-wise threshold list for a variety
Px.B7.0.5percent.txt                  of global FPRs, for blurs 4 and 7
Px.N.ETAC.mthresh.B4.0.5perc.nii    Multi-threshold datasets for blur=4 and =7,
Px.N.ETAC.mthresh.B7.0.5perc.nii      for overall 5% global false positive rate
Px.N.ETACmask.2sid.5perc.nii.gz     Binary (0 or 1) mask of 'active voxels'
PX.N.ETACmaskALL.2sid.5perc.nii.gz  Multi-volume mask showing which ETAC

But I don’t get the Px files, I get a lot of TT, files (70 files of this kind TT.c7xJqG0BM99.0000.minmax.1D) and these:


Is that expected?

c) If I want to see if get any clusters surviving the 5% FDR limit, which file should I check? I get the files 1neg 1pos… Should I cluster or is that included in the masks?

Thanks a bunch! feel free to just anser any of the sub-questions.

  1. I would not use -detrend on the errts file - this option was intended only for use on original data for a quick look at the noise smoothness, and not for use on already processed data. However, I don’t know why -detrend sometime affects the results markedly and sometimes does not.

It does not make any sense to average the 3 ACF parameters, which each represent something completely different from the others. The spatial autocorrelation function (ACF) of the FMRI noise is modeled with these 3 parameters (a,b,c) using the formula

  ACF(r) = a * exp(-r*r/(2*b*b)) + (1-a) * exp(-r/c)

where 0 < a < 1 is the weight given to the Gaussian part with st.dev. of ‘b’, and (1-a) is the weight given to the longer tailed single exponential part with decay distance ‘c’. To see the computed FWHM of the ACF given these parameters, commands like

  ccalc 'ACFWXM(0.558,3.154,10.885,0.5)'
  ccalc 'ACFWXM(0.7097,3.1102,11.343,0.5)'

can be used, giving 8.898mm and 8.198mm (in that order). We see that the first one is slightly wider, but also has more non-Gaussian longer tail than the second one.

  1. The combination of slightly wider FWHM and the longer tail in the first case (non-detrended) is what makes the cluster size thresholds somewhat higher. Note that these cluster size thresholds differ more markedly at the larger p-value thresholds, which is due to the longer single exponential tail. At the smaller p thresholds (say p=0.002), the cluster thresholds aren’t that different (14 and 11 voxels).

  2. Generally, in a group study, we recommend taking the (a,b,c) values from each subject and averaging them to get a group set of (a,b,c) values, and THEN using those in 3dClustSim. This method is ad hoc, but works OK. I would not apply ‘-detrend’ to errts.* datasets.

  3. Do you have an updated copy of AFNI binaries? I made changes to ETAC in September/October and would now recommend the use of the default “global ETAC” method, rather than the previous “local ETAC” method. If your “afni -ver” indicates a date earlier than (say) 15 Oct 2018, please update your AFNI binaries and try running 3dttest++ -ETAC again. However, it looks like you have the global ETAC output file TT.c7xJqG0BM99.robin.ETACmask.global.1pos.5perc.nii.gz which is a binary mask of all voxels that passed the ETAC multi-testing method (1pos means a 1-sided t-test, on the positive side; 5perc means at the 5% global statistical significance level). The multi-level cluster-thresholds used are in the globalETAC.mthresh.*.niml files (XML formatted, but readable text).

4a) You can think of cluster-size as

   sum              z(v)^0
   {v in cluster}

where z(v) = z-statistic (converted from t-statistic) and z(v)^0 is z(v) raised to the 0 power – that is, 1. Now replace the exponent ‘0’ with ‘hpow’. This is a generalization of cluster-size that gives more weight to more statistically significant voxels. Since the voxel p-value threshold is also a threshold on the voxel z-value, there is a floor value to z(v) in a cluster - so all voxels will count in this sum, but with hpow > 0, some voxels are more equal than others.

Hello Bob and thanks for such a detailed reply!

1+2) On that you would not recommend 3dFWHMx -detrende for already processed data:
That is interesting since afni-proc seems to preform smoothness estimates with the -detrend option per default.
My afni version is brand new:

afni -ver
Precompiled binary linux_ubuntu_16_64: Dec  4 2018 (Version AFNI_18.3.13 'Augustus')

In my afni-proc I have:

-regress_est_blur_errts \
    -mask_epi_anat yes \

That generates this .proc code:

3dFWHMx -detrend -mask mask_epi_anat.$subj+tlrc                           \
            -ACF files_ACF/out.3dFWHMx.ACF.errts.r$run.1D                     \
            errts.${subj}+tlrc"[$trs]" >> blur.errts.1D

Which apparently uses -detrend on the errts data which you did not recommend! It’s because I just recently found out that afni-proc could give me the smoothness automatically I had to think of -detrend vs no -detrend. Any comments on that?
Also, sorry for being unclear. With average acf parameters I meant average across subjects for each a b c parameter! But OK, that means that it’s not that strange that the cluster-size tables differ, since the a,b,c params differ for detend and no detrend (which I guess they “should” even though the data is already detrended at the errts stage?). And the results for -detrend vs -no-detrend does not differ THAT much. Still annoying ;). We will just stop using -detrend then.

3). Since my afni version is new (Precompiled binary linux_ubuntu_16_64: Dec 4 2018 (Version AFNI_18.3.13 ‘Augustus’) I don’t know why I don’t get the Px files. But the ones I have, are they the correct files but with the wrong name? Or am I missing some files?

This is the 3dttest command (currently used on the coef from seed based resting state analysis):

3dttest++ -paired -prefix AvP_opt_anaticor -mask $mask_anat -ETAC -ETAC_blur 4 6 -ETAC_opt NN=1:hpow=0:sid=1:pthr=0.01,0.05,0.002,0.01:name=robin \
-setA ALC \
1	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA01_ALC+tlrc'[2]' \
3	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA03_ALC+tlrc'[2]' \
4	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA04_ALC+tlrc'[2]' \
6	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA06_ALC+tlrc'[2]' \
8	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA08_ALC+tlrc'[2]' \
9	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA09_ALC+tlrc'[2]' \
10	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA10_ALC+tlrc'[2]' \
11	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA11_ALC+tlrc'[2]' \
12	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA12_ALC+tlrc'[2]' \
14	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA14_ALC+tlrc'[2]' \
15	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA15_ALC+tlrc'[2]' \
18	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA18_ALC+tlrc'[2]' \
19	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA19_ALC+tlrc'[2]' \
20	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA20_ALC+tlrc'[2]' \
21	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA21_ALC+tlrc'[2]' \
23	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA23_ALC+tlrc'[2]' \
25	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA25_ALC+tlrc'[2]' \
27	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA27_ALC+tlrc'[2]' \
28	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA28_ALC+tlrc'[2]' \
29	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA29_ALC+tlrc'[2]' \
30	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA30_ALC+tlrc'[2]' \
31	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA31_ALC+tlrc'[2]' \
32	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA32_ALC+tlrc'[2]' \
33	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA33_ALC+tlrc'[2]' \
34	/home/robka/faah/rest/analysis/group/alc/DMN_RR_D/RRmap_FA34_ALC+tlrc'[2]' \
-setB PBO \
1	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA01_PBO+tlrc'[2]' \
3	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA03_PBO+tlrc'[2]' \
4	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA04_PBO+tlrc'[2]' \
6	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA06_PBO+tlrc'[2]' \
8	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA08_PBO+tlrc'[2]' \
9	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA09_PBO+tlrc'[2]' \
10	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA10_PBO+tlrc'[2]' \
11	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA11_PBO+tlrc'[2]' \
12	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA12_PBO+tlrc'[2]' \
14	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA14_PBO+tlrc'[2]' \
15	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA15_PBO+tlrc'[2]' \
18	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA18_PBO+tlrc'[2]' \
19	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA19_PBO+tlrc'[2]' \
20	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA20_PBO+tlrc'[2]' \
21	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA21_PBO+tlrc'[2]' \
23	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA23_PBO+tlrc'[2]' \
25	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA25_PBO+tlrc'[2]' \
27	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA27_PBO+tlrc'[2]' \
28	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA28_PBO+tlrc'[2]' \
29	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA29_PBO+tlrc'[2]' \
30	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA30_PBO+tlrc'[2]' \
31	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA31_PBO+tlrc'[2]' \
32	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA32_PBO+tlrc'[2]' \
33	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA33_PBO+tlrc'[2]' \
34	/home/robka/faah/rest/analysis/group/pbo/DMN_RR_D/RRmap_FA34_PBO+tlrc'[2]' \

These are the output files:

3dttest.sh                     TT.gsJ2pkIRgFF.0009.minmax.1D  TT.gsJ2pkIRgFF.0024.minmax.1D  TT.gsJ2pkIRgFF.0039.minmax.1D  TT.gsJ2pkIRgFF.0054.minmax.1D  TT.gsJ2pkIRgFF.0069.minmax.1D
AvP_opt_anaticor.B4.0.nii      TT.gsJ2pkIRgFF.0010.minmax.1D  TT.gsJ2pkIRgFF.0025.minmax.1D  TT.gsJ2pkIRgFF.0040.minmax.1D  TT.gsJ2pkIRgFF.0055.minmax.1D  TT.gsJ2pkIRgFF.0070.minmax.1D
AvP_opt_anaticor.B6.0.nii      TT.gsJ2pkIRgFF.0011.minmax.1D  TT.gsJ2pkIRgFF.0026.minmax.1D  TT.gsJ2pkIRgFF.0041.minmax.1D  TT.gsJ2pkIRgFF.0056.minmax.1D  TT.gsJ2pkIRgFF.0071.minmax.1D
AvP_opt_anaticor+tlrc.BRIK     TT.gsJ2pkIRgFF.0012.minmax.1D  TT.gsJ2pkIRgFF.0027.minmax.1D  TT.gsJ2pkIRgFF.0042.minmax.1D  TT.gsJ2pkIRgFF.0057.minmax.1D  TT.gsJ2pkIRgFF.0072.minmax.1D
AvP_opt_anaticor+tlrc.HEAD     TT.gsJ2pkIRgFF.0013.minmax.1D  TT.gsJ2pkIRgFF.0028.minmax.1D  TT.gsJ2pkIRgFF.0043.minmax.1D  TT.gsJ2pkIRgFF.0058.minmax.1D  TT.gsJ2pkIRgFF.0073.minmax.1D
MNI152_2009_template.nii.gz    TT.gsJ2pkIRgFF.0014.minmax.1D  TT.gsJ2pkIRgFF.0029.minmax.1D  TT.gsJ2pkIRgFF.0044.minmax.1D  TT.gsJ2pkIRgFF.0059.minmax.1D  TT.gsJ2pkIRgFF.0074.minmax.1D
TT.gsJ2pkIRgFF.0000.minmax.1D  TT.gsJ2pkIRgFF.0015.minmax.1D  TT.gsJ2pkIRgFF.0030.minmax.1D  TT.gsJ2pkIRgFF.0045.minmax.1D  TT.gsJ2pkIRgFF.0060.minmax.1D  TT.gsJ2pkIRgFF.0075.minmax.1D
TT.gsJ2pkIRgFF.0001.minmax.1D  TT.gsJ2pkIRgFF.0016.minmax.1D  TT.gsJ2pkIRgFF.0031.minmax.1D  TT.gsJ2pkIRgFF.0046.minmax.1D  TT.gsJ2pkIRgFF.0061.minmax.1D  TT.gsJ2pkIRgFF.0076.minmax.1D
TT.gsJ2pkIRgFF.0002.minmax.1D  TT.gsJ2pkIRgFF.0017.minmax.1D  TT.gsJ2pkIRgFF.0032.minmax.1D  TT.gsJ2pkIRgFF.0047.minmax.1D  TT.gsJ2pkIRgFF.0062.minmax.1D  TT.gsJ2pkIRgFF.0077.minmax.1D
TT.gsJ2pkIRgFF.0003.minmax.1D  TT.gsJ2pkIRgFF.0018.minmax.1D  TT.gsJ2pkIRgFF.0033.minmax.1D  TT.gsJ2pkIRgFF.0048.minmax.1D  TT.gsJ2pkIRgFF.0063.minmax.1D  TT.gsJ2pkIRgFF.0078.minmax.1D
TT.gsJ2pkIRgFF.0004.minmax.1D  TT.gsJ2pkIRgFF.0019.minmax.1D  TT.gsJ2pkIRgFF.0034.minmax.1D  TT.gsJ2pkIRgFF.0049.minmax.1D  TT.gsJ2pkIRgFF.0064.minmax.1D  TT.gsJ2pkIRgFF.0079.minmax.1D
TT.gsJ2pkIRgFF.0005.minmax.1D  TT.gsJ2pkIRgFF.0020.minmax.1D  TT.gsJ2pkIRgFF.0035.minmax.1D  TT.gsJ2pkIRgFF.0050.minmax.1D  TT.gsJ2pkIRgFF.0065.minmax.1D
TT.gsJ2pkIRgFF.0006.minmax.1D  TT.gsJ2pkIRgFF.0021.minmax.1D  TT.gsJ2pkIRgFF.0036.minmax.1D  TT.gsJ2pkIRgFF.0051.minmax.1D  TT.gsJ2pkIRgFF.0066.minmax.1D
TT.gsJ2pkIRgFF.0007.minmax.1D  TT.gsJ2pkIRgFF.0022.minmax.1D  TT.gsJ2pkIRgFF.0037.minmax.1D  TT.gsJ2pkIRgFF.0052.minmax.1D  TT.gsJ2pkIRgFF.0067.minmax.1D
TT.gsJ2pkIRgFF.0008.minmax.1D  TT.gsJ2pkIRgFF.0023.minmax.1D  TT.gsJ2pkIRgFF.0038.minmax.1D  TT.gsJ2pkIRgFF.0053.minmax.1D  TT.gsJ2pkIRgFF.0068.minmax.1D

Thanks a lot Bob!

bump :slight_smile:

Hi Robin,

This has been unresolved within our group since the ACF method was introduced. The reasons for afni_proc.py using -detrend are that with the old FWHM method, it seemed to produce slightly more robust and expected results (at least in my testing), and because it should not have been detrimental. So there is a question about whether that translates to ACF. We have been thinking of taking that out as a default for a while now, but it clearly has not happened.

In any case, it seems reasonable to go either direction at this point, and lean towards not doing it, since we will probably shift that way as a default.

To turn it off in afni_proc.py (as of 6 days ago), add ‘-regress_est_blur_detrend no’.


  • rick

Thanks Rick!

I probably can’t use the pre-proc acf parameters anyway since we, in the end, want to use a group mask based on the mask_epi_anat mask from all subjects only including voxels that all share (i.e. the union mask) via

3dmask_tool -input mask_epi_anat.*+tlrc.HEAD -prefix mask_epi_anat -frac 1

Then we preform a separate script for 3dFWHMx. If we use the acf from the pre-proc then all the subject smoothness estimate will not be from the same mask as used in the final analysis.

Or is this unnecessarily picky? Perhaps the smoothness won’t change that much so that it is OK that the brain areas included to get acf do not have to match exactly across the subjects to get the group acf parameters (which we average together for each parameter)?


Sure, I would not worry so much about the slight variation in masks, as they are considered to be estimates of global smoothness. While that isn’t quite accurate, it is an assumption being made (or at least that it is close enough to be reasonable).

  • rick

Great, then in the future I don’t have to bother with extra scripts, just use afni_proc and tell it to use the mask_epi_anat and no detrend :wink: and just make a script that extracts the acf from each and average them.

Thanks Rick!

Note that we tend to suggest using gen_ss_review_table.py to make a full spreadsheet out of all of the out.ss_review files across subjects. You can then look for bad subjects or get column averages in your spreadsheet program. Example 1 is the typical usage:

gen_ss_review_table.py -tablefile review_table.xls        \
            -infiles sub*/sub*.results/out.ss_review.*
  • rick