Rotating bvecs after correction for susceptibility-induced distortions using T1

Dear MRtrix users

does anybody know a good way to rotate bvecs after correcting for susceptibility-induced distortions in DWI data based on a T1 image?

I have used this script ( to correct these distortions. However, rotating does not work (based on a FSL-format affine transform matrix).

The script refers to a subscript:

line 95-97

#apply affine reg to bvec
/opt/HCPpipelines/global/scripts/ dwi_corrected.bvec
${nm}0GenericAffine_fsl.txt $outdir/dwi.bvecs

which applies the transformation matrix of the DWI to t1 registration to bvecs. It is unclear to me which subscript was used. I tried to use the rotate_bvecs script of the HCPpipeline


however the output consisted entirely of zeros.

I have tried to find an answer in the mailing list, however, was not succesful. Any help would be greatly appreciated. Thank you very much

In MRtrix3 we try to deal with such manipulations intrinsically: by embedding the diffusion gradient table in the image header, any rotation applied to image data will automatically be applied to the gradient table as well, without having to rely on the explicit instantiation of such scripts.

So my suggestion would be: after the ANTs call, convert the estimated transformation to MRtrix3 format, and apply it to a .mif image that has the diffusion gradient table in the image header.