<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!--P{margin-top:0;margin-bottom:0;} p
        {margin-top:0;
        margin-bottom:0}--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi David,</p>
<p><br>
</p>
<p>I have a few questions.</p>
<p><br>
</p>
<p>1) I'm currently using mrtrix 0.2.12, do you think the scrip would apply to that version as well?</p>
<p><br>
</p>
<p>2) I'm getting dicom from the Bruker scanner. I convert them into .nii and then in .mif files, which I use for tracking.</p>
<p>Can use the script to convert from nifti to mif?<br>
</p>
<p><br>
</p>
<p>3) the script is not commented + I'm not familiar with python. I have difficulties in understanding in details what the script is doing.</p>
<p><br>
</p>
<p>I understand that: </p>
<p>a) it is first loading the file (<em>import sys, os.path</em>), but I don't understand how files/dir are organized.</p>
<p>b) it checks if the input provided is correct</p>
<p>c) it extract relevant information from the input file and assigns variables</p>
<p>d) it rewrites the variables<br>
</p>
<p><br>
</p>
<p>Basically I don't understand in what way each variable changes.</p>
<p><br>
</p>
<p>What I understood so far from analyzing my data is that the gradients need to be reoriented. Specifically it seems that a YZ swap is doing the best job, but I'm not sure this is correct/optimal.</p>
<p><br>
</p>
<p>Is the script doing something like this swap? Could you point the lines where this happens?</p>
<p><br>
</p>
<p>It would be very helpful to run the script line-by-line and see what happens to the variable, but I don't have the right input file, nor I work in python.</p>
<p>I guess the script can be converted in a bash script, right?</p>
<p><br>
</p>
<p><br>
</p>
<p>Thanks a lot,</p>
<p>Ilaria <br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div style="font-family:Tahoma; font-size:13px">
<div align="left"><font color="black" face="Tahoma" size="2"><span dir="ltr" style="font-size:10pt"><font size="1"><span style="font-size:13px"><font size="2">-------------------------------------------<br>
Ilaria Sani, PhD<br>
Postdoctoral Fellow, Freiwald Lab<br>
The Rockefeller University<br>
1230 York Ave., New York, NY 10065.<br>
Phone: (212) 327 </font></span></font></span></font><font color="black" face="Tahoma" size="2"><span dir="ltr" style="font-size:10pt"><font size="1"><span style="font-size:13px"><font size="2">7699<br>
Fax: (212) 327 7698<br>
Email: <a id="NoLP" href="https://rumail.rockefeller.edu/owa/redir.aspx?C=Kqhy3ohui0OLc6NBHS0gx_jC9yHmUtEIuvMTV8kpl1lEP6utIV_5LPRr35l0-k2eSQyLqrMn4XI.&URL=mailto%3assadagopan%40rockefeller.edu" target="_blank">
isani01@rockefeller.edu</a></font></span></font></span></font></div>
</div>
</div>
</div>
<div style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif" dir="ltr">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> David Wright <wrightd@unimelb.edu.au><br>
<b>Sent:</b> Thursday, July 7, 2016 7:47 PM<br>
<b>To:</b> Ilaria Sani; mrtrix-discussion@www.nitrc.org<br>
<b>Subject:</b> RE: [Mrtrix-discussion] Question about the gradient direction table used in Mrtrix</font>
<div> </div>
</div>
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">Hi Ilaria,
<div><br>
</div>
<div>There is a really handy script within MRtrix3 called convert_bruker which you can use to convert a Bruker 2dseq file into a .mih file for use with MRtrix. However, I've found that this script can occasionally reconstruct the data incorrectly and so I've
made a couple of modifications to get it working for our data. Its still very much a work in progress, but you<span style="font-size:12pt">'re welcome to download it and give it a try:</span></div>
<div><br>
</div>
<div><a href="https://cloudstor.aarnet.edu.au/plus/index.php/s/bHhr1HXDo9T1cdE" target="_blank">https://cloudstor.aarnet.edu.au/plus/index.php/s/bHhr1HXDo9T1cdE</a></div>
<div><br>
</div>
<div>Let me know if you run into any problems. </div>
<div><br>
</div>
<div>Cheers</div>
<div><br>
</div>
<div>David</div>
<div><br>
<div style="font-family:Times New Roman; color:#000000; font-size:16px">
<hr tabindex="-1">
<div id="divRpF791185" style="direction:ltr"><font color="#000000" face="Tahoma" size="2"><b>From:</b> mrtrix-discussion-bounces@www.nitrc.org [mrtrix-discussion-bounces@www.nitrc.org] on behalf of Ilaria Sani [isani01@mail.rockefeller.edu]<br>
<b>Sent:</b> Friday, 8 July 2016 12:45 AM<br>
<b>To:</b> mrtrix-discussion@www.nitrc.org<br>
<b>Subject:</b> [Mrtrix-discussion] Question about the gradient direction table used in Mrtrix<br>
</font><br>
</div>
<div></div>
<div>
<p>Dear All,</p>
<p><br>
</p>
<p>I found the helpful post below from 2003, but I need some extra help.</p>
<p><br>
</p>
<p>I'm analyzing ex-vivo data acquired with a 7T bruker scanner.</p>
<p>This means that both "patient coordinate system" and the "scanner coordinate system" are peculiar.</p>
<p><br>
</p>
<p>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.</p>
<p><br>
</p>
<p>As for the scanner, I don't know how the bruker scanner compare to the trio or GE...</p>
<p>So I've been trying to invert and swap the gradient table.</p>
<p>There are some combinations of swap/invert that return a higher number of fibers when I perform ROI-to-ROI tracking. However,</p>
<p>- 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.<br>
</p>
<p>- the RGB color cording is not correct, i.e. the color of vertical and horizontal fibers is inverted.<br>
</p>
<p> </p>
<p>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.<br>
</p>
<p><br>
</p>
<p>Can anybody help me to understand if I'm doing things right?<br>
</p>
<p><br>
</p>
<p>Thanks!!</p>
<p>Ilaria<br>
</p>
<p><br>
</p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif"><br>
</span></p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div style="font-family:Tahoma; font-size:13px">
<div align="left"><font color="black" face="Tahoma" size="2"><span dir="ltr" style="font-size:10pt"><font size="1"><span style="font-size:13px"><font size="2">-------------------------------------------<br>
Ilaria Sani, PhD<br>
Postdoctoral Fellow, Freiwald Lab<br>
The Rockefeller University<br>
1230 York Ave., New York, NY 10065.<br>
Phone: (212) 327 </font></span></font></span></font><font color="black" face="Tahoma" size="2"><span dir="ltr" style="font-size:10pt"><font size="1"><span style="font-size:13px"><font size="2">7699<br>
Fax: (212) 327 7698<br>
Email: <a id="NoLP" href="https://rumail.rockefeller.edu/owa/redir.aspx?C=Kqhy3ohui0OLc6NBHS0gx_jC9yHmUtEIuvMTV8kpl1lEP6utIV_5LPRr35l0-k2eSQyLqrMn4XI.&URL=mailto%3assadagopan%40rockefeller.edu" target="_blank">
isani01@rockefeller.edu</a><br>
<br>
<br>
<br>
<br>
</font></span></font></span></font><strong>Donald Tournier</strong> <a id="NoLP" href="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" title="[Mrtrix-discussion] Question about the gradient direction table
        used in Mrtrix" target="_blank">
