regress_stim_times_offset after fmriPREP

Hello,

I hope you are doing well!

I am trying to use AFNI proc.py to run first-level analyses on data that have been preprocessed using fmriPREP.

I specifically have a question about the regress_stim_times_offset option.

In fmriPREP, slice timing was performed on the BOLD data in the following way:

Slice time correction was performed prior to other signal resampling processes using AFNI 3dTShift. All slices are realigned in time to the middle of each TR.
BOLD runs were slice-time corrected to 0.831s (0.5 of slice acquisition range 0s-1.66s) using 3dTshift from AFNI 20160207 (Cox and Hyde 1997, RRID:SCR_005927).

Because of this, I believe I need to use regress_stim_times_offset when running AFNI proc.py. However, I’m a little unclear on what input to give regress_stim_times_offset. If the BOLD data was shifted towards the middle of the TR, I should be ADDING a timing offset to my timing files correct? I read that TR/2 would be a good offset (1.75/2 = 0.875). But the fmriPREP output stated it used slice-timing correction of 0.831. So should I use that input instead?

Thank you! Please let me know if you need more info!

Hello,

Please see this thread on how to adjust for the same issue and solution: https://afni.nimh.nih.gov/afni/community/board/read.php?1,166851,166851#msg-166851

users should subtract ~TR/2 from the stimulus times (actually (N-1)/N * TR/2 s, assuming N slices are evenly distributed over the TR), but TR/2 is close enough if there are many slices.

-Peter

thank you!

Hi Megan,

The timing shift should be negative, -0.831, it seems. Apply this offset to the stimulus times.

See https://afni.nimh.nih.gov/afni/community/board/read.php?1,166851,166855#msg-166855 .

Keep in mind that 3dTshift is not really shifting the timing of the data, it is sampling the data onto a new timing grid. It is more like 3dresample in the time domain. This analogy is useful because the intention of 3dresample is not to move the volume, it is merely to sample it on another grid. The volume is supposed to be in the same place in space.

This applies to 3dTshift, too. Each time series is resampled onto a different time grid, but the intention is not to “move the signal”. The input to 3dTshift has data sample all across the TR. The output is supposed to be as if the entire volume were sampled at just one time point (per TR).

Since 3dDeconvolve interprets the time series as if it were sampled at the start of each TR, but now the time series values are really sampled at the mid-TR, 3dDeconvolve is effectively shifting the data earlier, and so the timing needs a corresponding shift.

Anyway, see the the example in the linked post, that is more clear than theoretical descriptions. But still, it is predicated on the “resample” point of view.

The TR/2 as just an approximation is described there, too.

  • rick

Oops, Peter beat me to this… But still, the resampling point seems nice to make.

  • rick

thank you that helps!

Sorry to bother you again, but a question about shifting my timing files!

I have a regressor of no interest (called “Class”) that has an onset of 0.011 in run 1 for example.

Therefore, when I apply the stim time offset of -.831, my new class_offset.1D file reads as so

-0.82:5
-0.82:5
-0.815:5

This is I believe what is causing my script to error, however I have copied the output below. Is there a parameter that can be added to avoid shifting that “class” timing file? Or am I running into a separate issue? Thank you SO much! I really appreciate the help!

