3D Convolve with variable block durations based on response timing of the participant

Hello,
I am trying to run a simple level 1 analysis for a task where participants were excluded or included for a block of time. The block time varied based on the individuals response times (throwing a ball to other participants). I am new to AFNI but am just trying to run a simple 3dDeconvolve analysis for one participants on fMRIprep preprocessed data. Maybe I am missing the point of this process, but not sure how to model my data when I have blocks of differing durations?

I keep getting the following error message and I can’t seem to resolve this…

*+ WARNING: ‘-stim_times_AM1 1’ didn’t read any good times from file ‘/mnt/analysis/sub-06/beh/test.1D’
++ ‘-stim_times_AM1 1 /mnt/analysis/sub-06/beh/test.1D’ has 1 auxiliary values per time point
++ ‘-stim_times_AM1 1’: basis function model ‘dmBLOCK(1)’ uses 1 parameters,
out of the 1 found in timing file ‘/mnt/analysis/sub-06/beh/test.1D’
*+ WARNING: ‘-stim_times_AM1 2’ didn’t read any good times from file ‘/mnt/analysis/sub-06/beh/tf_asd_06_equal_play.txt’
++ ‘-stim_times_AM1 2 /mnt/analysis/sub-06/beh/tf_asd_06_equal_play.txt’ has 1 auxiliary values per time point
++ ‘-stim_times_AM1 2’: basis function model ‘dmBLOCK(1)’ uses 1 parameters,
out of the 1 found in timing file ‘/mnt/analysis/sub-06/beh/tf_asd_06_equal_play.txt’
** ERROR: 3dDeconvolve dies: Unrecognized command line option: ‘SYM: +full -equal’
Here’s hoping these excerpts from ‘3dDeconvolve -help’ enlighten:
‘of the full model (all regressors) vs. the baseline model. Thus, it’
‘against the full model with just that set of regressors removed. If’
‘from the full model fit to the input data’

  • what I have tried…
  1. changing to “dmBLOCK(0)”, “dmBLOCK(2)”, “dmBLOCK”
  2. changing the timing file to FSL formate and running “-stim_times_FSL”
  3. creating a timing file with timing_tool.py -fsl_timing_files fsl_format.txt -write_timing output.1D and then insert (you will see two different input timing files below, 1 in 1D format and the other in .txt format
  4. making the times smaller and the durations of increasing order in the timing file

still getting the same error???

Here is my code (I am running AFNI through docker)

subject=06

for subject in $subject; do
docker run -it -v /mnt/c/analysis/analysis/derivatives:/mnt/analysis/ afni/afni_make_build 3dDeconvolve -input /mnt/analysis/sub-${subject}/func/sub-${subject}scale.nii.gz \
-censor censor.1D
-mask /mnt/analysis/sub-${subject}/func/sub-01_task-cyber_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz
-polort 2
-num_stimts 2
-stim_times_AM1 1 /mnt/analysis/sub-${subject}/beh/test.1D ‘dmBLOCK(1)’
-stim_label 1 full
-stim_times_AM1 2 /mnt/analysis/sub-${subject}/beh/tf_asd
${subject}_equal_play.txt ‘dmBLOCK(1)’
-stim_label 2 equal
-ortvec /mnt/analysis/sub-${subject}/func/confound_test.1D
-gltsym ‘SYM: +full -equal’
-glt_label 1 full_exclude-equal_play
-gltsym ‘SYM: +equal -full’
-glt_label 2 equal_play-full_exclude
-fout -tout -x1D X.xmat.1D -xjpeg X.jpg
-x1D_uncensored X.nocensor.xmat.1D
-fitts fitts.$subject
-errts errts.${subject}
-bucket stats.$subject
done
This runs the following in afni container…

3dDeconvolve -input /mnt/analysis/sub-06/func/sub-06_scale.nii.gz -censor censor.1D -mask /mnt/analysis/sub-06/func/sub-01_task-cyber_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz -polort 2 -num_stimts 2 -stim_times_AM1 1 /mnt/analysis/sub-06/beh/test.1D dmBLOCK(1) -stim_label 1 full -stim_times_AM1 2 /mnt/analysis/sub-06/beh/tf_asd_06_equal_play.txt dmBLOCK(1) -stim_label 2 equal -ortvec /mnt/analysis/sub-06/func/confound_test.1D -gltsym SYM: +full -equal -glt_label 1 full_exclude-equal_play -gltsym SYM: +equal -full -glt_label 2 equal_play-full_exclude -fout -tout -x1D X.xmat.1D -xjpeg X.jpg -x1D_uncensored X.nocensor.xmat.1D -fitts fitts.06 -errts errts.06 -bucket stats.06

Here is my original timing file

10:22.594 76:22.926 260:20.6

Hi-

A couple comments, but these won’t really be solutions, likely, just features:

  1. You have two backslashes, separated by a space, in a row at the end of your first line: "\ "
    I just spaced the text out a bit here (without that double slash):

3dDeconvolve                                                                 \
    -input           /mnt/analysis/sub-${subject}/func/sub-${subject}_scale.nii.gz \
    -censor          censor.1D                                               \
    -mask            /mnt/analysis/sub-${subject}/func/sub-01_task-cyber_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz \
    -polort          2                                                       \
    -num_stimts      2                                                       \
    -stim_times_AM1  1 /mnt/analysis/sub-${subject}/beh/test.1D 'dmBLOCK(1)' \
    -stim_label      1 full                                                  \
    -stim_times_AM1  2                                                       \
                     /mnt/analysis/sub-${subject}/beh/tf_asd_${subject}_equal_play.txt \
                     'dmBLOCK(1)'                                            \
    -stim_label      2 equal                                                 \
    -ortvec          /mnt/analysis/sub-${subject}/func/confound_test.1D      \
    -gltsym          'SYM: +full -equal'                                     \
    -glt_label       1 full_exclude-equal_play                               \
    -gltsym          'SYM: +equal -full'                                     \
    -glt_label       2 equal_play-full_exclude                               \
    -fout                                                                    \
    -tout                                                                    \
    -x1D             X.xmat.1D                                               \
    -xjpeg           X.jpg                                                   \
    -x1D_uncensored  X.nocensor.xmat.1D                                      \
    -fitts           fitts.$subject                                          \
    -errts           errts.${subject}                                        \
    -bucket          stats.$subject

  1. for choosing a duration modulation specification, these notes will likely be helpful:
    https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/statistics/deconvolve_block.html
    We generally recommend using dmUBLOCK() with a negative argument, whose magnitude is the mean stim duration.

  2. You might want to specify the number of GLTs explicitly:


-num_glt         2

  1. Your current GLTs are just sign-flips of each other. You shouldn’t need to do that—we do 2sided testing by default, unlike in some other software. The importance and relevance of 2-sided testing in most MRI analyses is described here:
    Chen G, Cox RW, Glen DR, Rajendra JK, Reynolds RC, Taylor PA (2019). A tail of two sides: Artificially doubled false positive rates in neuroimaging due to the sidedness choice with t-tests. Human Brain Mapping 40:1037-1043.
    https://pubmed.ncbi.nlm.nih.gov/30265768/

  2. I don’t see any motion regressors there in the model?

–pt

Oh, and from spacing out the command, I think I see the issue: “-ortvec …” takes 2 parameters after it, not 1. From the 3dDeconvolve help:


-ortvec fff lll      This option lets you input a rectangular array    
                     of 1 or more baseline vectors from file 'fff',    
                     which will get the label 'lll'.  Functionally,    
                     it is the same as using '-stim_file' on each      
                     column of 'fff' separately (plus '-stim_base').   
                     This method is just a faster and simpler way to   
                     include a lot of baseline regressors in one step. 
          -->>**N.B.: This file is NOT included in the '-num_stimts'   
                      count that you provide.                          
               *N.B.: These regression matrix columns appear LAST      
                      in the matrix, after everything else.            
               *N.B.: You can use column '[..]' and/or row '{..}'      
                      selectors on the filename 'fff' to pick out      
                      a subset of the numbers in that file.            
               *N.B.: The q-th column of 'fff' will get a label        
                      like 'lll[q]' in the 3dDeconvolve results.       
               *N.B.: This option is known as the 'Inati Option'.      
               *N.B.: Unlike the original 'Inati' (who is unique), it  
                      is allowed to have more than one '-ortvec' option.
               *N.B.: Program 1dBport is one place to generate a file  
                      for use with '-ortvec'; 1deval might be another.

So, if you changed:


-ortvec          /mnt/analysis/sub-${subject}/func/confound_test.1D      \

… to:


-ortvec          /mnt/analysis/sub-${subject}/func/confound_test.1D  ORT_LABEL    \

… does that sort that error message out?

Note some of the other points in the other reply might still apply and be useful to address, too.

–pt

Also, what is the output from:

3dinfo -tr -nt /mnt/analysis/sub-${subject}/func/sub-${subject}_scale.nii.gz

  • rick