d.tournier at brain.org.au </a><br>
<em>Tue Apr 2 20:26:11 PDT 2013</em>
<ul>
<li>Previous message: <a id="NoLP" href="http://www.nitrc.org/pipermail/mrtrix-discussion/2013-April/000686.html" target="_blank">
[Mrtrix-discussion] Question about the gradient direction table used in Mrtrix </a>
</li><li>Next message: <a id="NoLP" href="http://www.nitrc.org/pipermail/mrtrix-discussion/2013-April/000690.html" target="_blank">
[Mrtrix-discussion] Question about the gradient direction table used in Mrtrix </a>
</li><li><strong>Messages sorted by:</strong> <a id="NoLP" href="http://www.nitrc.org/pipermail/mrtrix-discussion/2013-April/date.html#688" target="_blank">
[ date ]</a> <a id="NoLP" href="http://www.nitrc.org/pipermail/mrtrix-discussion/2013-April/thread.html#688" target="_blank">
[ thread ]</a> <a id="NoLP" href="http://www.nitrc.org/pipermail/mrtrix-discussion/2013-April/subject.html#688" target="_blank">
[ subject ]</a> <a id="NoLP" href="http://www.nitrc.org/pipermail/mrtrix-discussion/2013-April/author.html#688" target="_blank">
[ author ]</a> </li></ul>
<hr>
<pre>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.
Cheers,
Donald.
On 3 April 2013 12:57, smxie_nlpr <<a id="NoLP" href="http://www.nitrc.org/mailman/listinfo/mrtrix-discussion" target="_blank">smxie at nlpr.ia.ac.cn</a>> wrote:
><em> **
</em>><em> Hi,
</em>><em>
</em>><em> I have a question about the gradient direction table used in Mrtrix. The
</em>><em> gradient direction table achieved from the DICOM images with dcm2nii is
</em>><em> different from the table achieved with the command 'mrinfo DICOMDIR -grad
</em>><em> encoding.b'. I checked the source code of Mrtrix and found the following
</em>><em> codes '
</em>><em> if(rotate_DW_scheme)
</em>><em> {
</em>><em> G(n,0) = image_transform(0,0) * d[0] + image_transform(0,1) * d[1] -
</em>><em> image_transform(0,2) * d[2];
</em>><em> G(n,1) = image_transform(1,0) * d[0] + image_transform(1,1) * d[1] -
</em>><em> image_transform(1,2) * d[2];
</em>><em> G(n,2) = image_transform(2,0) * d[0] + image_transform(2,1) * d[1] -
</em>><em> image_transform(2,2) * d[2];
</em>><em> }' in image.cpp.
</em>><em> I transformed the original gradient table with similar code in Matlab, but
</em>><em> the result is not equal to the table achieved with mrinfo. So I want to
</em>><em> know the procedure of transforming the original gradients to the gradients
</em>><em> achieved with mrinfo. And why is it 'G(n,0) = image_transform(0,0) * d[0]
</em>><em> + image_transform(0,1) * d[1] - image_transform(0,2) * d[2];' rather than
</em>><em> 'G(n,0) = image_transform(0,0) * d[0] + image_transform(0,1) * d[1] +
</em>><em> image_transform(0,2) * d[2];' ?
</em>><em>
</em>><em> Thanks.
</em>><em>
</em>><em> Sangma Xie
</em>><em> ------------------------------
</em>><em> Sangma Xie , Master
</em>><em> Brainnetome Center
</em>><em> National Laboratory of Pattern Recognition (NLPR)
</em>><em> Institute of Automation, Chinese Academy of Sciences (CASIA)
</em>><em> 95 Zhong Guan Cun East Road, Hai Dian District, Beijing 100190, P.R.China
</em>></pre>
<font color="black" face="Tahoma" size="2"><span dir="ltr" style="font-size:10pt"><font size="1"><span style="font-size:13px"><font size="2"><br>
</font></span></font></span></font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>