Compute TSNR for all runs using volreg_compute_tsnr


May I ask if it is possible to compute TSNR for all runs using when setting -volreg_compute_tsnr yes? It seems only computes for the first run as explained here in the documentation and the script generated by Is there a specific reason for only doing it on run1, TSNR is kind of stationery at a resolution of around 10minutes? The TSNR computed using regression residual is using all runs. Thanks a lot.

# create a TSNR dataset, just from run 1
3dTstat -mean -prefix rm.signal.vreg.r01 pb03.$subj.r01.volreg+orig
3dDetrend -polort 3 -prefix rm.noise.det -overwrite pb03.$subj.r01.volreg+orig
3dTstat -stdev -prefix rm.noise.vreg.r01 rm.noise.det+orig
3dcalc -a rm.signal.vreg.r01+orig                                  \
       -b rm.noise.vreg.r01+orig                                   \
       -c mask_epi_extents+orig                                    \
       -expr 'c*a/b' -prefix TSNR.vreg.r01.$subj


What version of AFNI do you have?

In my version---AFNI_23.1.07---I do get a "final" TSNR, using all_runs, called TSNR.${subj}*:

# --------------------------------------------------
# create a temporal signal to noise ratio dataset 
#    signal: if 'scale' block, mean should be 100
#    noise : compute standard deviation of errts
3dTstat -mean -prefix rm.signal.all all_runs.$subj+tlrc"[$ktrs]"
3dTstat -stdev -prefix rm.noise.all errts.${subj}+tlrc"[$ktrs]"
3dcalc -a rm.signal.all+tlrc                                             \
       -b rm.noise.all+tlrc                                              \
       -expr 'a/b' -prefix TSNR.$subj

... which should also appear in the APQC HTML.


Hi Paul,

Iā€™m using 23.1.08 the latest one on GitHub. I do also have this part you showed and have this TSNR brick in the result folder, but this is the final TSNR using errts which is the residual of GLM as noise. What I meant was the TSNR calculated with volreg. In the help it also says run 1 will be used for -volreg_comoute_tsnr. I could compute it using the same code generated by for other runs, but wondering why it is only for run 1 . Probably I missed something important. I ask this because for me TSNR calculated only with detrending dspike maybe be more general and comparable for QC since GLM residual is also related to the model itself. Then it will be difficult to compare TSNR when different models are used. Thanks.

For the 'volreg' block, the multiple runs have not been concatenated yet; they only get concatenated during the 'regress' block, where the baselines are modeled per run. Therefore, the volreg block TSNR can only be per run; run 1 is used representationally, probably mainly for QC.


1 Like