<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Courier New;color: #000000;font-size: 12pt;">
Hi Donald,<br>
<br>
Aha! I had assumed that 0,0,0 marks the corner of a voxel, rather than the centre. Now it all makes sense.<br>
<br>
Thank you for writing back. And thanks, too, for providing this wonderful set of tools.<br>
<br>
All the best,<br>
Jackson<br>
<div><br>
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px"><font face="Courier New" size="3">---------------------------<br>
<font color="000000">Dept of Phys, Anat and Gen<br>
University of Oxford<br>
Sherrington Bld, Parks Rd<br>
Oxford, OX1 3PT<br>
United Kingdom<br>
<br>
</font></font><font size="2" color="000000"><font face="Courier New" size="3">Tel: 01865 282 549</font><font size="3"><br>
</font><font face="Courier New"><font size="3">jackson.smith@dpag.ox.ac.uk<br>
<font color="000000">---------------------------</font></font><br>
</font></font></div>
</div>
</div>
</div>
</div>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF674871"><font face="Tahoma" size="2" color="#000000"><b>From:</b> J-Donald Tournier [jdtournier@gmail.com]<br>
<b>Sent:</b> 31 October 2014 18:11<br>
<b>To:</b> Jackson Smith<br>
<b>Cc:</b> mrtrix mailinglist<br>
<b>Subject:</b> Re: [Mrtrix-discussion] Aligning tracks and masks<br>
</font><br>
</div>
<div></div>
<div>
<p dir="ltr">Hi Jackson,</p>
<p dir="ltr">I'm not familiar with the ind2sub() function, but assuming that it simply maps from scanner coordinates to voxel indices, the most likely reason for this is that we have different interpretations of where integer coordinates fall on the grid. In
MRtrix, voxel position [ 0 0 0 ] corresponds to the centre of the corner voxel - so it is shifted away from the actual corner of the image by half a voxel along all 3 axes.
</p>
<p dir="ltr">I'm not sure what you're using to plot all this, but assuming it's in Matlab, you'd need to make sure you're plotting the image with a half voxel shift backwards, so that the origin falls in the middle of the corner voxel.</p>
<p dir="ltr">Like I said, not sure what's going on since I can't see what your code is doing, but hopefully this explains the discrepancy...?</p>
<p dir="ltr">Cheers,<br>
Donald</p>
<p dir="ltr">--<br>
Dr J-Donald Tournier (PhD)</p>
<p dir="ltr">Senior Lecturer, Biomedical Engineering<br>
Division of Imaging Sciences & Biomedical Engineering<br>
King's College London</p>
<p dir="ltr">A: Department of Perinatal Imaging & Health, 1st Floor South Wing, St Thomas' Hospital, London. SE1 7EH<br>
T: +44 (0)20 7188 7118 ext 53613<br>
W: <a href="http://www.kcl.ac.uk/medicine/research/divisions/imaging/departments/biomedengineering" target="_blank">http://www.kcl.ac.uk/medicine/research/divisions/imaging/departments/biomedengineering</a><br>
</p>
<div class="gmail_quote">On 31 Oct 2014 10:59, "Jackson Smith" <<a href="mailto:jackson.smith@dpag.ox.ac.uk" target="_blank">jackson.smith@dpag.ox.ac.uk</a>> wrote:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Courier New; color:#000000; font-size:12pt">
Dear MRtrix users,<br>
<br>
I would like to plot tracks with respect to the seed mask. I would especially like to show where tracks originate within the seed mask. However, I am having trouble obtaining a precise alignment.<br>
<br>
I've seen Donald's reply to "DISCREPANCY in voxel2world matrices between mrtrix and spm". He describes how to load tracks alongside images. I've followed his steps with a set of my own tracks, using the transform and dimensions of a seed mask image.<br>
<br>
Then I plotted the very first vertex of each track to see where it fell within the seed mask. The mask, I loaded in Matlab using the following steps:<br>
<br>
% Read in the mask.<br>
seed = read_mrtrix( 'seed_mask.mif' ) ;<br>
<br>
% Find the x-y-z index i.e. subscript index for each<br>
% voxel in the mask. It is a binary mask. Voxels in the<br>
% mask are marked with 1, and background voxels are 0.<br>
i = find( 0 < seed.data(:) ) ;<br>
[ s.x , s.y , s.z ] = ind2sub( seed.dim , i ) ;<br>
<br>
My understanding is that MRtrix indexing starts at 0. Therefore, I subtract 1 from s.x, s.y, and s.z to get the lower left-hand corner at the back of each voxel, in units of voxel indeces. Note, the layout is '+0,+1,+2' meaning that indexing should move left
to right, posterior to anterior, and inferior to superior along the x, y, and z axes.<br>
<br>
But when I plot the starting vertices of each track onto an outline of the seed voxels, I find that they are slightly misaligned. Note that tracking was done without interpolating the seed mask.<br>
<br>
A solution appears to be that I must subtract 1.5 from the subscripts in s.x, s.y, and s.z rather than just 1. This works very well. But I do not know where the extra 0.5 has come from. I'm happy that it works, but unsettled that I don't know why. Could anyone
please explain the extra 0.5?<br>
<br>
Kind regards,<br>
Jackson<br>
<div><br>
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px"><font face="Courier New" size="3">---------------------------<br>
<font color="000000">Dept of Phys, Anat and Gen<br>
University of Oxford<br>
Sherrington Bld, Parks Rd<br>
Oxford, OX1 3PT<br>
United Kingdom<br>
<br>
</font></font><font color="000000"><font face="Courier New" size="3">Tel: 01865 282 549</font><font size="3"><br>
</font><font face="Courier New"><font size="3"><a href="mailto:jackson.smith@dpag.ox.ac.uk" target="_blank">jackson.smith@dpag.ox.ac.uk</a><br>
<font color="000000">---------------------------</font></font><br>
</font></font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
_______________________________________________<br>
Mrtrix-discussion mailing list<br>
<a href="mailto:Mrtrix-discussion@www.nitrc.org" target="_blank">Mrtrix-discussion@www.nitrc.org</a><br>
<a href="http://www.nitrc.org/mailman/listinfo/mrtrix-discussion" target="_blank">http://www.nitrc.org/mailman/listinfo/mrtrix-discussion</a><br>
<br>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>