For those who are interested in using fmriprep output as input for afni_proc

Hi

I wanted to share a code I picked up at the Afni Bootcamp! One can use fmriprep output with afni_proc to do the following analysis (My example: blur scaling and regressions). The code might throw an error when generating the QC page. But no worries, the main analysis will still wrap up just fine. The QC page is a bit tricky and might need to wait for an update in the future.

Best

#!/usr/bin/env tcsh


# set data directory
set top_dir = /media/test/afni_fmriprep/sub-LM027

# run afni_proc.py to create a single subject processing script
afni_proc.py -subj_id sub-LM027                                  \
        -blocks mask blur scale regress                          \
        -radial_correlate_blocks tcat  regress                   \
	-copy_anat $top_dir/sub-LM027_ses-T2_desc-preproc_T1w.nii.gz                     \
        -dsets                                                                           \
            $top_dir/sub-LM027_ses-T2_task-Prototype1_space-T1w_desc-preproc_bold.nii.gz \
        -blur_size 4.0                                                                   \
        -regress_motion_file                                                             \
            $top_dir/afni_sub-LM027_ses-T2_task-Prototype1_confounds.txt                 \
        -regress_stim_times                                                              \
            $top_dir/afni_sub-LM027_ses-T2_task-Prototype1_allTrials.txt                 \
        # I used the following to transform fsl-type regressor into afni-type.           \
        # timing_tool.py -fsl_timing_files input -write_timing output                    \
        -regress_stim_labels                                                             \
            allTrials                                                                    \
        -regress_basis 'BLOCK(5,1)'                              \
        -regress_censor_motion 1.0                               \
        -regress_censor_outliers 0.05                            \
        -regress_motion_per_run                                  \
        -regress_opts_3dD                                        \
            -jobs 1                                              \
            -gltsym 'SYM: allTrials ' -glt_label 1 V-A           \
        -regress_compute_fitts                                   \
        -regress_make_ideal_sum sum_ideal.1D                     \
        -regress_est_blur_epits                                  \
        -regress_est_blur_errts                                  \
        -regress_run_clustsim no                                 \
        -html_review_style pythonic                              \
        -execute

Thank you for sharing!

Curious does the error with the QC report look like the one I described in my post? Trying to figure out if I need to solve that problem or if I can keep going with my analysis and just be sad I don't get a pretty QC output.

Hi-

I'm on vacation at the moment, but will just comment briefly:

  • As the afni_proc.py proc script processes, a dictionary of useful file (inputs, intermediate files and outputs) is built up.
  • The programs that build the APQC HTML use that dictionary to know what to build. For example, knowing what dset/file defines the final space (either template, anat_final or volreg_epi reference vol).
  • The fmriprep output covers the first few processing blocks of a typical afni_proc.py run. But items from that are not part of the reference dictionary above.
    • This particular error this causes for the HTML build issue that is referenced in this post, is that the volume defining the final space isn't known for the reference dictionary.
    • The tricky thing is that it appears there could be multiple spaces to choose from at the point fmriprep finishes. So, the user would have to specify one, and the question of how best to do that remains a bit.

--pt