set subjects = ( s1562 s1571 s1577 s1585 s1591 s1603 s1610 s1614 s1622 s1629 s1671 s1693 s1712 )
set GLM = AggPM053122
set topdir = /data/projects/STUDIES/SEAT/fMRI
set results = /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/IndvlLvlAnalyses
cd /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/IndvlLvlAnalyses
foreach subj ( s1562 s1571 s1577 s1585 s1591 s1603 s1610 s1614 s1622 s1629 s1671 s1693 s1712 )
cd s1562
tcsh -xef proc.s1562.AggPM053122
echo auto-generated by afni_proc.py, Tue Jun 14 12:16:20 2022
echo (version 7.39, May 10, 2022)
echo execution started: date
date
afni -ver
afni_history -check_date 7 Mar 2022
if ( 0 ) then
if ( 0 > 0 ) then
set subj = s1562
endif
set output_dir = s1562.results.AggPM053122
if ( -d s1562.results.AggPM053122 ) then
set runs = ( count -digits 2 1 3 )
count -digits 2 1 3
mkdir -p s1562.results.AggPM053122
mkdir s1562.results.AggPM053122/stimuli
timing_tool.py -add_offset -0.831 -timing /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFilesPM/sub-s1562/class_agg.1D -write_timing s1562.results.AggPM053122/stimuli/offset_class_agg.1D
timing_tool.py -add_offset -0.831 -timing /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFilesPM/sub-s1562/Mean_anticipation_agg.1D -write_timing s1562.results.AggPM053122/stimuli/offset_Mean_anticipation_agg.1D
timing_tool.py -add_offset -0.831 -timing /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFilesPM/sub-s1562/Mean_feedback_agg.1D -write_timing s1562.results.AggPM053122/stimuli/offset_Mean_feedback_agg.1D
timing_tool.py -add_offset -0.831 -timing /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFilesPM/sub-s1562/Mean_response_agg.1D -write_timing s1562.results.AggPM053122/stimuli/offset_Mean_response_agg.1D
timing_tool.py -add_offset -0.831 -timing /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFilesPM/sub-s1562/Nice_anticipation_agg.1D -write_timing s1562.results.AggPM053122/stimuli/offset_Nice_anticipation_agg.1D
timing_tool.py -add_offset -0.831 -timing /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFilesPM/sub-s1562/Nice_feedback_agg.1D -write_timing s1562.results.AggPM053122/stimuli/offset_Nice_feedback_agg.1D
timing_tool.py -add_offset -0.831 -timing /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFilesPM/sub-s1562/Nice_response_agg.1D -write_timing s1562.results.AggPM053122/stimuli/offset_Nice_response_agg.1D
timing_tool.py -add_offset -0.831 -timing /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFilesPM/sub-s1562/UnpMean_anticipation_agg.1D -write_timing s1562.results.AggPM053122/stimuli/offset_UnpMean_anticipation_agg.1D
timing_tool.py -add_offset -0.831 -timing /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFilesPM/sub-s1562/UnpMean_feedback_agg.1D -write_timing s1562.results.AggPM053122/stimuli/offset_UnpMean_feedback_agg.1D
timing_tool.py -add_offset -0.831 -timing /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFilesPM/sub-s1562/UnpMean_response_agg.1D -write_timing s1562.results.AggPM053122/stimuli/offset_UnpMean_response_agg.1D
timing_tool.py -add_offset -0.831 -timing /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFilesPM/sub-s1562/UnpNice_anticipation_agg.1D -write_timing s1562.results.AggPM053122/stimuli/offset_UnpNice_anticipation_agg.1D
timing_tool.py -add_offset -0.831 -timing /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFilesPM/sub-s1562/UnpNice_feedback_agg.1D -write_timing s1562.results.AggPM053122/stimuli/offset_UnpNice_feedback_agg.1D
timing_tool.py -add_offset -0.831 -timing /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFilesPM/sub-s1562/UnpNice_response_agg.1D -write_timing s1562.results.AggPM053122/stimuli/offset_UnpNice_response_agg.1D
timing_tool.py -add_offset -0.831 -timing /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFilesPM/sub-s1562/missing_agg.1D -write_timing s1562.results.AggPM053122/stimuli/offset_missing_agg.1D
cp /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/confounds/sub-s1562/sub-s1562_task-seat_allruns_aCompCor6.1D /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/confounds/sub-s1562/sub-s1562_task-seat_allruns_cosine.1D /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/confounds/sub-s1562/sub-s1562_task-seat_allruns_fd.1D s1562.results.AggPM053122/stimuli
3dcopy /data/projects/STUDIES/SEAT/fMRI/derivatives/fmriprep/sub-s1562/anat/sub-s1562_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz s1562.results.AggPM053122/sub-s1562_space-MNI152NLin2009cAsym_desc-preproc_T1w
++ 3dcopy: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
cp /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/confounds/sub-s1562/sub-s1562_task-seat_allruns_motion.1D s1562.results.AggPM053122
3dTcat -prefix s1562.results.AggPM053122/pb00.s1562.r01.tcat /data/projects/STUDIES/SEAT/fMRI/derivatives/fmriprep/sub-s1562/func/sub-s1562_task-seat_run-1_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz[0…$]
++ 3dTcat: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
++ elapsed time = 1.9 s
3dTcat -prefix s1562.results.AggPM053122/pb00.s1562.r02.tcat /data/projects/STUDIES/SEAT/fMRI/derivatives/fmriprep/sub-s1562/func/sub-s1562_task-seat_run-2_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz[0…$]
++ 3dTcat: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
++ elapsed time = 1.9 s
3dTcat -prefix s1562.results.AggPM053122/pb00.s1562.r03.tcat /data/projects/STUDIES/SEAT/fMRI/derivatives/fmriprep/sub-s1562/func/sub-s1562_task-seat_run-3_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz[0…$]
++ 3dTcat: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
++ elapsed time = 1.9 s
set tr_counts = ( 167 167 167 )
cd s1562.results.AggPM053122
touch out.pre_ss_warn.txt
foreach run ( 01 02 03 )
3dToutcount -automask -fraction -polort 2 -legendre pb00.s1562.r01.tcat+tlrc
++ 3dToutcount: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
++ 66269 voxels passed mask/clip
if ( 1deval -a outcount.r$run.1D"{0}" -expr "step(a-0.4)" ) then
1deval -a outcount.r01.1D{0} -expr step(a-0.4)
end
3dToutcount -automask -fraction -polort 2 -legendre pb00.s1562.r02.tcat+tlrc
++ 3dToutcount: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
++ 66300 voxels passed mask/clip
if ( 1deval -a outcount.r$run.1D"{0}" -expr "step(a-0.4)" ) then
1deval -a outcount.r02.1D{0} -expr step(a-0.4)
end
3dToutcount -automask -fraction -polort 2 -legendre pb00.s1562.r03.tcat+tlrc
++ 3dToutcount: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
++ 66240 voxels passed mask/clip
if ( 1deval -a outcount.r$run.1D"{0}" -expr "step(a-0.4)" ) then
1deval -a outcount.r03.1D{0} -expr step(a-0.4)
end
cat outcount.r01.1D outcount.r02.1D outcount.r03.1D
foreach run ( 01 02 03 )
3dmerge -1blur_fwhm 6 -doall -prefix pb01.s1562.r01.blur pb00.s1562.r01.tcat+tlrc
++ 3dmerge: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
++ default -1dindex = 0
++ default -1tindex = 1
– Wrote edited dataset: ./pb01.s1562.r01.blur+tlrc.BRIK
end
3dmerge -1blur_fwhm 6 -doall -prefix pb01.s1562.r02.blur pb00.s1562.r02.tcat+tlrc
++ 3dmerge: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
++ default -1dindex = 0
++ default -1tindex = 1
– Wrote edited dataset: ./pb01.s1562.r02.blur+tlrc.BRIK
end
3dmerge -1blur_fwhm 6 -doall -prefix pb01.s1562.r03.blur pb00.s1562.r03.tcat+tlrc
++ 3dmerge: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
++ default -1dindex = 0
++ default -1tindex = 1
– Wrote edited dataset: ./pb01.s1562.r03.blur+tlrc.BRIK
end
foreach run ( 01 02 03 )
3dAutomask -prefix rm.mask_r01 pb01.s1562.r01.blur+tlrc
++ 3dAutomask: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
++ Authored by: Emperor Zhark
++ Loading dataset pb01.s1562.r01.blur+tlrc
++ Forming automask

  • Fixed clip level = 6708.465820
  • Used gradual clip level = 6566.184570 … 6937.206543
  • Number voxels above clip level = 67566
  • Clustering voxels …
  • Largest cluster has 67290 voxels
  • Clustering voxels …
  • Largest cluster has 67260 voxels
  • Filled 85 voxels in small holes; now have 67345 voxels
  • Filled 1 voxels in large holes; now have 67346 voxels
  • Clustering voxels …
  • Largest cluster has 67346 voxels
  • Clustering non-brain voxels …
  • Clustering voxels …
  • Largest cluster has 257979 voxels
  • Mask now has 67346 voxels
    ++ 67346 voxels in the mask [out of 325325: 20.70%]
    ++ first 9 x-planes are zero [from L]
    ++ last 8 x-planes are zero [from R]
    ++ first 8 y-planes are zero [from P]
    ++ last 7 y-planes are zero [from A]
    ++ first 0 z-planes are zero [from I]
    ++ last 11 z-planes are zero [from S]
    ++ CPU time = 0.000000 sec
    end
    3dAutomask -prefix rm.mask_r02 pb01.s1562.r02.blur+tlrc
    ++ 3dAutomask: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
    ++ Authored by: Emperor Zhark
    ++ Loading dataset pb01.s1562.r02.blur+tlrc
    ++ Forming automask
  • Fixed clip level = 6706.098633
  • Used gradual clip level = 6561.835938 … 6931.929688
  • Number voxels above clip level = 67581
  • Clustering voxels …
  • Largest cluster has 67288 voxels
  • Clustering voxels …
  • Largest cluster has 67249 voxels
  • Filled 82 voxels in small holes; now have 67331 voxels
  • Filled 1 voxels in large holes; now have 67332 voxels
  • Clustering voxels …
  • Largest cluster has 67332 voxels
  • Clustering non-brain voxels …
  • Clustering voxels …
  • Largest cluster has 257993 voxels
  • Mask now has 67332 voxels
    ++ 67332 voxels in the mask [out of 325325: 20.70%]
    ++ first 9 x-planes are zero [from L]
    ++ last 8 x-planes are zero [from R]
    ++ first 9 y-planes are zero [from P]
    ++ last 7 y-planes are zero [from A]
    ++ first 0 z-planes are zero [from I]
    ++ last 11 z-planes are zero [from S]
    ++ CPU time = 0.000000 sec
    end
    3dAutomask -prefix rm.mask_r03 pb01.s1562.r03.blur+tlrc
    ++ 3dAutomask: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
    ++ Authored by: Emperor Zhark
    ++ Loading dataset pb01.s1562.r03.blur+tlrc
    ++ Forming automask
  • Fixed clip level = 6715.770508
  • Used gradual clip level = 6567.285156 … 6944.270020
  • Number voxels above clip level = 67567
  • Clustering voxels …
  • Largest cluster has 67265 voxels
  • Clustering voxels …
  • Largest cluster has 67232 voxels
  • Filled 92 voxels in small holes; now have 67324 voxels
  • Filled 1 voxels in large holes; now have 67325 voxels
  • Clustering voxels …
  • Largest cluster has 67325 voxels
  • Clustering non-brain voxels …
  • Clustering voxels …
  • Largest cluster has 258000 voxels
  • Mask now has 67325 voxels
    ++ 67325 voxels in the mask [out of 325325: 20.69%]
    ++ first 9 x-planes are zero [from L]
    ++ last 8 x-planes are zero [from R]
    ++ first 9 y-planes are zero [from P]
    ++ last 7 y-planes are zero [from A]
    ++ first 0 z-planes are zero [from I]
    ++ last 11 z-planes are zero [from S]
    ++ CPU time = 0.000000 sec
    end
    3dmask_tool -inputs rm.mask_r01+tlrc.HEAD rm.mask_r02+tlrc.HEAD rm.mask_r03+tlrc.HEAD -union -prefix full_mask.s1562
    ++ processing 3 input dataset(s), NN=2…
    ++ padding all datasets by 0 (for dilations)
    ++ frac 0 over 3 volumes gives min count 0
    ++ voxel limits: 0 clipped, 67713 survived, 257612 were zero
    ++ writing result full_mask.s1562…
    foreach run ( 01 02 03 )
    3dTstat -prefix rm.mean_r01 pb01.s1562.r01.blur+tlrc
    ++ 3dTstat: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
    ++ Authored by: KR Hammett & RW Cox
    ++ Output dataset ./rm.mean_r01+tlrc.BRIK
    3dcalc -a pb01.s1562.r01.blur+tlrc -b rm.mean_r01+tlrc -expr min(200, a/b*100)*step(a)step(b) -prefix pb02.s1562.r01.scale
    ++ 3dcalc: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
    ++ Authored by: A cast of thousands
    ++ Output dataset ./pb02.s1562.r01.scale+tlrc.BRIK
    end
    3dTstat -prefix rm.mean_r02 pb01.s1562.r02.blur+tlrc
    ++ 3dTstat: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
    ++ Authored by: KR Hammett & RW Cox
    ++ Output dataset ./rm.mean_r02+tlrc.BRIK
    3dcalc -a pb01.s1562.r02.blur+tlrc -b rm.mean_r02+tlrc -expr min(200, a/b
    100)*step(a)step(b) -prefix pb02.s1562.r02.scale
    ++ 3dcalc: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
    ++ Authored by: A cast of thousands
    ++ Output dataset ./pb02.s1562.r02.scale+tlrc.BRIK
    end
    3dTstat -prefix rm.mean_r03 pb01.s1562.r03.blur+tlrc
    ++ 3dTstat: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
    ++ Authored by: KR Hammett & RW Cox
    ++ Output dataset ./rm.mean_r03+tlrc.BRIK
    3dcalc -a pb01.s1562.r03.blur+tlrc -b rm.mean_r03+tlrc -expr min(200, a/b
    100)*step(a)*step(b) -prefix pb02.s1562.r03.scale
    ++ 3dcalc: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
    ++ Authored by: A cast of thousands
    ++ Output dataset ./pb02.s1562.r03.scale+tlrc.BRIK
    end
    1d_tool.py -infile sub-s1562_task-seat_allruns_motion.1D -set_nruns 3 -demean -write motion_demean.1D
    1d_tool.py -infile sub-s1562_task-seat_allruns_motion.1D -set_nruns 3 -derivative -demean -write motion_deriv.1D
    1d_tool.py -infile motion_demean.1D -set_nruns 3 -split_into_pad_runs mot_demean
    3dDeconvolve -input pb02.s1562.r01.scale+tlrc.HEAD pb02.s1562.r02.scale+tlrc.HEAD pb02.s1562.r03.scale+tlrc.HEAD -ortvec stimuli/sub-s1562_task-seat_allruns_aCompCor6.1D aCompcor6 -ortvec stimuli/sub-s1562_task-seat_allruns_cosine.1D cosine -ortvec stimuli/sub-s1562_task-seat_allruns_fd.1D fd -ortvec mot_demean.r01.1D mot_demean_r01 -ortvec mot_demean.r02.1D mot_demean_r02 -ortvec mot_demean.r03.1D mot_demean_r03 -polort 2 -float -num_stimts 14 -stim_times_AM1 1 stimuli/offset_class_agg.1D dmBLOCK(1) -stim_label 1 Class -stim_times_AM1 2 stimuli/offset_Mean_anticipation_agg.1D dmBLOCK(1) -stim_label 2 Ant.Mean -stim_times_AM1 3 stimuli/offset_Mean_feedback_agg.1D dmBLOCK(1) -stim_label 3 FB.Mean -stim_times_AM1 4 stimuli/offset_Mean_response_agg.1D dmBLOCK(1) -stim_label 4 Resp.Mean -stim_times_AM1 5 stimuli/offset_Nice_anticipation_agg.1D dmBLOCK(1) -stim_label 5 Ant.Nice -stim_times_AM1 6 stimuli/offset_Nice_feedback_agg.1D dmBLOCK(1) -stim_label 6 FB.Nice -stim_times_AM1 7 stimuli/offset_Nice_response_agg.1D dmBLOCK(1) -stim_label 7 Resp.Nice -stim_times_AM1 8 stimuli/offset_UnpMean_anticipation_agg.1D dmBLOCK(1) -stim_label 8 Ant.UnpMean -stim_times_AM1 9 stimuli/offset_UnpMean_feedback_agg.1D dmBLOCK(1) -stim_label 9 FB.UnpMean -stim_times_AM1 10 stimuli/offset_UnpMean_response_agg.1D dmBLOCK(1) -stim_label 10 Resp.UnpMean -stim_times_AM1 11 stimuli/offset_UnpNice_anticipation_agg.1D dmBLOCK(1) -stim_label 11 Ant.UnpNice -stim_times_AM1 12 stimuli/offset_UnpNice_feedback_agg.1D dmBLOCK(1) -stim_label 12 FB.UnpNice -stim_times_AM1 13 stimuli/offset_UnpNice_response_agg.1D dmBLOCK(1) -stim_label 13 Resp.UnpNice -stim_times_AM1 14 stimuli/offset_missing_agg.1D dmBLOCK(1) -stim_label 14 Missing -num_glt 14 -gltsym SYM: +Ant.Mean[1] +FB.Mean[1] +Resp.Mean[1] +Ant.Nice[1]
    +FB.Nice[1] +Resp.Nice[1] +Ant.UnpMean[1] +FB.UnpMean[1] +Resp.UnpMean[1]
    +Ant.UnpNice[1] +FB.UnpNice[1] +Resp.Nice[1] -glt_label 1 Task.V.BL -gltsym SYM: +Ant.Mean[1] +Ant.Nice[1] +Ant.UnpMean[1] +Ant.UnpNice[1] -glt_label 2 Ant.V.BL -gltsym SYM: +Ant.Mean[1] -Ant.Nice[1] -glt_label 3 Ant.Mean.V.Nice -gltsym SYM: +Ant.Mean[1] +Ant.Nice[1] -Ant.UnpMean[1] -Ant.UnpNice[1] -glt_label 4 Ant.Pred.V.Unp -gltsym SYM: +FB.Mean[1] +FB.Nice[1] +FB.UnpMean[1] +FB.UnpNice[1] -glt_label 5 FB.V.BL -gltsym SYM: +FB.Mean[1] +FB.UnpMean[1] -FB.Nice[1] -FB.UnpNice[1] -glt_label 6 FB.Mean.V.Nice -gltsym SYM: +FB.Mean[1] -FB.UnpMean[1] -glt_label 7 FB.Mean.V.UnpMean -gltsym SYM: +FB.Nice[1] -FB.UnpNice[1] -glt_label 8 FB.Nice.V.UnpNice -gltsym SYM: +FB.Mean[1] +FB.Nice[1] -FB.UnpMean[1] -FB.UnpNice[1] -glt_label 9 FB.Pred.V.Unp -gltsym SYM: +Resp.Mean[1] +Resp.Nice[1] +Resp.UnpMean[1]
    +Resp.UnpNice[1] -glt_label 10 Resp.V.BL -gltsym SYM: +Resp.Mean[1] -Resp.Nice[1] -glt_label 11 Resp.Mean.V.Nice -gltsym SYM: +Resp.Mean[1] -Resp.UnpMean[1] -glt_label 12 Resp.Mean.V.UnpMean -gltsym SYM: +Resp.Nice[1] -Resp.UnpNice[1] -glt_label 13 Resp.Nice.V.UnpNice -gltsym SYM: +Resp.Mean[1] +Resp.Nice[1] -Resp.UnpMean[1]
    -Resp.UnpNice[1] -glt_label 14 Resp.Pred.V.Unp -cbucket cbucket.stats.s1562 -jobs 30 -fout -tout -x1D X.xmat.1D -xjpeg X.jpg -fitts fitts.s1562 -errts errts.s1562 -bucket stats.s1562
    *+ WARNING: ‘-stim_times_AM1 1’ didn’t read any good times from file ‘stimuli/offset_class_agg.1D’
    ++ ‘-stim_times_AM1 1 stimuli/offset_class_agg.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 ‘stimuli/offset_class_agg.1D’
    ++ ‘-stim_times_AM1 2 stimuli/offset_Mean_anticipation_agg.1D’ has 2 auxiliary values per time point
    ++ ‘-stim_times_AM1 2’: basis function model ‘dmBLOCK(1)’ uses 1 parameters,
    out of the 2 found in timing file ‘stimuli/offset_Mean_anticipation_agg.1D’
    ++ ‘-stim_times_AM1 3 stimuli/offset_Mean_feedback_agg.1D’ has 2 auxiliary values per time point
    ++ ‘-stim_times_AM1 3’: basis function model ‘dmBLOCK(1)’ uses 1 parameters,
    out of the 2 found in timing file ‘stimuli/offset_Mean_feedback_agg.1D’
    ++ ‘-stim_times_AM1 4 stimuli/offset_Mean_response_agg.1D’ has 2 auxiliary values per time point
    ++ ‘-stim_times_AM1 4’: basis function model ‘dmBLOCK(1)’ uses 1 parameters,
    out of the 2 found in timing file ‘stimuli/offset_Mean_response_agg.1D’
    ++ ‘-stim_times_AM1 5 stimuli/offset_Nice_anticipation_agg.1D’ has 2 auxiliary values per time point
    ++ ‘-stim_times_AM1 5’: basis function model ‘dmBLOCK(1)’ uses 1 parameters,
    out of the 2 found in timing file ‘stimuli/offset_Nice_anticipation_agg.1D’
    ++ ‘-stim_times_AM1 6 stimuli/offset_Nice_feedback_agg.1D’ has 2 auxiliary values per time point
    ++ ‘-stim_times_AM1 6’: basis function model ‘dmBLOCK(1)’ uses 1 parameters,
    out of the 2 found in timing file ‘stimuli/offset_Nice_feedback_agg.1D’
    ++ ‘-stim_times_AM1 7 stimuli/offset_Nice_response_agg.1D’ has 2 auxiliary values per time point
    ++ ‘-stim_times_AM1 7’: basis function model ‘dmBLOCK(1)’ uses 1 parameters,
    out of the 2 found in timing file ‘stimuli/offset_Nice_response_agg.1D’
    ++ ‘-stim_times_AM1 8 stimuli/offset_UnpMean_anticipation_agg.1D’ has 2 auxiliary values per time point
    ++ ‘-stim_times_AM1 8’: basis function model ‘dmBLOCK(1)’ uses 1 parameters,
    out of the 2 found in timing file ‘stimuli/offset_UnpMean_anticipation_agg.1D’
    ++ ‘-stim_times_AM1 9 stimuli/offset_UnpMean_feedback_agg.1D’ has 2 auxiliary values per time point
    ++ ‘-stim_times_AM1 9’: basis function model ‘dmBLOCK(1)’ uses 1 parameters,
    out of the 2 found in timing file ‘stimuli/offset_UnpMean_feedback_agg.1D’
    ++ ‘-stim_times_AM1 10 stimuli/offset_UnpMean_response_agg.1D’ has 2 auxiliary values per time point
    ++ ‘-stim_times_AM1 10’: basis function model ‘dmBLOCK(1)’ uses 1 parameters,
    out of the 2 found in timing file ‘stimuli/offset_UnpMean_response_agg.1D’
    ++ ‘-stim_times_AM1 11 stimuli/offset_UnpNice_anticipation_agg.1D’ has 2 auxiliary values per time point
    ++ ‘-stim_times_AM1 11’: basis function model ‘dmBLOCK(1)’ uses 1 parameters,
    out of the 2 found in timing file ‘stimuli/offset_UnpNice_anticipation_agg.1D’
    ++ ‘-stim_times_AM1 12 stimuli/offset_UnpNice_feedback_agg.1D’ has 2 auxiliary values per time point
    ++ ‘-stim_times_AM1 12’: basis function model ‘dmBLOCK(1)’ uses 1 parameters,
    out of the 2 found in timing file ‘stimuli/offset_UnpNice_feedback_agg.1D’
    ++ ‘-stim_times_AM1 13 stimuli/offset_UnpNice_response_agg.1D’ has 2 auxiliary values per time point
    ++ ‘-stim_times_AM1 13’: basis function model ‘dmBLOCK(1)’ uses 1 parameters,
    out of the 2 found in timing file ‘stimuli/offset_UnpNice_response_agg.1D’
    ++ ‘-stim_times_AM1 14 stimuli/offset_missing_agg.1D’ has 1 auxiliary values per time point
    ++ ‘-stim_times_AM1 14’: basis function model ‘dmBLOCK(1)’ uses 1 parameters,
    out of the 1 found in timing file ‘stimuli/offset_missing_agg.1D’
    ++ 3dDeconvolve extending num_stimts from 14 to 42 due to -ortvec
    ++ 3dDeconvolve: AFNI version=AFNI_22.1.10 (May 20 2022) [64-bit]
    ++ Authored by: B. Douglas Ward, et al.
    ++ loading dataset pb02.s1562.r01.scale+tlrc.HEAD pb02.s1562.r02.scale+tlrc.HEAD pb02.s1562.r03.scale+tlrc.HEAD
    ++ Auto-catenated input datasets treated as multiple imaging runs
    ++ Auto-catenated datasets start at: 0 167 334
    ++ STAT automask has 312819 voxels (out of 325325 = 96.2%)
    ++ Skipping check for initial transients
    ++ Input polort=2; Longest run=292.2 s; Recommended minimum polort=2 ++ OK ++
    ++ -stim_times using TR=1.75 s for stimulus timing conversion
    ++ -stim_times using TR=1.75 s for any -iresp output datasets
    ++ [you can alter the -iresp TR via the -TR_times option]
    ++ ** -stim_times NOTE ** guessing GLOBAL times if 1 time per line; LOCAL otherwise
    ++ ** GUESSED ** -stim_times_AM1 1 using GLOBAL times
    *+ WARNING: ‘-stim_times_AM1 1’ (GLOBAL) has 3 times outside range 0 … 875 [PSFB syndrome]
  • dataset TR being used is 1.75 s – unusable times follow
    -0.82 -0.82 -0.815
    *+ WARNING: ‘-stim_times_AM1 1’ (GLOBAL) has 3 runs and 3 early events; do you want LOCAL times?
    *+ WARNING: !! ‘-stim_times_AM1 1’ file ‘stimuli/offset_class_agg.1D’ has no good stimulus time values
    ++ ** GUESSED ** -stim_times_AM1 2 using LOCAL times
    ++ ‘-stim_times_AM1 2’ average amplitude#1=4.83333
    ++ ** GUESSED ** -stim_times_AM1 3 using LOCAL times
    ++ ‘-stim_times_AM1 3’ average amplitude#1=4.83333
    ++ ** GUESSED ** -stim_times_AM1 4 using LOCAL times
    ++ ‘-stim_times_AM1 4’ average amplitude#1=4.83333
    ++ ** GUESSED ** -stim_times_AM1 5 using LOCAL times
    ++ ‘-stim_times_AM1 5’ average amplitude#1=1.17391
    ++ ** GUESSED ** -stim_times_AM1 6 using LOCAL times
    ++ ‘-stim_times_AM1 6’ average amplitude#1=1.17391
    ++ ** GUESSED ** -stim_times_AM1 7 using LOCAL times
    ++ ‘-stim_times_AM1 7’ average amplitude#1=1.17391
    ++ ** GUESSED ** -stim_times_AM1 8 using LOCAL times
    ++ ‘-stim_times_AM1 8’ average amplitude#1=4.7
    ++ ** GUESSED ** -stim_times_AM1 9 using LOCAL times
    ++ ‘-stim_times_AM1 9’ average amplitude#1=4.7
    ++ ** GUESSED ** -stim_times_AM1 10 using LOCAL times
    ++ ‘-stim_times_AM1 10’ average amplitude#1=4.7
    ++ ** GUESSED ** -stim_times_AM1 11 using LOCAL times
    ++ ‘-stim_times_AM1 11’ average amplitude#1=1.33333
    ++ ** GUESSED ** -stim_times_AM1 12 using LOCAL times
    ++ ‘-stim_times_AM1 12’ average amplitude#1=1.33333
    ++ ** GUESSED ** -stim_times_AM1 13 using LOCAL times
    ++ ‘-stim_times_AM1 13’ average amplitude#1=1.33333
    ++ ** GUESSED ** -stim_times_AM1 14 using LOCAL times
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ** ERROR: selector index 1 is out of range 0…0
    ++ Number of time points: 501 (no censoring)
  • Number of parameters: 51 [37 baseline ; 14 signal]
    ++ total shared memory needed = 1,510,809,300 bytes (about 1.5 billion)
    ++ mmap() memory allocated: 1,510,809,300 bytes (about 1.5 billion)
    ++ Memory required for output bricks = 1,510,809,300 bytes (about 1.5 billion)
    ++ Wrote matrix image to file X.jpg
    ++ Wrote matrix values to file X.xmat.1D
    ++ ========= Things you can do with the matrix file =========
    ++ (a) Linear regression with ARMA(1,1) modeling of serial correlation:

