Adding a field map for rs-fMRI distortion correction

Hi there!

I’ve been using the same lovely AFNI pipeline to pre-process the various datasets that I’m working on.

We’ve recently started a new study where we’ll be collecting field maps in the hope of doing distortion correction and improving the quality of our data.
I was wondering how exactly I could integrate field maps into the pipeline without breaking something.

The command(s) I’m using to generate the script is as follows:
module load afni/21.1.07
module load anaconda/3.8
module load tedana/0.0.11 -blocks despike tshift align tlrc volreg mask combine blur scale regress -copy_anat t1.nii.gz -anat_has_skull yes -dsets_me_echo fmri_e1.nii.gz -dsets_me_echo fmri_e2.nii.gz -dsets_me_echo fmri_e3.nii.gz -dsets_me_echo fmri_e4.nii.gz -echo_times 12.9 28.9 44.9 60.9 -reg_echo 2 -tcat_remove_first_trs 10 -align_opts_aea -cost nmi -check_flip -skullstrip_opts -push_to_edge -tlrc_base MNI152_T1_2009c+tlrc -tlrc_NL_warp -volreg_align_to MIN_OUTLIER -volreg_align_e2a -volreg_tlrc_warp -mask_epi_anat yes -mask_segment_anat yes -mask_segment_erode yes -combine_method tedana -blur_size 6 -blur_in_mask yes -regress_bandpass 0.01 0.1 -regress_ROI WMe CSF -regress_motion_per_run -regress_censor_motion 3.0 -regress_censor_outliers 0.05 -regress_apply_mot_types demean deriv -regress_est_blur_epits -html_review_style pythonic

In the combine block code, I remove the tedana wrapper bit and add this instead:
tedana -d pb03.SUBJ.r01.e01.volreg+tlrc.BRIK
-e 12.9 28.9 44.9 60.9 --mask mask_epi_anat.SUBJ+tlrc.BRIK --debug

Finally, I change the 3dcopy bit to:
3dcopy desc-optcomDenoised_bold.nii.gz pb04.$subj.r$run.combine+orig

I’ve got a field map (in radians), which has been unwrapped. seems like the thing I should be using but is the thing that is used in the blip block.
I’m not exactly sure how to go about things, so any tips would be highly appreciated!

Looking forward to your reply!

Best Wishes,

Hi Misho,

Well, I have good news and bad news.

The good news is that you can use tedana directly in (without the wrapper) by applying it as the “m_tedana” combine method. Give that a try, and compare it with a previous result.

The bad news is that I have not gotten around to applying properly in (it almost happened a few years back). Paul and I were pondering some of the details, but then other things came up.

From what I recall, since there are many options to consider, we thought it might be easiest (at least initially) to have the user run to generate a distortion correction matrix, and then pass it to, which could then be applied akin to using the blip results. But still, I have not done it.

We could revisit that if you are in a situation to apply it…

  • rick

Hi Rick,

Thanks for getting back to me so promptly!

I didn’t know about the m_tedana option, it would be quite useful. :slight_smile:

Re: the field map:
When is the ‘best time’ to apply the distortion correction? After temporal (despike and tshift) and before structural (align etc.) steps or could it be done right at the start?
If the latter is ok to do, I could apply the correction and then simply run the pre-processing script as usual?
If the former way is the correct one, however, how could I use the matrix (which I assume is the ‘+ text file of params :’ that is mentioned in the output section) in a blip block?

By the way, here is my pre-processing script:


Hi again Rick,

Just wanted to check if you’ve managed to come up with something. :smiley: