3dDeconvolve HDR of variable epoch? (amplitude + duration modulation)

Hi Afni experts,

I would like to select a stim_times option that can use the trial duration to model both the amplitude AND the width of the HDR.
At this moment, using stim_times_AM1 & ‘dmUBLOCK’, I can produce ideal stimuli model with HDR amplitude (height) scaled to the trial duration. The trial durations in this design last for 2, 4, and 6 secs.
My two questions are
1). how do I also change the width of the modeled HDR (based on the duration of the trial). – or you think just modulating the amplitude with the trial duration is good enough!
2). I used the -polort A option and 4 was picked automatically by Afni – is this the optimal option, why so, and may I have more clarification on the polort function. I read the comprehensive help document of 3dDeconvolve and still struggle to understand. :slight_smile:

The rationale of variable epoch comes from Grinband et al., 2008 that both the shape and height of the response in a single short trial will probably vary when the trial duration is a critical variable.
Grinband, J., Wager, T. D., Lindquist, M., Ferrera, V. P., & Hirsch, J. (2008). Detection of time-varying signals in event-related fMRI designs. NeuroImage, 43(3), 509–520. https://doi.org/10.1016/j.neuroimage.2008.07.065

Here is my 1st level script and please find currently modeled ideal HDR (a comment on the left was used to highlight the four rows of modeled conditions and polort of 2 was tested in this run) and screenshots from Grinband’s paper [the 4th blue plot shows as the duration of a short trial increases, the width, height (and slope) of HDR also change (until saturation)]. Please kindly let me know if you notice errors too :slight_smile: Thank you!

3dDeconvolve -input sub-001_ses-001_task-reward_space-MNI152NLin6Asym_desc-preproc_bold_smooth6_scale.nii -mask sub-001_ses-001_task-reward_space-MNI152NLin6Asym_desc-brain_mask.nii -polort A -num_stimts 20
-stim_times_AM1 1 AntLoss.1D ‘dmUBLOCK’
-stim_label 1 AntLoss
-stim_times_AM1 2 AntMixed.1D ‘dmUBLOCK’
-stim_label 2 AntMixed
-stim_times_AM1 3 AntNeu.1D ‘dmUBLOCK’
-stim_label 3 AntNeutral
-stim_times_AM1 4 AntReward.1D ‘dmUBLOCK’
-stim_label 4 AntReward
-stim_file 5 NuiReg_trans_x.txt’[0]’ -stim_base 5 -stim_label 5 trans_x
-stim_file 6 NuiReg_trans_y.txt’[0]’ -stim_base 6 -stim_label 6 trans_y
-stim_file 7 NuiReg_trans_z.txt’[0]’ -stim_base 7 -stim_label 7 trans_z
-stim_file 8 NuiReg_rot_x.txt’[0]’ -stim_base 8 -stim_label 8 rot_x
-stim_file 9 NuiReg_rot_y.txt’[0]’ -stim_base 9 -stim_label 9 rot_y
-stim_file 10 NuiReg_rot_z.txt’[0]’ -stim_base 10 -stim_label 10 rot_z
-stim_file 11 NuiReg_global_signal.txt’[0]’ -stim_base 11 -stim_label 11 global_signal
-stim_file 12 NuiReg_framewise_displacement.txt’[0]’ -stim_base 12 -stim_label 12 framewise_displacement
-stim_file 13 NuiReg_cosine00.txt’[0]’ -stim_base 13 -stim_label 13 NuiReg_cosine00
-stim_file 14 NuiReg_cosine01.txt’[0]’ -stim_base 14 -stim_label 14 NuiReg_cosine01
-stim_file 15 NuiReg_cosine02.txt’[0]’ -stim_base 15 -stim_label 15 NuiReg_cosine02
-stim_file 16 NuiReg_cosine03.txt’[0]’ -stim_base 16 -stim_label 16 NuiReg_cosine03
-stim_file 17 NuiReg_cosine04.txt’[0]’ -stim_base 17 -stim_label 17 NuiReg_cosine04
-stim_file 18 NuiReg_cosine05.txt’[0]’ -stim_base 18 -stim_label 18 NuiReg_cosine05
-stim_file 19 sub-001_ses-001_task-reward_recording-cardiac_physio_regressors.1D.slibase.1D -stim_base 19 -stim_label 19 phys_resp
-stim_file 20 sub-001_ses-001_task-reward_recording-respiratory_physio_regressors.1D.slibase.1D -stim_base 20 -stim_label 20 phys_card
-gltsym ‘SYM: AntReward -AntNeutral’
-glt_label 1 AntRew-AntNeu
-gltsym ‘SYM: AntReward -AntMixed’
-glt_label 2 AntRew-AntMix
-gltsym ‘SYM: AntReward -AntLoss’
-glt_label 3 AntRew-AntLoss
-gltsym ‘SYM: AntMixed -AntLoss’
-glt_label 4 AntMix-AntLoss
-gltsym ‘SYM: AntReward -AntNeutral’
-glt_label 5 -AntRew_AntNeu
-gltsym ‘SYM: -AntReward AntMixed’
-glt_label 6 -AntRew_AntMix
-gltsym ‘SYM: -AntReward AntLoss’
-glt_label 7 -AntRew_AntLoss
-gltsym ‘SYM: -AntMixed AntLoss’
-glt_label 8 -AntMix_AntLoss
-fout -tout -x1D X.xmat.1D -xjpeg X.jpg
-x1D_uncensored X.nocensor.xmat.1D
-fitts fitts.sub-001_ses-001
-errts errts.sub-001_ses-001
-bucket stats.sub-001_ses-001



Note the AM1 with dmUBLOCK will indeed result in both varying heights and shapes for individual events, if that is what you are asking about. The BLOCK basis function gets convolved with boxcars of the varying durations, which will result in both of those differences. The BLOCK basis function does not have an undershoot though, as you show in the images.

The -polort default is 1 + floor(run_length/150 (time in seconds)), also applied by afni_proc.py (unless otherwise specified by the user).

What is the range of stimulus duration applied? Consider:

timing_tool.py -multi_timing Ant*.1D -multi_show_duration_stats

  • rick

Hi Rick,

Thanks for the confirmation on the variable epoch function and additional explanations on polort.

Following your suggestion, I got these durations of the events for all the anticipation conditions:
AntLoss.1D: min = 2, mean = 4, max = 6, stdev = 1.70561
AntMixed.1D: min = 2, mean = 4, max = 6, stdev = 1.70561
AntNeu.1D: min = 2, mean = 4, max = 6, stdev = 1.70561
AntReward.1D: min = 2, mean = 4, max = 6, stdev = 1.70561

Hope my selection of the variable epoch function is still appropriate given the range of the durations.


Hi Xi,

Sure, indeed with that duration range, dmUBLOCK seems good.

  • rick

Thanks a lot for your expert input! :slight_smile: