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.