Tractography issue and rotation vetcors

I am working with monkey data that was acquired in sphinx position. In order to maintain vector orientation I did all processing steps in the original image orientation. After topup and eddy correction. I did the Response function estimation, FOD estimation, Intensity normalization, and Tractography. the tractography colours RGB follows the conventional orientation but my image is inverted so it look like this because the Y orientation is incorrect. I have tried to change the orientation modifying the stride with no success.


So my guess is I have to reorient the image after eddy correction and keep it in the conventional orientation before to do the rest of the steps. However I don’t know how to rotate the .bvec files. Is this guess OK? DO you have any recommendation? this is the orientation image of my wmfor_norm.mif


Image name: “…/CSD_results/wmfod_norm.mif”


Dimensions: 58 x 47 x 75 x 45
Voxel size: 1.5 x 1.5 x 1.5 x 3.23
Data strides: [ -1 -3 2 4 ]
Format: MRtrix
Data type: 32 bit float (little endian)
Intensity scaling: offset = 0, multiplier = 1
Transform: 0.9964 -0.07371 -0.04286 -33.51
0.06259 0.9736 -0.2194 -77.1
0.05791 0.216 0.9747 -89.55
lognorm_scale: 0.58171146182971578
mrtrix_version: 3.0.4
prior_dw_scheme: -0.4544014513,-0.7661844293,0.4544015199,5
[99 entries] -0.4544014513,-0.7661844293,0.4544015199,5

0.4935878632,0.493192367,0.7163325418,1490
-0.1372360089,-0.3651226161,0.9207886582,2995

Welcome Gabriel!

I would start by challenging the idea that processing steps need to be done in the original orientation “to maintain vector orientation”. If a reorientation is applied to image data, and the diffusion sensitisation directions remain faithful to that reorientation, then there should (ideally at least) be no problem with applying that reorientation at any point along the pipeline.

(FSL’s topup is a potential exclusion: it forbids phase encoding along the third image axis)

If rotating with MRtrix3’s mrtransform, and the diffusion sensitisation directions are embedded within the image header, then the corresponding rotation will be applied to the diffusion gradient table automatically.

Specifically the FSL .bvec format is slightly trickier. If this format simply defined the diffusion sensitisation directions with respect to the image axes, then there would be no manipulation required: the relationship between diffusion sensitisation direction and spatial contrast would be unaffected by such a rotation. However, this is not the full story when it comes to this format, due to the determinant check. Your safest option, if you insist on the use of the .bvec format, is to:

  1. mrconvert with -fslgrad to get the gradient table into the image header
  2. mrtransform to apply the desired transformation
    (with MRtrix3 automatically rotating the gradient table in scanner coordinates)
  3. mrconvert with -export_grad_fsl to get the gradient table back into .bvec

Modifying the image strides will not change the spatial embedding of the image data in any way. It only changes the relationship between the embedding of intensity data in ND space and their arrangement on the 1D filesystem:
https://www.sciencedirect.com/science/article/pii/S1053811919307281#appsec1

What you want is to determine the affine matrix corresponding to your desired axis shuffle, and apply it using mrtransform.

Regards
Rob

Thank you so much. I will be trying that and see how it works. I will obtain affine matrix , apply it and follow the whole processing with he new alignment. Thank you so much.