<div dir="ltr">I've used vtkKdTree:<div> <br></div><div><div> vtkPolyData polydata = new vtkPolyData();</div><div> polydata.SetPoints(yourpoints3D);</div></div><div><br></div>
<div><div> vtkKdTree kdtree = new vtkKdTree();</div><div> kdtree.SetDataSet(polydata);</div><div> kdtree.BuildLocatorFromPoints(yourpoints3D);</div></div><div><br></div><div>Then somewhere in your code:</div>
<div><br></div><div> double dist_minima = 0;<br></div><div><div> var indice = kdtree.FindClosestPoint(x, y, z, ref dist_minima); //where x, y and z are your 2D image points..</div><div>
var closestpoint = kdtree.GetDataSet().GetPoint(indice);</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 11, 2014 at 8:59 PM, Fabian Torres <span dir="ltr"><<a href="mailto:fabian.trobles@gmail.com" target="_blank">fabian.trobles@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 dir="ltr">Hi all<div><br></div><div>I have a cloud of points in a 3D space (pointCloud). I also have a 2D image (I know the rotation and translation of this image for the 3D space). </div>
<div><br></div><div>Is there a way I can find the nearest pixel of the vtkImage to a point in pointCloud?<span class="HOEnZb"><font color="#888888"><br clear="all">
<div><br></div>-- <br>Fabián Torres Robles<br>Maestria en Ciencias en Ingeniería Electrónica<br>Ingeniería en Sistemas Electrónicos<br>tel. 58081280, 0445534661338<br>e-mail <a href="mailto:fabian.trobles@gmail.com" target="_blank">fabian.trobles@gmail.com</a>, <a href="mailto:dae.wong@gmail.com" target="_blank">dae.wong@gmail.com</a> <div style="line-height:130%;text-align:left;font-size:10px;overflow:hidden;margin-left:0px;word-wrap:break-word;margin-top:0px;padding:0px">
</div><div style="line-height:130%;text-align:left;font-size:10px;overflow:hidden;margin-left:0px;word-wrap:break-word;margin-top:0px;padding:0px"></div>
</font></span></div></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>