Conversion of AFNI warp files into ants-friendly format

Hello,

I was looking into the way in which fmriprep deals with afni warp files to convert them into an ants-friendly file, in particular from the fmriprep.workflows.fieldmap.pepolar workflow

It seems to me that you have incorporated this by running

  1. the function _fix_hdr on the warp output of 3dQwarp
  2. copying the header of the warped input to 3dQwarp to the output warp using CopyHeader (from niworkflows utils.py)
  3. running antsApplyTransforms using this modified warp file

Is this correct?

I appreciate that helping me with this is out the scope of fmriprep, but what I am trying to do is just to incorporate distortion correction (using ANTS’s unWarpEPI.py) into my ASL analysis script (which uses ants for all registrations). So I thought that borrowing your expertise on this subject would be faster moving part of my preprocessing to fmriprep…

Many thanks,

Marcello

I’m guessing you mean AFNI’s unWarpEPI.py. Dealing with affine transformations is tricky, and @oesteban might be able to help. He has been looking at this recently, though possibly not with ANTs. The nonlinear warp deformations might be easier. You could try directly with the concatenated transformation of affine and warps or the inverse transformation with either 3dWarpCat or 3dWarpCalc in AFNI.