afni_proc.py, 3dDespike missing input

AFNI version info (afni -ver): Version AFNI_24.1.22 'Publius Septimius Geta'

Dear Sisters and Brothers in Neuroscience,

I am running a first version of my afni_proc.py and I have some issues (that are probably my fault since I'm just learning). I am getting an error that says there is no pb05(...).regress+tlrc file. Indeed there is no such file in my output directory. My script is included at the bottom.

The ERROR:

foreach run ( 01 02 )
3dDespike -NEW -nomask -prefix pb06.subject.r01.despike pb05.subject.r01.regress+tlrc
++ 3dDespike: AFNI version=AFNI_24.1.22 (Jul 8 2024) [64-bit]
++ Authored by: RW Cox
** FATAL ERROR: Can't open dataset 'pb05.subject.r01.regress+tlrc'

I will be grateful for you help.
Best,
Maria Czarnecka

afni_proc.py                                                                      \
    -scr_overwrite                                                                \
    -subj_id                  {subject}                                           \
    -blocks                   tshift align tlrc volreg mask blur                  \
                              scale regress despike                               \
    -copy_anat                ${results}/${subject}_anat_warped/anatSS.${subject}.nii     \
    -anat_has_skull           no                                                  \
    -anat_follower            anat_w_skull anat                                   \
                              ${datadir}/anat/${subject}_T1w.nii.gz               \
    -dsets                    ${datadir}/func/${subject}_task-mototopy_run-1_bold.nii.gz                \
			                  ${datadir}/func/${subject}_task-mototopy_run-2_bold.nii.gz                \
    -tshift_opts_ts           -tpattern alt+z2                                    \
    -radial_correlate_blocks  tcat volreg regress                                 \
    -align_unifize_epi        local                                               \
    -align_opts_aea           -cost lpc+ZZ                                        \
                              -check_flip                                         \
    -tlrc_base                MNI152_2009_template_SSW.nii.gz                     \
    -tlrc_NL_warp                                                                 \
    -tlrc_NL_warped_dsets     ${results}/${subject}_anat_warped/anatQQ.${subject}.nii            \
                              ${results}/${subject}_anat_warped/anatQQ.${subject}.aff12.1D       \
			                  ${results}/${subject}_anat_warped/anatQQ.${subject}_WARP.nii       \
    -volreg_align_to          MIN_OUTLIER                                         \
    -volreg_align_e2a                                                             \
    -volreg_tlrc_warp                                                             \
    -volreg_warp_dxyz         2.0                                                 \
    -volreg_compute_tsnr      yes                                                 \
    -mask_epi_anat            yes                                                 \
    -blur_size                4                                                   \
    -blur_in_mask             yes                                                 \
    -regress_stim_times       ${datadir}/func/foot_adduct.1D                 \
                              ${datadir}/func/foot_flex.1D                   \
                              ${datadir}/func/hand_adduct.1D                 \
                              ${datadir}/func/hand_flex.1D                   \
                              ${datadir}/func/move_whole_mouth.1D            \
                              ${datadir}/func/move_whole_stomach.1D          \
                              ${datadir}/func/shoulder_move.1D               \
    -regress_bandpass         0.0078 9999                                         \
    -regress_stim_labels      FOOTADD FOOTFL HANDADD HANDFL MOUTH STOM SHOULDER   \
    -regress_basis            SPMG2                                  \
    -regress_motion_per_run                                          \
    -regress_censor_motion    0.5                                    \
    -regress_censor_prev      no                                     \
    -regress_censor_outliers  0.05                                   \
    -regress_compute_fitts                                           \
    -regress_fout             no                                     \
    -regress_opts_3dD         -jobs 16                               \
                              -gltsym 'SYM: FOOTADD -HANDADD'        \
                              -glt_label 1 FA-HA                     \
    -regress_3dD_stop                                                \
    -regress_reml_exec                                               \
    -regress_apply_mot_types  demean deriv                           \
    -regress_make_ideal_sum   sum_ideal.1D                           \
    -regress_est_blur_errts                                          \
    -regress_run_clustsim     no                                     \
    -html_review_style        pythonic

Hi, Maria-

I don't think despiking should come at the end of processing; it is typically one of the first steps done.

The regress block should be the final block in processing. The output of the regress block is not another pb* dset, but things like the errts* dset (residuals), all_runs* (total output dataset of all runs) and/or fitts* (fit model dataset; fitts+errts=all_runs).

Is there a particular reason or prior example for putting despiking late in processing?

We have some papers describing afni_proc.py block and choices here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/published/citations.html#methods-fmri-processing-and-pipelines
... as well as in the Codex (Code Examples) and in the afni_proc.py help file.

--pt

There is no reason at all, we were using the example 11b from afni resources, and we were adding options that we wanted to incorporate. We didn't think about the order tbh.

I looked at the examples again, do you think this is the right order?


 -blocks                   despike tshift align tlrc volreg mask blur          \
                              scale regress                                       \

Thank you for your help.

OK, it might be worth looking at the couple of papers describing afni_proc.py usage, blocks and options for additional information. Ordering of blocks is pretty key for setting up the analysis.

We would typically have blur before mask. Also, to check: we would not include blur for an ROI-based analysis, just for voxelwise analyses. Blurring during processing for ROI-based analysis would spread out information across boundaries unfairly.

I don't think we would typically include despike with a task-based analysis, particularly if it is an event related paradigm. You wouldn't want to run the risk of "despiking" an activation spike.

So maybe this would be a good place to start on block ordering for task-based FMRI:

-blocks    tshift align tlrc volreg blur mask scale regress   \

--pt