Conversion between DIPY & MRTrix FOD

Hello MRtrix community,

I am starting to work with a publicly available ex-vivo diffusion dataset of the human brainstem (Mapping the human subcortical auditory system using histology, postmortem MRI and in vivo MRI at 7T | eLife). The dataset includes the FOD file processed by DIPY (Version .14), and not the raw diffusion data. I would like to perform tractography based on this data, and leverage some of the features that are unique to MRtrix, however our early attempts at doing this on the data as is have yielded odd looking results. Based on my understand of this discussion on the dipy GitHub (mrtrix 0.3 default basis is different from mrtrix 0.2 · Issue #392 · dipy/dipy · GitHub) and the dipy documentation (DIPY : Docs 1.4.0. - Spherical Harmonic bases) it appears like there are differences in the sh basis between the two packages. Would I be correct in assuming that DIPY FODs would not be compatible with MRtrix, and if so whether there would be a way to convert between the two formats.

Thank you,

Paul

As far as I can tell, MRtrix3 and dipy are already using the same SH basis (unless the images were generated using a very old dipy version).

My guess is that there is a mismatch between the coordinates frames in which the directional information is represented. MRtrix does this with respect to real or scanner coordinates, whereas other tools may be doing this with respect to the image axes instead.

Thank you for your response. I found a script that is part of scilpy (scil_convert_sh_basis.py — scilpy documentation) for performing a conversion between the descoteaux and tournier sh bases, it seems to have worked and tractography results look reasonable.

MRtrix3 is no longer using the SH basis from the Tournier2007 reference, so unless you are using the long deprecated MRtrix 0.2, this script might not be right for your use case, even if results look reasonable.

I have similar concerns too, so I had a deep dive through their code. The script is from the SCIL, and invokes functionality from dipy.

Tracing through the code:

  • the scil_convert_sh_basis script calls convert_sh_basis
  • which calls sh_to_sf_matrix (from dipy)
  • which states in its docstring that it accepts an optional legacy argument to specify which specific version of our SH basis to use. By default, this is set to True, which means that it will by default use the outdated, non-orthonormal SH convention (it’s missing a √2 factor for the m≠0 terms).

Since the SCIL script does not provide an explicit value for this argument (or indeed provide any means of setting the argument when invoking it), it looks like it will immediately default to the outdated definition – so @bjeurissen’s concern is I think warranted.

I would also second @bjeurissen’s concern regarding the coordinate system:

I’ve no idea what coordinate system is assumed in dipy, maybe someone more closely involved with the project could comment (@arnaudbore, any thoughts…?).

Thanks @bjeurissen and @jdtournier for your responses, and your insights. I’ve reached out to the dipy community and hopefully we will get some clarity.