fmriprep to

Hello experts,
I have preprocessed my data using fmriprep. However, for first and second level processing I would like to use AFNI. (I have historically used SPM, but am switching to AFNI for a number of reasons, namely flexibility of second level models, ability to see the data, cluster algorithms for multiple comparisons - so I am relatively new to AFNI.) I am wondering if it is possible to use with data that have been preprocessed in fmriprep. How would one specify the minimally preprocessed files here, as well as the regressors for first-level analysis? Another option that I have been considering is implementing an afni processing pipeline using nipype, since something similar has been published using fsl (by Esteban et al. 2019). Your input is much appreciated. Thanks!

Can you be a little more specific about what processing you have done with FMRI-prep, and what you would like to do with AFNI?

And what kind of data do you have—resting state, naturalistic or task-based?

I believe FMRI-prep covers a subset of what would typically be done with, for example not including what would be contained in the “regress” block. Typically as runs, it generates items for use in the regress block, so I guess you would want to specify what equivalents there are, again depending on what you want to calculate.


I apologize for being rather vague! This would be for a task-based analysis. fmriprep yields preprocessed files along with a .tsv file of nuisance regressors. Ideally, I would like to implement something like Example 6b, but starting after blur:                                                \
             -subj_id FT.e6b                                          \
             -copy_anat Qwarp/anat_warped/anatSS.FT.nii               \
             -anat_has_skull no                                       \
             -anat_follower anat_w_skull anat FT/FT_anat+orig         \
             -dsets FT/FT_epi_r?+orig.HEAD                            \
             -blocks tshift align tlrc volreg blur mask scale regress \
             -radial_correlate_blocks tcat volreg                     \
             -tcat_remove_first_trs 2                                 \
             -align_opts_aea -cost lpc+ZZ -giant_move -check_flip     \
             -tlrc_base MNI152_2009_template_SSW.nii.gz               \
             -tlrc_NL_warp                                            \
             -tlrc_NL_warped_dsets Qwarp/anat_warped/anatQQ.FT.nii    \
                 Qwarp/anat_warped/anatQQ.FT.aff12.1D                 \
                 Qwarp/anat_warped/anatQQ.FT_WARP.nii                 \
             -volreg_align_to MIN_OUTLIER                             \
             -volreg_align_e2a                                        \
             -volreg_tlrc_warp                                        \
             -mask_epi_anat yes                                       \
             -blur_size 4.0                                           \
             -regress_stim_times FT/AV1_vis.txt FT/AV2_aud.txt        \
             -regress_stim_labels vis aud                             \
             -regress_basis 'BLOCK(20,1)'                             \
             -regress_opts_3dD -jobs 2 -gltsym 'SYM: vis -aud'        \
                 -glt_label 1 V-A                                     \
             -regress_motion_per_run                                  \
             -regress_censor_motion 0.3                               \
             -regress_censor_outliers 0.05                            \
             -regress_3dD_stop                                        \
             -regress_reml_exec                                       \
             -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                              \

I have already implemented post-fmriprep first-level analysis using 3DDeconvolve (somewhat) through nipype, using the ortvec option to adjust for a subset of regressors from the .tsv file. But I think that it may be better to use if I am using AFNI, for a number of reasons. I guess my more precise question is: Is there a way to directly imput the preprocessed file and “ortvec” option into the -regress line of task-based analysis? Thank you!!

Sure! You can tell afni_proc to just do the mask and regress steps and then feed it the motion file (that you’ll have to modify from fMRIprep).

Here’s a related tutorial about running afni_proc to do different analysis pipelines for just regression that may be helpful. I can type it out more if it’s not clear.

Thank you! I have been able to get my post-fmriprep processing pipeline to work well. However, now I have a related question. I am using 3Dclusterize to list clusters over a certain threshold, and I would like to list them in MNI space. I have read on another thread (,161972,161980) that 3dclusterize is supposed to know whether your data are in MNI or Talairach space. Because I did first and second level processing in AFNI, my data files have the suffix _tlrc, but they were registered by fmriprep in MNI space. 3Dclusterize is printing out Talairach space coordinates. Is there a way for me to directly tell 3dclusterize that these data are actually in MNI space? Thanks in advance for your help!


3dClusterize doesn’t really know/care about the space of the dsets: it will just make clusters in the space of the input dset, and output them in the same space.

In AFNI BRIK/HEAD files, there is the “afni view” part of the extension: +orig, +tlrc, … and a couple others. This is definitely confusing, but the “+tlrc” doesn’t literally mean Talairach-Tournoux coordinates specifically-- it just means “a standard space”. So, even if you have data aligned to MNI space, those dset extensions will include “+tlrc”. (This goes back to the eeeearly days when there was just TT as the standard space-- but now standard spaces have greatly proliferated.) This AFNI view somewhat mirrors the NIFTI_XFORM_* encodings.


Can you tell me how to modify fMRIPrep motion files to be readable by

I think it makes more sense to continue this discussion in this new thread, which you started for this question (and here is one initial reply):,166304,166307#msg-166307