<div dir="ltr">Dear all,<div><br></div><div>I&#39;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">http://www.itk.org/pipermail/insight-users/2004-June/009092.html</a><br></div><div>
<br></div><div>These examples don&#39;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&#39;t use point sets</div><div><br>
</div><div><a href="http://www.itk.org/Wiki/ITK/Examples/Statistics/KdTree">http://www.itk.org/Wiki/ITK/Examples/Statistics/KdTree</a><br></div><div><br></div><div>I found an &quot;itkPointLocator2.h&quot; class developed for itkQuadEdgeMeshRigidRegistration in the ITK journal. I downloaded it from a more up-to-date publication that makes use of it, &quot;Mesh Similarity Calculator&quot; by Li and Magnotta (2010)</div>
<div><br></div><div><a href="http://www.insight-journal.org/browse/publication/762">http://www.insight-journal.org/browse/publication/762</a><br></div><div><br></div><div>What I don&#39;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>&lt;CODE&gt;</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&lt;PointSetType&gt; PointLocatorType;</div><div>  PointLocatorType::Pointer locator = PointLocatorType::New();</div><div><br></div><div>  locator-&gt;SetPointSet(fixedPointSet);</div><div>
  locator-&gt;Initialize(); // pre-compute the kd-tree structure</div></div><div><div>&lt;/CODE&gt;</div></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-&gt;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">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">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&#39;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     +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></div>