3dREMLfit -matrix X.xmat.1D
-input “pb02.s1562.r01.scale+tlrc.HEAD pb02.s1562.r02.scale+tlrc.HEAD pb02.s1562.r03.scale+tlrc.HEAD”
-Rbeta cbucket.stats.s1562_REML -fout -tout
-Rbuck stats.s1562_REML -Rvar stats.s1562_REMLvar
-Rfitts fitts.s1562_REML -Rerrts errts.s1562_REML -verb

++ N.B.: 3dREMLfit command above written to file stats.REML_cmd
++ (b) Visualization/analysis of the matrix via ExamineXmat.R
++ (c) Synthesis of sub-model datasets using 3dSynthesize
++ ==========================================================
*+ WARNING: -------------------------------------------------
*+ WARNING: Problems with the X matrix columns, listed below:
*+ WARNING: !! * Column 9 [Class#0] is all zeros
*+ WARNING: -------------------------------------------------
++ ----- Signal+Baseline matrix condition [X] (501x51): 9.92415 ++ VERY GOOD ++
*+ WARNING: !! in Signal+Baseline matrix:

  • Largest singular value=2.50049
  • 1 singular value is less than cutoff=2.50049e-07
  • Implies strong collinearity in the matrix columns!
    ++ Signal+Baseline matrix singular values:
    0 0.0253885 0.128598 0.151882 0.211466
    0.22749 0.234306 0.261982 0.285499 0.310245
    0.335758 0.350405 0.360276 0.366475 0.374521
    0.390237 0.433172 0.47747 0.497689 0.555097
    0.599489 0.637913 0.669912 0.704474 0.746848
    0.783447 0.801076 0.820244 0.840997 0.847241
    0.877699 0.949127 0.97059 0.999486 1.00646
    1.02078 1.06083 1.08016 1.09913 1.15742
    1.23871 1.28252 1.3154 1.44887 1.5474
    1.58601 1.61843 1.74696 1.85904 2.09059
    2.50049
    ++ ----- Signal-only matrix condition [X] (501x14): 2.01313 ++ VERY GOOD ++
    *+ WARNING: !! in Signal-only matrix:
  • Largest singular value=1.50129
  • 1 singular value is less than cutoff=1.50129e-07
  • Implies strong collinearity in the matrix columns!
    ++ Signal-only matrix singular values:
    0 0.370443 0.371494 0.380213 0.402958
    0.779105 0.835917 0.846634 0.854421 1.00465
    1.45674 1.45911 1.46661 1.50129
    ++ ----- Baseline-only matrix condition [X] (501x37): 9.38201 ++ VERY GOOD ++
    ++ ----- stim_base-only matrix condition [X] (501x28): 4.02162 ++ VERY GOOD ++
    ++ ----- polort-only matrix condition [X] (501x9): 1 ++ VERY GOOD ++
    ++ +++++ Matrix inverse average error = 0.000384468 ++ OK ++
    ++ Matrix setup time = 1.55 s
    ** ERROR: !! 3dDeconvolve: Can’t run past 4 matrix warnings without ‘-GOFORIT 4’
    ** ERROR: !! Currently at -GOFORIT 0
    ** ERROR: !! See file 3dDeconvolve.err for all WARNING and ERROR messages !!
    ** ERROR: !! Be sure you understand what you are doing before using -GOFORIT !!
    ** ERROR: !! If in doubt, consult with someone or with the AFNI message board !!
    ** FATAL ERROR: !! 3dDeconvolve (regretfully) shuts itself down !!
    ** Program compile date = May 20 2022
    cla19097:/data/projects/STUDIES/SEAT/fMRI/code/afni/Aim1>

What does the first bit of class_agg.1D and Mean_anticipation_agg.1D look like?

Negative event times should not be counted. This seems to be something else.
You are welcome to send me the timing files via email, too.

  • rick

Thank you so much! Please let me know what would be easiest for you. Happy to send in an email.

Here are those files:

class_agg.1D (not offset)

0.011:5
0.011:5
0.016:5

Mean_anticipation_agg.1D (not offset)

43.7115:3.017 56.2785:3.017 67.8455:3.016 164.8785:3.017 177.9455:3.016 200.5785:3.017 223.2115:3.017 257.9115:3.017
56.2445:3.017 102.5114:3.017 116.0775:3.017 129.1445:3.017 153.2775:3.017 177.9115:3.016 223.1775:3.017 257.8775:3.017
10.4665:3.016 79.8665:3.016 91.9325:3.017 102.4995:3.017 164.8325:3.017 223.1654:3.017 236.7324:3.017 247.7994:3.016

So if all of the class_agg times go negative, then indeed, it will not read any good times from that file, which will lead to an all-zero regressor and various warnings. Those will force you to supply a -GOFORIT level (of at least 4 in this case).

But that is okay.

The bigger question is regarding the other classes, such as Mean_anticipation_agg. The timing file for that class shows both an amplitude modulator and a duration modulator. Do you intend on that? It is okay, but then the stim type would be AM2 rather than AM1. It looks like that applies to most of the classes.

Is AM2 what you want (i.e. do you want an amplitude modulation regressor)?

  • rick

Hi Rick,

Thanks so much! Good to hear that a GOFORIT 4 is acceptable in this case.

Yes! I’m trying to do parametric (amplitude) modulation (with onsetbehavior:duration). I would be ok using just the amplitude modulator (onsetbehavior) and providing the duration in a BLOCK(1,duration) function if that’s recommended (and in that case I would use AM1 correct, since I’d only have the onset*behavior modulator)? Currently, I’m using dmBLOCK(1).

Thank you again so much!

Sorry, I’d have BLOCK(duration,1) I flipped them

Hi Megan,

If the durations vary, dmBLOCK (or dmUBLOCK) is good.

But any time there is an amplitude modulator (behavior in this case), you probably want AM2. So use of AM2 with behavior is a separate question from dmBLOCK vs BLOCK. AM1 does not seem to be a real option here.

Does that seem reasonable?

  • rick

It does thank you!