[Mrtrix-discussion] Question about the gradient direction table used in Mrtrix

Ilaria Sani isani01 at mail.rockefeller.edu
Thu Jul 7 07:45:29 PDT 2016

Dear All,

I found the helpful post below from 2003, but I need some extra help.

I'm analyzing ex-vivo data acquired with a 7T bruker scanner.

This means that both "patient coordinate system" and the "scanner coordinate system" are peculiar.

The brain is positioned as if the patient was lying in sphynx position. It means that left and right are inverted and that coronal and sagittal are inverted.

As for the scanner, I don't know how the bruker scanner compare to the trio or GE...

So I've been trying to invert and swap the gradient table.

There are some combinations of swap/invert that return a higher number of fibers when I perform ROI-to-ROI tracking. However,

- I still see discrepancies, for example in the two hemispheres. The number of selected fibers can vary 1-2 order magnitude. Especially with small ROIs.

- the RGB color cording is not correct, i.e. the color of vertical and horizontal fibers is inverted.

I tried to replicate the swap/invert procedures in other software to double check whether I was doing things right, but I got different results. So I guess the gradient table convention is specific to MRTRIX.

Can anybody help me to understand if I'm doing things right?



Ilaria Sani, PhD
Postdoctoral Fellow, Freiwald Lab
The Rockefeller University
1230 York Ave., New York, NY 10065.
Phone: (212) 327 7699
Fax:     (212) 327 7698
Email: isani01 at rockefeller.edu<https://rumail.rockefeller.edu/owa/redir.aspx?C=Kqhy3ohui0OLc6NBHS0gx_jC9yHmUtEIuvMTV8kpl1lEP6utIV_5LPRr35l0-k2eSQyLqrMn4XI.&URL=mailto%3assadagopan%40rockefeller.edu>

Donald Tournier d.tournier at brain.org.au <mailto:mrtrix-discussion%40www.nitrc.org?Subject=%5BMrtrix-discussion%5D%20Question%20about%20the%20gradient%20direction%20table%0A%09used%20in%20Mrtrix&In-Reply-To=201304030957497962643%40nlpr.ia.ac.cn>
Tue Apr 2 20:26:11 PDT 2013

  *   Previous message: [Mrtrix-discussion] Question about the gradient direction table used in Mrtrix <http://www.nitrc.org/pipermail/mrtrix-discussion/2013-April/000686.html>
  *   Next message: [Mrtrix-discussion] Question about the gradient direction table used in Mrtrix <http://www.nitrc.org/pipermail/mrtrix-discussion/2013-April/000690.html>
  *   Messages sorted by: [ date ]<http://www.nitrc.org/pipermail/mrtrix-discussion/2013-April/date.html#688> [ thread ]<http://www.nitrc.org/pipermail/mrtrix-discussion/2013-April/thread.html#688> [ subject ]<http://www.nitrc.org/pipermail/mrtrix-discussion/2013-April/subject.html#688> [ author ]<http://www.nitrc.org/pipermail/mrtrix-discussion/2013-April/author.html#688>


Hi Sangma,

OK, there's quite a few issues at play here. First off, the convention used
in MRtrix is that the gradients are specified with respect to the DICOM
patient coordinate system. This is essentially the same convention as for
DICOM images produced on Siemens and Philips scanners, and the newer
standard DICOM tags recently introduced, with one notable exception: the
DICOM patient-centered coordinate system has its x-axis running
right-to-left and its y-axis running anterior-posterior, whereas MRtrix
assumes these axes run in the opposite direction (as per the NIfTI
standard). So MRtrix will flip the x & y components to account for this.

For Siemens & Philips images, that's essentially all that happens to the DW
gradients. For GE images, it's a little different, since in this case the
gradients are (or at least, used to be) stored with respect to the images
axes. This means that to convert to MRtrix convention, they must be
re-oriented back into the patient-centered coordinate system. This is what
the rotate_DW_scheme flag specifies: when the DW gradient information was
read from a GE-specific tag, this is set to true and the gradients are then
rotated according to the direction of the images axes. In this case, the z
component is inverted, since flipping the x & y is essentially the same as
flipping z, given the symmetry of diffusion.

As far as I know, dcm2nii provides the DW directions with respect to the
image axes (in the NIfTI coordinate system). To convert these back to
MRtrix convention, the same transformation as you highlighted is needed,
but *without* the negative sign. The transform you highlighted also
accounts for differences in the directions of these axes due to the
different conventions used for DICOM versus NifTI/MRtrix, so is not
appropriate as-is to do convert a dcm2nii-supplied gradient table into one
suitable for MRtrix. This is because the dcm2nii gradient table is provided
with respect to the image axes in NIfTI coordinate space, and in MRtrix
they are provided with respect to the original axes, also in NIfTI
coordinate space.

To get back to your question, what do you mean when you say 'the original
gradient table'? The one supplied by dcm2nii (in which case converting
using the highlighted section of code would not work, as explained above),
or the actual ones as read directly from the DICOM headers? If the latter,
then unless your images were acquired on a GE scanner, then that also would
not work, since that section of code would only be used for GE images. If
you are trying to convert non-GE DW directions read directly from the DICOM
headers, then all you need to do is flip the sign of the x & y components.

Basically, it's really hard to keep track of all the possible conventions
and what each step in the processing pipeline might have done to the DW
gradients. Hopefully the above will help you figure out where the problem
might be...

Hope this helps.


On 3 April 2013 12:57, smxie_nlpr <smxie at nlpr.ia.ac.cn<http://www.nitrc.org/mailman/listinfo/mrtrix-discussion>> wrote:

> **
>  Hi,
> I have a question about the gradient direction table used in Mrtrix. The
> gradient direction table achieved from the DICOM images with dcm2nii is
> different from the table achieved with the command 'mrinfo DICOMDIR -grad
> encoding.b'. I checked the source code of Mrtrix and found the following
> codes '
> if(rotate_DW_scheme)
>  {
> G(n,0) = image_transform(0,0) * d[0] + image_transform(0,1) * d[1] -
> image_transform(0,2) * d[2];
> G(n,1) = image_transform(1,0) * d[0] + image_transform(1,1) * d[1] -
> image_transform(1,2) * d[2];
> G(n,2) = image_transform(2,0) * d[0] + image_transform(2,1) * d[1] -
> image_transform(2,2) * d[2];
> }' in image.cpp.
> I transformed the original gradient table with similar code in Matlab, but
> the result is not equal to the table achieved with mrinfo. So I want to
> know the procedure of transforming the original gradients to the gradients
> achieved with mrinfo. And why is it 'G(n,0) = image_transform(0,0) * d[0]
> + image_transform(0,1) * d[1] - image_transform(0,2) * d[2];' rather than
> 'G(n,0) = image_transform(0,0) * d[0] + image_transform(0,1) * d[1] +
> image_transform(0,2) * d[2];' ?
> Thanks.
> Sangma Xie
> ------------------------------
>  Sangma Xie , Master
> Brainnetome Center
> National Laboratory of Pattern Recognition (NLPR)
> Institute of Automation, Chinese Academy of Sciences (CASIA)
> 95 Zhong Guan Cun East Road, Hai Dian District, Beijing 100190, P.R.China

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.nitrc.org/pipermail/mrtrix-discussion/attachments/20160707/24baf256/attachment.html>

More information about the Mrtrix-discussion mailing list