Duration Modulation with SPMG1 instead of dmBLOCK

Dear all,

Is it possible to perform duration modulation with the SPMG1 basis function instead of dmBLOCK?
In other words,

3dDeconvolve -num_stimts 1 -polort -1 -nodata 200 0.5 -stim_times_AM2 1 A1.1D SPMG1 -x1D stdout: | 1dplot -stdin -THICK -del 0.5

where A1.1D = 10:5 30:10 50:15 70:5



The rationale for dmBLOCK is that a varying duration across trials presumably leads to varying response magnitude as well as response duration. The underlying basis function is BLOCK. I’m not so sure how much difference it would make if SPMG1 is used as a basis function, but you may have to ask Bob to add such an option. Alternatively you could manually create those two regressors yourself using SPMG1.

Hola, Cesar!

No, it is not possible to directly duration modulate anything but ‘dmBLOCK’ (and its close relatives).

One way to do it (without changes to the 3dDeconvolve code) would be to create a 3dDeconvolve run with “-nodata NR TR”, where NR is the number of time points, and TR is the time spacing of the images. For each distinct stimulus duration, create a separate stimulus file.
In your case, you want

10:5 30:10 50:15 70:5

But instead create 3 files, each with the start time(s) of all stimuli with the same duration:

A05.1D = 10 70
A10.1D = 30
A15.1D = 50

Then run a command like so (with NR and TR replaced by actual numbers!):

3dDeconvolve -nodata NR TR -num_stimts 3 -polort -1 \
                       -stim_times 1 A05.1D 'SPMG1(5)'           \
                       -stim_times 2 A10.1D 'SPMG1(10)'         \
                       -stim_times 3 A15.1D 'SPMG1(15)'         \
                       -x1D SPMout -x1D_stop

The resulting file, SPMout.xmat.1D, will have 3 columns, with the 5s, 10s, and 15s duration regressors. Plot it, with

1dplot SPMout.xmat.1D

to make sure that it is what you want. Then add these columns up to get one column, and use THAT column as a regressor in the REAL analysis, using the “-stim_file” option (instead of “-stim_times”). You can do this with the following AFNI commands:

1dtranspose SPMout.xmat.1D | 1dsum stdin: > temp.1D
1dtranspose temp.1D > SPMvector.1D
\rm temp.1D
1dplot SPMvector.1D SPMout.xmat.1D

(There is probably a nicer way to do that in one of Rick’s programs, but this is what I’ve got in my toolbag.)

Once you have the SPMvector.1D file manufactured correctly, you can delete the intermediate files as you like. Probably best to keep the commands in a script, though, so you can reproduce it later. If you want the script to be self-contained, you could use ‘1D: 10 70’ on the command line in place of A05.1D, etc., as below:

3dDeconvolve -nodata NR TR -num_stimts 3 -polort -1   \
                       -stim_times 1 '1D: 10 7'  'SPMG1(5)'          \
                       -stim_times 2 '1D: 30'    'SPMG1(10)'         \
                       -stim_times 3 '1D: 70'    'SPMG1(15)'         \
                       -x1D SPMout -x1D_stop

Hello Bob and Gang,

Fantastic, I wondered whether it was possible but also thought of this alternative option and you wrote the code!! Thanks very much.


An easier way to sum up across columns is with

3dTstat -prefix stdout: -sum SPMout.xmat.1D > SPMvector.1D

This is simpler, since 1dsum sums down columns, not across columns, which is why the 1dtranspose program has to be used in the earlier example.