Topup: phase-encode directions are F-H and H-F

Dear experts

I’m experiencing an error with dwipreproc(topup) when the phase encoding directions are H-F and F-H. The error is:

Exception thrown with message: Topup: msg=TopupScan::TopupScan: third element of pevec must be zero

What should I do ?

Thank you !
Liyuan

Hi Liyuan,

The topup / eddy combo makes the assumption that the third axis corresponds to slices, particularly now with eddy's slice-to-volume motion correction. Therefore phase encoding can’t possibly occur along that axis.

What needs to be done is to permute the image axes so that the direction in which phase encoding was applied appears as one of the first two axes, perform the distortion correction, and then permute the axes back to their original order. This can be done using the -axes option in mrconvert.

I did make an attempt at doing so seamlessly within dwipreproc, but IIRC I got too frustrated because that script is a nightmare. So you’re stuck doing it on your own :sweat_smile:

Rob

Thanks! I got it :grinning:

Hello Liyuan, I’m having the same trouble - would you mind sharing your solution please?

Welcome @yueyuan!

Solution will be something like:

  1. Switch second and third axes, so that phase encoding occurs along the second axis:
    mrconvert DWI.mif -axes 0,2,1,3 DWI_permuted.mif

  2. Run dwifslpreproc:
    dwifslpreproc DWI_permuted.mif DWI_permuted_preproc.mif ...

  3. Switch second and thrid axes back:
    mrconvert DWI_permuted_preproc.mif -axes 0,2,1,3 DWI_preproc.mif
    ``mrconvert DWI.mif -axes 0,2,1,3 DWI_permuted.mif`

However you will not want to apply this blindly, there’s quite a few things that could go wrong (hence why the prospect of modifying dwifslpreproc to do this internally is such a challenge). See for example documentation pages here and here.

Cheers
Rob