GLTs after the fact

Gentlepeople of AFNI–

We’ve run a complete analysis (despike–> volreg–>align–>warp–>regress) on task FMRI data using AFNI proc but forgot one of the subject-level, between-condition contrasts we’d intended to include. To save time, it would be nice to obtain the desired contrast estimates without re-running the entire proc. Can you point us to any existing documentation for how to do this? It’s fine, of course, if this happens to be outside of afni_proc…

All the best,

Paul generates a script to execute the processing-- what about checking the 3dDeconvolve command therein, copying it with a couple of the variable names used, modifying the GLTs in the new command, and just executing that?


You could also try a modified afni_proc sequence that uses the previously preprocessed files. I wrote about this for comparing different basis functions, but you could just adapt it for different GLTs.

To add to Paul’s and Peter’s suggestions, note that
does have -write_3dD_script and -write_3dD_prefix options, for
just such an occasion. Adding those to the old AP command, and
including the new contrasts will make an appropriate 3dDeconvolve
script that assumes the identical pre-processing.

But do you need to contrast t-stat? If not, 3dcalc is a good way to go.

  • rick

I shoulda known that Rick would make even more convenient than onerous copy+pasting from the generated script… Cap doffed!



My cup runneth over. Thanks.

Rick, SSS (sorry so stupid) but are the contrast coefficients just the simple subtraction of the individual condition betas? If so, 3dcalc will do here but it’s very useful know about the flexibility you’ve implemented in afni_proc.

All best,


Hi Paul,

The contrast coefficients are the linear combination
specified in the contrast. Single line contrasts are
very simple to convert to 3dcalc commands. Consider
some examples:

-gltsym 'SYM: house -face'
-gltsym 'SYM: 0.7*house +0.3*face'
-gltsym 'SYM: face'
-gltsym 'SYM: 0.5*house +0.5*face -doughnut'
-gltsym 'SYM: scary[2] -scary[1]'

The second contrast might be converted using:

3dcalc -a stats+tlrc'[house#0_Coef] -b stats+tlrc'[face#0_Coef]' \
       -expr '0.7*a+0.3*b' -prefix useless_contrast

See Bob’s DeconSummer2004.html document for details
and more examples.

  • rick