Convert from z-score to t-score

Dear AFNI experts,

We would like to visualize our results with Cluster Explorer. It seems that it does not work if the output of 3dttest++ is z-score. I have tried to convert the z-score to t-score by using 3dcal with the following expression:
3dcalc -a TTEST_one_sample.nii -expr ‘cdf2stat(stat2cdf(a,5,0,0,0),3,13,0,0)’ -prefix TTEST_one_sample_tstat.nii

Although the function run, the output does not correspond to the t-stat.

Could you indicate me what is wrong in this expression?

Thanks a lot in advance.
Karel

Hi Karel,

This looks good to me. A local comparison of the 3dcalc-computed t to those output be 3dttest++ showed an exact match (using your exact expression with a change for DoF).

Note that if you are starting with volume #0 from 3dttest++, that will be an effect (beta) magnitude, not a z-score. 3dcalc will process all volumes using the same expression.

  • rick

Dear Rick,

Thank you so much for the quick response. It worked after discarding the subbrik/volume number 0. After using a z-score as an input the result had coherence. Thanks for clarifying my doubt.

Karel

Rick, I just realize that although the conversion from Z to T worked fine, the header says “group 1 Zscr” instead of “group 1 Tstat”. This is a problem, because the Cluster Explorer program only works with Tstat. How can I change this part of the header?
Thanks.
Karel

Hi Karel,

Does that mean it won’t work, or just that it states the old Z label?

It is a little ugly, but you can use 3drefit to alter the dataset labels (see options like -relabel_all and -sublabel_suffix).

But backing up a moment, why do you have z-scores in the first place? Did you use the -Clustsim or -ETAC options to 3dttest++?

  • rick

Hi Rick,

Changing the header information with 3drefit worked, but i still have problems with the cluster explorer. Regarding to the z-scores, I did use -Clustsim and -ETAC options in 3dtest++. When I convert those z-scores into t-stats with 3dcalc and then change the header, the Cluster explorer behavior the the same one as if as use a 3dtest++ input without -clustsim and -ETAC options. That is great! but I still have error messages like this:

Attaching package: ‘afex’ The following object is masked from ‘package:lme4’: lmer
Error in factor(mean.df$Group, levels = c(lab.a, lab.b), ordered = TRUE) : objeto ‘lab.a’ no encontrado
Calls: … sourceUTF8 → eval → eval → …stacktraceon… → factor

Thanks a lot,
Karel

Hi,
The ClusterExplorer needs the Tstat AND the degrees of freedom from the image header.
Can you run 3dttest++ without the corrections just to look at the clusters?
The coordinates of the peak voxels of the clusters could be pretty close but the center of mass of the clusters could be very different and the clusters themselves could be different.
I should be able to add a check for the z-score version and do the p thresholding that way.

Thanks, Justin