Title: Troubleshooting AFNI 3dDeconvolve - FATAL ERROR with basis function and timing file


I am running a 3dDeconvolve command in AFNI to analyze fMRI data, specifically for a single condition, and have encountered an error. The task was a movie watching where the subject was just watching a movie. I have timestamps and durations when the speech occured in the movie. I would like to see some activation for my ‘Speech’ condition. My goal is to analyze a single condition (Speech) with varying durations. I have a timing file (stim-speech.1D) in a two-column format, where the first column represents the onset times and the second column represents the durations of each event.

Here is the command I’m running:

3dDeconvolve \
  -input ../230426JN.results/pb03.230426JN.r01.scale+orig.HEAD \
  -censor ../230426JN.results/motion_230426JN_censor.1D \
  -TR_1D 1.5 \
  -num_stimts 1 \
  -stim_times 1 ../stim-speech.1D 'dmUBLOCK(1)' -stim_label 1 Speech \
  -iresp 1 speech_condition_response.nii.gz \
  -bucket speech_condition_stats_bucket.nii.gz \
  -xjpeg speech_condition_design_matrix.jpg \
  -x1D X.xmat.1D \
  -polort 8

And I’m getting this error:

** FATAL ERROR: '-stim_times 1': basis function model 'dmUBLOCK(1)' uses 1 parameters,
    more than the -1 found in timing file '../stim-speech.1D' [nopt=12]
** Program compile date = Feb  7 2023

Given the nature of my events (varying durations and close onset times), I have considered both dmUBLOCK and TENT basis functions. However, I am not sure which one to use and how to properly structure my timing file or command to avoid errors. Furthermore, I’m not sure what the [nopt=12] in the error message means.

Here are a few lines from my timing file (stim-speech.1D) for reference:

86.24 13.07
104.76 24.956
169.84 1.149
173.6 1.07
175.8 3.354
180.44 1.832
183.84 3.512
278.76 34.359
319.52 19.992
396.52 5.36
403.48 50.789
456.08 2.23
460.36 1.354
470.64 4.993
476.88 1.434
497.12 9.919
509.12 1.832
513.4 37.036
551.6 6.56
559.32 11.718
572.32 2.674
576.48 51.552
629.8 0.99
632.0 2.15
636.92 7.31
649.04 0.956

I’d appreciate any suggestions or advice on how to resolve this issue and successfully run the 3dDeconvolve command. Thank you!

Unless something has gone wrong with the formatting in the new forum, your regressors should be of the form onset:duration not “onset duration”. The : is important.

You appear to only have one run, therefor there should only be one row (or line) in your regressor file.

Try those changes and see how it goes.

86.24:13.07 104.76:24.956 169.84:1.149 173.6:1.07

There is a -stim_times_FSL option that let’s one specify a 3-column FSL-style timing format (which would presumably mean adding a column of 1 to the current 2-column format). But as @colmconn suggests, it might be best to use the AFNI timing format.
If you were to use afni_proc.py to do the processing, AFNI timing is currently required.

  • rick

Thank you for your comments! Actually, I tried that too before.
I have a file called stim-speech_oneline.1D which looks like this:

86.24:13.07 104.76:24.956 169.84:1.149 173.6:1.07 175.8:3.354 ...

and if I use that one for 3dDeconvolve I got an error:

** FATAL ERROR: '-stim_times 1' file '../stim-speech_oneline.1D' has 1 auxiliary values per time point [nopt=11]
** Program compile date = Feb  7 2023

I should have mentioned that when using AFNI timing, this “duration modulation” timing would correspond with -stim_times_AM1 (or even AM2 if you had a separate amplutude modulator). The plain -stim_times option would mean no auxiliary values, which is what the error refers to.

  • rick

@rickr, thank you! It works now, I think!

So, my 3dDeconvolve looks like this now:

3dDeconvolve \
  -input ../230426JN.results/pb03.230426JN.r01.scale+orig.HEAD \
  -censor ../230426JN.results/motion_230426JN_censor.1D \
  -TR_1D 1.5 \
  -num_stimts 1 \
  -stim_times_AM1 1 ../stim-speech_oneline.1D 'dmUBLOCK(1)' \
  -stim_label 1 Speech \
  -bucket speech_condition_stats_bucket.nii.gz \
  -xjpeg speech_condition_design_matrix.jpg \
  -x1D X.xmat.1D \
  -polort 14

And it seems to be working:

++ '-stim_times_AM1 1 ../stim-speech_oneline.1D' has 1 auxiliary values per time point
++ '-stim_times_AM1 1': basis function model 'dmUBLOCK(1)' uses 1 parameters,
    out of the 1 found in timing file '../stim-speech_oneline.1D'
++ 3dDeconvolve: AFNI version=AFNI_23.0.02 (Feb  7 2023) [64-bit]
++ Authored by: B. Douglas Ward, et al.
++ loading dataset ../230426JN.results/pb03.230426JN.r01.scale+orig.HEAD

Am I right that ‘1 found in timing file’ says about the number of runs? So, If I would have a second row it would consider two runs.

Thank you!

The “out of the 1 found” refers to the number of auxiliary parameters in the timing file. In your case, it would be the event duration parameter.
I think “++ Auto-catenated datasets start at” is the main comment showing how many runs, assuming there is more than 1. The output does not seem to directly specify how many runs it found directly.

Great, thank you so much, @rickr !

@egor.levchenko Oh, I forgot to mention, -TR_1D applies only to the case of -input1D and so is ignored here. Since your -input is a full 4-D time series, it should contain the correct TR (1.5 s). Verify with:
3dinfo -tr pb03.230426JN.r01.scale+orig

If needed, there is a -force_TR option, but it is better to have an accurate number in the dataset, such as via (3drefit -TR).

  • rick
1 Like