[Mrtrix-discussion] Aligning tracks and masks
Jackson Smith
jackson.smith at dpag.ox.ac.uk
Mon Nov 3 02:13:30 PST 2014
Hi Donald,
Aha! I had assumed that 0,0,0 marks the corner of a voxel, rather than the centre. Now it all makes sense.
Thank you for writing back. And thanks, too, for providing this wonderful set of tools.
All the best,
Jackson
---------------------------
Dept of Phys, Anat and Gen
University of Oxford
Sherrington Bld, Parks Rd
Oxford, OX1 3PT
United Kingdom
Tel: 01865 282 549
jackson.smith at dpag.ox.ac.uk
---------------------------
________________________________
From: J-Donald Tournier [jdtournier at gmail.com]
Sent: 31 October 2014 18:11
To: Jackson Smith
Cc: mrtrix mailinglist
Subject: Re: [Mrtrix-discussion] Aligning tracks and masks
Hi Jackson,
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.
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.
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...?
Cheers,
Donald
--
Dr J-Donald Tournier (PhD)
Senior Lecturer, Biomedical Engineering
Division of Imaging Sciences & Biomedical Engineering
King's College London
A: Department of Perinatal Imaging & Health, 1st Floor South Wing, St Thomas' Hospital, London. SE1 7EH
T: +44 (0)20 7188 7118 ext 53613
W: http://www.kcl.ac.uk/medicine/research/divisions/imaging/departments/biomedengineering
On 31 Oct 2014 10:59, "Jackson Smith" <jackson.smith at dpag.ox.ac.uk<mailto:jackson.smith at dpag.ox.ac.uk>> wrote:
Dear MRtrix users,
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.
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.
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:
% Read in the mask.
seed = read_mrtrix( 'seed_mask.mif' ) ;
% Find the x-y-z index i.e. subscript index for each
% voxel in the mask. It is a binary mask. Voxels in the
% mask are marked with 1, and background voxels are 0.
i = find( 0 < seed.data(:) ) ;
[ s.x , s.y , s.z ] = ind2sub( seed.dim , i ) ;
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.
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.
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?
Kind regards,
Jackson
---------------------------
Dept of Phys, Anat and Gen
University of Oxford
Sherrington Bld, Parks Rd
Oxford, OX1 3PT
United Kingdom
Tel: 01865 282 549
jackson.smith at dpag.ox.ac.uk<mailto:jackson.smith at dpag.ox.ac.uk>
---------------------------
_______________________________________________
Mrtrix-discussion mailing list
Mrtrix-discussion at www.nitrc.org<mailto:Mrtrix-discussion at www.nitrc.org>
http://www.nitrc.org/mailman/listinfo/mrtrix-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.nitrc.org/pipermail/mrtrix-discussion/attachments/20141103/3b73300b/attachment.html>
More information about the Mrtrix-discussion
mailing list