Regressors in AFNi (SPMGx, TWOGAMpw...) how to parametre duration

Hello folks,

I have been studying down the rabbit hole the different regressors in AFNi, for the 3dDeconvolve regression function.
I was trying to figure out which regresors are HRF (all regular ones indeed are : BLOCK, SPMGx, TWOGAMpw…), but very importantly, how to parametre them.

SPMGx(duration) has only one parametre which is the duration of the step like function that the double gamma HRF function is gonna be modulated with.
It looks like this :

Which is stricly the same as the one generated by TWOGAMpw.
So far so good. The thing is the duration I put in is 24.6 seconds with a TR of 4.1s (might as well be precise), but as we can see more precisely in this picture :

It seems BOTH gamma durations are 6TRs which is the approximate duration i’ve put as parametre.

Soooo, I’m wondering if the duration parametre is the duration of one of the block of the convolution or both blocks (1 and -1)

I hope you can answer this question, it’s not clear in the docs.


Hey folks,

Has any body got any clues on this question ?
I know convolution does increase the size of the function (even though in a lot of cases,m the output size is truncated to match the input size). But it is very odd that it would be precisely twice. the size of the desired duration.

Hi @ztn. In the case of a specified duration, I believe the boxcar convolution is with the entire basis function, here SPMG1. Taken as a single function, its two GAMs would be both be convolved, effectively applying the 24.6s duration to each.
Convolution is not done specially per function.

I do not quite understand your comment about being twice the size of a desired duration…

For comparison, here is a TR=1s image of SPMG1 and SPMG1(24.5). That might be easier to ponder.

The image was made with:

3dDeconvolve -nodata 50 1 -polort -1 -num_stimts 2   \
   -stim_times 1 '1D:0' SPMG1                        \
   -stim_times 2 '1D:0' 'SPMG1(24.6)'                \
   -x1D X.xmat.1D -x1D_stop
1dplot -sepscl X.xmat.1D &
1 Like

Hello Rick,

Thanks for the information, and the commands.
I’ve fiddle a bit with the code you presented.
THe top regressor is the 24.6 s duration regressor. And the bottom one is the HRF function.

So basicaly, the convolution adds the 25s duration of basic HRF to the duration of block design. In my case, the block “duration” being the same duration as HRF, it doubles.

Shouldn’t that be taken into account ?
This means that the total duration is way longer than expected from what duration means.
I guess it could be expected and the longer HRF response, could be what we are looking for, it just seems very long to me, sometimes might even overlap with next regressor, starting from nonzeros.

What do you think ?

Hi Simon,

That is indeed the case. Convolution (with a boxcar, say) puts down copies of the basis function from the onset time to the offset time, and add them all up (scaling to something tractable, not infinity :). So the duration of the non-zero (say) convolved curve will be the duration of the non-zero basis function PLUS the duration of the boxcar. From a neurological point of view, this is viewed as continuous stimulation, where all stimulation time invokes the same BOLD response.

For example, even at the very end of the 24.6 s there is still stimulation. That final bit of stimulation still invokes a complete SPMG1 response curve (that is our assumption when applying the convolution). Therefore the duration of the (expected) convolved BOLD response is about 50 s here, the non-zero duration of the basis function (about 25 s) plus the duration of the convolution boxcar (24.6 s).

To go shorter, a 10 s event is not going to invoke only a 10 s BOLD response curve when even a 1 s even invokes a 25 s response. A 10 s event will invoke a 35 s BOLD response.

It is okay for the BOLD response to overlap with other event responses. That is the expectation for anything but a very slow event design (where events are separated by more than the duration of the applied basis function - did I just get circular?).

Does that seem reasonable?

1 Like

Hello Rick,

Thanks for the clarification, it makes perfect sense.