<div dir="ltr">Hi Nick,<div><br></div><div>I hit send before receiving your reply. Many thanks, I'm starting to look into your pointers and will report back.</div><div><br></div><div><br>Best regards,</div><div><br></div>
<div>Ramon.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 9 August 2013 16:24, Nick Tustison <span dir="ltr"><<a href="mailto:ntustison@gmail.com" target="_blank">ntustison@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">HI Ramon,<div><br></div><div>A couple years ago or so, I contributed the following to the Insight Journal</div>
<div><br></div><div><a href="http://www.insight-journal.org/browse/publication/317" target="_blank">http://www.insight-journal.org/browse/publication/317</a></div><div><br></div><div>based on</div><div><br></div><div><a href="http://www.ncbi.nlm.nih.gov/pubmed/20937578" target="_blank">http://www.ncbi.nlm.nih.gov/pubmed/20937578</a></div>
<div><br></div><div>We used kd-trees to speed up the point search. You can see this in</div><div>the function where we use the kd-tree directory</div><div><br></div><div><a href="https://github.com/midas-journal/midas-journal-317/blob/master/Source/JHCT/itkManifoldParzenWindowsPointSetFunction.txx" target="_blank">https://github.com/midas-journal/midas-journal-317/blob/master/Source/JHCT/itkManifoldParzenWindowsPointSetFunction.txx</a></div>
<div><br></div><div>starting at line 63. Part of our ITKv4 registration refactoring included</div><div>this work so these functions are part of the current repository albeit</div><div>slightly modified and we ended up using the PointsLocator class</div>
<div><br></div><div>ITK/Modules/Registration/Metricsv4/include/itkManifoldParzenWindowsPointSetFunction.hxx</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Nick</div><div><br></div><div><br></div></font></span><div>
<br><div><div class="im"><div>On Aug 9, 2013, at 8:23 AM, Ramón Casero Cañas <<a href="mailto:rcasero@gmail.com" target="_blank">rcasero@gmail.com</a>> wrote:</div><br></div><blockquote type="cite"><div><div class="h5">
<div dir="ltr">Dear all,<div><br></div><div>I'm trying to build an Iterative Closest Point algorithm with ITK.</div><div><br></div><div>I have googled advice on how it can be put together generally, and checked the three examples</div>
<div><br></div><div><div> Insight/Examples/Registration/</div><div> IterativeClosestPoint1.cxx</div><div> IterativeClosestPoint2.cxx</div><div> IterativeClosestPoint3.cxx</div></div>
<div><br></div><div>recommended here<br></div><div><br></div><div><a href="http://www.itk.org/pipermail/insight-users/2004-June/009092.html" target="_blank">http://www.itk.org/pipermail/insight-users/2004-June/009092.html</a><br>
</div><div>
<br></div><div>These examples don't use kd-trees (the last ones uses a distance transform).</div><div><br></div><div><div>I have also found an example of a kd-tree, that however doesn't use point sets</div><div><br>
</div><div><a href="http://www.itk.org/Wiki/ITK/Examples/Statistics/KdTree" target="_blank">http://www.itk.org/Wiki/ITK/Examples/Statistics/KdTree</a><br></div><div><br></div><div>I found an "itkPointLocator2.h" class developed for itkQuadEdgeMeshRigidRegistration in the ITK journal. I downloaded it from a more up-to-date publication that makes use of it, "Mesh Similarity Calculator" by Li and Magnotta (2010)</div>
<div><br></div><div><a href="http://www.insight-journal.org/browse/publication/762" target="_blank">http://www.insight-journal.org/browse/publication/762</a><br></div><div><br></div><div>What I don't know is how to extract a metric from said locator, to pass it to the registration object.</div>
<div><br></div><div>This is the relevant part of the code I have so far</div><div><br></div><div><CODE></div><div>PointSetType::Pointer fixedPointSet = PointSetType::New();<br></div><div>PointSetType::Pointer movingPointSet = PointSetType::New();<br>
</div><div><br></div><div>// do something to read the points into the point sets</div><div><br></div><div><div> // construct a Kd-tree structure for the reference point set, to</div><div> // accelerate the search for closest point</div>
<div> typedef itk::PointLocator2<PointSetType> PointLocatorType;</div><div> PointLocatorType::Pointer locator = PointLocatorType::New();</div><div><br></div><div> locator->SetPointSet(fixedPointSet);</div><div>
locator->Initialize(); // pre-compute the kd-tree structure</div></div><div></CODE></div><div><br></div><div>I think I could get the metric from the kd-tree with something like</div><div><br></div><div>
tree->GetDistanceMetric()</div><div><br></div><div>but I cannot get the tree from the locator, can I?</div><div><br></div><div><a href="https://github.com/midas-journal/midas-journal-762/blob/master/QuadEdgeMeshRigidRegistration/Source/itkPointLocator2.h" target="_blank">https://github.com/midas-journal/midas-journal-762/blob/master/QuadEdgeMeshRigidRegistration/Source/itkPointLocator2.h</a><br>
</div><div><br></div><div>Is this just a matter of adding a GetKdTree() method to itkPointLocator2.h, or is there some better solution to this?</div><div><br></div><div><br></div><div><br></div><div>Alternatively, if we not only have point sets at the input, but triangular meshes, it would be possible to compute shortest distances from the vertices of movingPointSet to a triangular mesh fixedTriMesh. This is efficient using an AABB tree (which can internally use a kd-tree), as in the CGAL library</div>
<div><br></div><div><a href="http://www.cgal.org/Manual/latest/doc_html/cgal_manual/AABB_tree/Chapter_main.html" target="_blank">http://www.cgal.org/Manual/latest/doc_html/cgal_manual/AABB_tree/Chapter_main.html</a><br></div>
<div><br></div>
<div>but this probably requires a vast amount of work? Or would it be relatively easy to write a new metric PointToTriMesh for ITK that imports CGAL AABB trees? I'm asking because I have no idea of how involved writing a new Metric class would be.</div>
<div><br></div><div><br></div><div>Best regards,</div><div><br></div><div>Ramon.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><br clear="all"><div><br></div>-- <br>Dr. Ramón Casero Cañas<br>
<br>Oxford e-Research Centre (OeRC)<br>University of Oxford<br>7 Keble Rd<br>Oxford OX1 3QG<br><br>tlf <a href="tel:%2B44%20%280%29%201865%20610739" value="+441865610739" target="_blank">+44 (0) 1865 610739</a><br>web <a href="http://www.cs.ox.ac.uk/people/Ramon.CaseroCanas" target="_blank">http://www.cs.ox.ac.uk/people/Ramon.CaseroCanas</a><br>
photos <a href="http://www.flickr.com/photos/rcasero/" target="_blank">http://www.flickr.com/photos/rcasero/</a>
</div></div></div></div><div class="im">
_____________________________________<br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>Kitware offers ITK Training Courses, for more information visit:<br><a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br><br>Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</div></blockquote></div><br></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Dr. Ramón Casero Cañas<br><br>Oxford e-Research Centre (OeRC)<br>University of Oxford<br>7 Keble Rd<br>Oxford OX1 3QG<br>
<br>tlf +44 (0) 1865 610739<br>web <a href="http://www.cs.ox.ac.uk/people/Ramon.CaseroCanas" target="_blank">http://www.cs.ox.ac.uk/people/Ramon.CaseroCanas</a><br>photos <a href="http://www.flickr.com/photos/rcasero/" target="_blank">http://www.flickr.com/photos/rcasero/</a>
</div>