unWarpEPI and realignment

I've recently started using unWarpEPI and wanted to check whether realignment is implemented within the function? I see in the source code there is mention of 3dAllineate. Or have I misunderstood and EPI runs need to be realigned before conducting unwarping?

Thanks!

Howdy-

Just to check: so, you have EPIs with reverse phase encodings, and want to use this ("blip up-down") approach to reduce distortions from B0 field inhomogeneity?

And by any chance, are you aiming to incorporate these correct data into a larger FMRI processing pipeline?

If the answer to both is "yes", then I would note that you can do this probably more easily---and certainly in a preferred, reduced-blurring manner---within afni_proc.py:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/programs/alpha/afni_proc.py_sphx.html#blip-note
... and we have some other examples of including this.

Otherwise, we can look more at this with unWarpEPI.py as well.

--pt

Hey, thanks for the speedy response! Yep: we have EPI runs with AP phase, two volumes of PA phase at the end of each run, and want to do "blip up-down" unwarping. I'm just helping carry this out for collaborators who wish to do the rest of the preprocessing in SPM (despite my protestations), hence why I was using unWarpEPI.py.

I'll have a go at running unwarping in afni_proc and see how I get on.

Thanks!
Pete

Cool. Just note that one reason to do the AP-PA correction within a single pipeline designed to include it is that the warp estimated by that process can be concatenated to other EPI warps before being applied to the time series, to minimize unncessary smoothing. Each alignment process (motion correction, EPI distortion correction, EPI-anatomical alignment, and eventual/potential warping to a template) is a regridding process, which inherently interpolates data. Everytime one of those is done separately, the data gets blurred a bit. It is a far, far better thing to estimate those steps individually but to concatenate them into a single warp to be applied once to the EPI. afni_proc.py, as one example, will do this for you.

An example of including blip distortion correction in afni_proc.py (with resting state FMRI data) exists in the APMULTI demo, for processing multi-echo FMRI data; the the ME-FMRI part can be ignored and the other parts used as a basis of a starter command, too. This dataset and set of scripts can be downloaded with:

@Install_APMULTI_Demo1_rest

The first of the command examples there with blip up/down correction is in do_22*.tcsh, and looks like this (some variables are used):

afni_proc.py                                                            \
     -subj_id                  ${subj}                                  \
     -blocks despike tshift align tlrc volreg mask combine blur scale   \
         regress                                                        \
     -radial_correlate_blocks  tcat volreg regress                    \
     -copy_anat                ${anat_cp}                               \
     -anat_has_skull           no                                       \
     -anat_follower            anat_w_skull anat ${anat_skull}          \
     -anat_follower_ROI        aaseg        anat ${roi_all_2009}        \
     -anat_follower_ROI        aeseg        epi  ${roi_all_2009}        \
     -anat_follower_ROI        FSvent       epi  ${roi_FSvent}          \
     -anat_follower_ROI        FSWe         epi  ${roi_FSWe}            \
     -anat_follower_erode      FSvent FSWe                              \
     -blip_forward_dset        "${epi_forward}"                         \
     -blip_reverse_dset        "${epi_reverse}"                         \
     -dsets_me_run             ${dsets_epi_me}                          \
     -echo_times               ${me_times}                              \
     -combine_method           OC                                       \
     -tcat_remove_first_trs    ${nt_rm}                                 \
     -tshift_interp            -wsinc9                                  \
     -align_opts_aea           -cost lpc+ZZ -giant_move -check_flip     \
     -tlrc_base                ${template}                              \
     -tlrc_NL_warp                                                      \
     -tlrc_NL_warped_dsets     ${dsets_NL_warp}                         \
     -volreg_align_to          MIN_OUTLIER                              \
     -volreg_align_e2a                                                  \
     -volreg_tlrc_warp                                                  \
     -volreg_warp_final_interp  wsinc5                                  \
     -volreg_warp_dxyz         ${final_dxyz}                            \
     -volreg_compute_tsnr      yes                                      \
     -blur_size                ${blur_size}                             \
     -mask_epi_anat            yes                                      \
     -regress_motion_per_run                                            \
     -regress_ROI_PC FSvent    3                                        \
     -regress_ROI_PC_per_run   FSvent                                   \
     -regress_make_corr_vols   aeseg FSvent                             \
     -regress_anaticor_fast                                             \
     -regress_anaticor_label   FSWe                                     \
     -regress_censor_motion    ${cen_motion}                            \
     -regress_censor_outliers  ${cen_outliers}                          \
     -regress_apply_mot_types  demean deriv                             \
     -regress_est_blur_epits                                            \
     -regress_est_blur_errts                                            \
     -html_review_style        pythonic 

This could be stripped down a bit more to just a non-ME-FMRI example, and also without tissue-based regressors if you aren't using FreeSurfer, say, to:

# + removed 'combine' block and associated options (for ME-FMRI specifically)
# + input EPI dsets with '-dsets' not '-dsets_me_run'
# + removed anatomical followers (parcellations estimated by FS)
# + removed tissue-based regressors and fast anaticor (using segmentations
#   from FS)
# + left in using @SSwarper beforehand for skullstripping (SS)
#   and nonlinear alignment (warping) of anatomical to template
# + left in slice timing corr with '-tshift_interp'; could be removed

afni_proc.py                                                            \
     -subj_id                  ${subj}                                  \
     -blocks despike tshift align tlrc volreg mask blur scale   \
         regress                                                        \
     -radial_correlate_blocks  tcat volreg regress                    \
     -copy_anat                ${anat_cp}                               \
     -anat_has_skull           no                                       \
     -anat_follower            anat_w_skull anat ${anat_skull}          \
     -blip_forward_dset        "${epi_forward}"                         \
     -blip_reverse_dset        "${epi_reverse}"                         \
     -dsets                    ${dsets_epi}                             \
     -tcat_remove_first_trs    ${nt_rm}                                 \
     -tshift_interp            -wsinc9                                  \
     -align_opts_aea           -cost lpc+ZZ -giant_move -check_flip     \
     -tlrc_base                ${template}                              \
     -tlrc_NL_warp                                                      \
     -tlrc_NL_warped_dsets     ${dsets_NL_warp}                         \
     -volreg_align_to          MIN_OUTLIER                              \
     -volreg_align_e2a                                                  \
     -volreg_tlrc_warp                                                  \
     -volreg_warp_final_interp  wsinc5                                  \
     -volreg_warp_dxyz         ${final_dxyz}                            \
     -volreg_compute_tsnr      yes                                      \
     -blur_size                ${blur_size}                             \
     -mask_epi_anat            yes                                      \
     -regress_motion_per_run                                            \
     -regress_censor_motion    ${cen_motion}                            \
     -regress_censor_outliers  ${cen_outliers}                          \
     -regress_apply_mot_types  demean deriv                             \
     -regress_est_blur_epits                                            \
     -regress_est_blur_errts                                            \
     -html_review_style        pythonic 

--pt

1 Like