How can I convolve the stim_file using 3dDeconvolve


I am a new beginner of AFNI. To correlate alpha power time series from EEG with fMRI BOLD signal, I need to convolve alpha power time series (stim_file 1) with HRF in 3dDeconvolve. But I am not sure which function should I use. Here is my script with 3dDeconvolve, just for reference.

3dDeconvolve -input EC_standard_bandpass+tlrc
-polort A
-num_stimts 9
-stim_file 1 alpha_ps_ts.txt -stim_label 1 alpha
-stim_file 2 motion.1D’[0]’ -stim_base 2 -stim_label 2 roll
-stim_file 3 motion.1D’[1]’ -stim_base 3 -stim_label 3 pitch
-stim_file 4 motion.1D’[2]’ -stim_base 4 -stim_label 4 yaw
-stim_file 5 motion.1D’[3]’ -stim_base 5 -stim_label 5 ds
-stim_file 6 motion.1D’[4]’ -stim_base 6 -stim_label 6 dl
-stim_file 7 motion.1D’[5]’ -stim_base 7 -stim_label 7 dp
-stim_file 8 csf.1D -stim_base 8 -stim_label 8 csf
-stim_file 9 white.1D -stim_base 9 -stim_label 9 white
-fout -tout -rout -full_first -x1D Xmat_noise.x1D -cbucket cbu_noise -bucket alpha_Decon

Thanks for your help

Maybe waver is the program you want. Also note several of the modeled basis functions in 3dDeconvolve are convolved with a square wave, as described in this excerpt from 3dDeconvolve’s help

*** Some models below are described in terms of a simple response  
    function that is then convolved with a square wave whose       
    duration is a parameter you give (duration is NOT a parameter  
    that will be estimated).  Read the descriptions below carefully:
    not all functions are (or can be) convolved in this way:       
    * ALWAYS convolved:      BLOCK  dmBLOCK  MION  MIONN           
    * NEVER convolved:       TENT   CSPLIN   POLY  SIN   EXPR      
    * OPTIONALLY convolved:  GAM    SPMGx    WAV

You can use the ‘-nodata’ option, as in ‘-nodata 300 1.0’ where ‘300’ is the number of time points and ‘1.0’ is the time interval (in seconds) between them. After that, you set up the processing as normal, and the program outputs the analysis design matrix.

Here is an example copied from the 3dDeconvolve -help output

3dDeconvolve -nodata 300 1 -polort -1 -num_stimts 2   \
                            -stim_times 1 '1D: 10 150' 'MION(70)'    \
                            -stim_times 2 '1D: 10 150' 'BLOCK(70,1)' \
                            -x1D stdout: | 1dplot -stdin -one -thick

Here, the output is piped directly into 1dplot. If instead, you replace everything after ‘-x1D’ with ‘Xmat.1D’, you’ll get the resulting matrix (in this case, 2 columns) saved into a text file.

To clarify, does alpha_ps_ts.txt contain event times, or a
time series with a value at each time point that should be
convolved with some basis function? And which basis
function are you interested in?

  • rick

My alpha power time series (stim_file 1) is a vector, recording variation of alpha power varies. I am not sure if I should use WAV?

Alpha power time series (stim_file 1) is a time series with a value at each time point that should be convolved with HRF. After checking the help in 3Ddecnonvolve, I prefer WAV as my interested function.