Questions about mrtransform and preservation of fiber orientation

Hi,

I’m looking for some help, I know this topics has been widely covered (sorry) but I didn’t find the solution to my problem.

All the data and the command used to do the plot is available here in case:

https://filesender.renater.fr/?s=download&token=edd7f071-d9bf-4370-a533-a49659373999

Using mrview (which is quite awesome) I can visualize my tensor or main fiber direction after tensor2metric (V1).
I’m doing first really basic processing with 6 directions and dwi2tensor. Everything is perfect.
I can even use the rotation tools and the orientation of the fiber/ellpipsoid si updated in the GUI.

For reproducibility reasons and due to the amount of data I need to process I’m great fan of bash (maybe soon the pipeline functionality of mrtrix).
I’m applying first as simple test a rigid transformation on the data (then I will apply the diffeomorphism).
I cannot find the good command to apply correctly the transformation on the tensor. Using the -reorient_fod yes, the yy, xz, yz images (if the mrtrix convention is [xx,yy,zz,xy,xz,yz]) looks corrupted even a tensor is not really “human readable”) and without the orientation is wrong after extraction of the vector.

(Up) Below is the initial (ground truth ) orientation.
(Middle) Then , after simple mrtransform (wrong)
(Bottom) mrtransform + -reorient_fod yes (corrupted)

ps: in my sample , fiber orientation (V1) is really simple, it should always follow the tangent of the isosurface (radial pattern is clearly wrong in the second image)

Thanks in advance for your help

Valéry



This is designed to work with Orientation Distribution Functions and does not work for tensors. We currently do not have the functionality to reorient tensors or vector fields. However, (without warranties!) feel free to try below:

mrtransform vector.mif -warp warp.mif vector_transformed.mif
vectorreorient vector_transformed -warp warp.mif vector_transformed_reoriented.mif

using the vectorreorient.cpp command from:

Either copy this file into cmd/ and rerun ./build or better set up an external module

vectorreorient requires a warp field. You can concatenate your linear and nonlinear transformation using transformcompose (or extend the command or generate a warp from a linear transformation).

Hi Max,

Thanks a lot for your explanation, your answer was really helpful, it just took me 5 minutes to follow your indications and get a correct orientation for the vector. I used the external module instruction and make the transform using “warp from a linear transformation”

Is there any chance you have a tensorreorient.cpp in back up to test even if it is without warrany. ?

I made some comparison with tensor reorientation using the ANTs library that it is a bit difficult to use for me, if I set the strides correctly I get a similar result but if I zoom I found some differences.

(top) result from vector reorient
(middle) vector reorient mrtrix versus tensor reorient using ANTs
(bottom) same but zoom view

Thanks in advance,
Valéry


I don’t, you’re also the first using vectorreorient.cpp which I adapted from fixelreorient.

Make sure you use a recent version of ANTs (see here).

Do you get (close to) identical scalar images when you transform your image with ANTs or mrtransform? Interpolation might be different, so I’d manually set it to linear or nearest-neighbour interpolation.

I am not familiar with ANTs’ tensor reorientation but they seem to interpolate in the matrix log-space, we spatially interpolate vector coordinates (cubic interpolation by default) and then rotate these which could explain some of the differences. Also, if your transformation is not rigid, I think you won’t get identical results as reoriented eigenvectors won’t be orthogonal but I presume that tensors after ANTs’ transformation are symmetric so eigenvectors remain orthogonal.