<div dir="ltr"><div class="markdown-here-wrapper" style="font-family:"Lucida Sans",Cantarell,Verdana,sans-serif;color:rgb(11,83,148)"><p style="margin:0px 0px 1.2em!important">Hello Amine,</p>
<p style="margin:0px 0px 1.2em!important">Take a look at point locators in VTK. </p>
<p style="margin:0px 0px 1.2em!important">Here is an example of the KdTreePointLocator: <a href="https://lorensen.github.io/VTKExamples/site/Cxx/DataStructures/KdTreePointLocator/ClosestNPoints/">https://lorensen.github.io/VTKExamples/site/Cxx/DataStructures/KdTreePointLocator/ClosestNPoints/</a></p>
<p style="margin:0px 0px 1.2em!important">For your particular use case, you might want to look at <a href="https://www.vtk.org/doc/nightly/html/classvtkKdTreePointLocator.html#a9ccf7b19974592b6821716bf48265f08">vtkKdTreePointLocator::FindPointsWithinRadius</a></p>
<p style="margin:0px 0px 1.2em!important">Hope this helps.</p>
<p style="margin:0px 0px 1.2em!important">Best,<br>Sankhesh</p>
<div title="MDH:PGRpdj5IZWxsbyBBbWluZSw8L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2PlRha2UgYSBsb29rIGF0
IHBvaW50IGxvY2F0b3JzIGluIFZUSy4mbmJzcDs8L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2Pkhl
cmUgaXMgYW4gZXhhbXBsZSBvZiB0aGUgS2RUcmVlUG9pbnRMb2NhdG9yOiZuYnNwOzxhIGhyZWY9
Imh0dHBzOi8vbG9yZW5zZW4uZ2l0aHViLmlvL1ZUS0V4YW1wbGVzL3NpdGUvQ3h4L0RhdGFTdHJ1
Y3R1cmVzL0tkVHJlZVBvaW50TG9jYXRvci9DbG9zZXN0TlBvaW50cy8iPmh0dHBzOi8vbG9yZW5z
ZW4uZ2l0aHViLmlvL1ZUS0V4YW1wbGVzL3NpdGUvQ3h4L0RhdGFTdHJ1Y3R1cmVzL0tkVHJlZVBv
aW50TG9jYXRvci9DbG9zZXN0TlBvaW50cy88L2E+PC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5G
b3IgeW91ciBwYXJ0aWN1bGFyIHVzZSBjYXNlLCB5b3UgbWlnaHQgd2FudCB0byBsb29rIGF0IFt2
dGtLZFRyZWVQb2ludExvY2F0b3I6PGcgY2xhc3M9ImdyXyBncl8zNDcgZ3ItYWxlcnQgZ3JfZ3Jh
bW0gZ3JfaW5saW5lX2NhcmRzIGdyX3J1bl9hbmltIFN0eWxlIHJlcGxhY2VXaXRob3V0U2VwIiBp
ZD0iMzQ3IiBkYXRhLWdyLWlkPSIzNDciPjpGaW5kPC9nPlBvaW50c1dpdGhpblJhZGl1c10oPGEg
aHJlZj0iaHR0cHM6Ly93d3cudnRrLm9yZy9kb2MvbmlnaHRseS9odG1sL2NsYXNzdnRrS2RUcmVl
UG9pbnRMb2NhdG9yLmh0bWwjYTljY2Y3YjE5OTc0NTkyYjY4MjE3MTZiZjQ4MjY1ZjA4Ij5odHRw
czovL3d3dy52dGsub3JnL2RvYy9uaWdodGx5L2h0bWwvY2xhc3N2dGtLZFRyZWVQb2ludExvY2F0
b3IuaHRtbCNhOWNjZjdiMTk5NzQ1OTJiNjgyMTcxNmJmNDgyNjVmMDg8L2E+KTwvZGl2PjxkaXY+
PGJyPjwvZGl2PjxkaXY+SG9wZSB0aGlzIGhlbHBzLjwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+
QmVzdCw8L2Rpdj48ZGl2PlNhbmtoZXNoPC9kaXY+PGRpdj48YnI+PC9kaXY+" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0"></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Dec 9, 2017 at 5:49 AM kenichiro yoshimi <<a href="mailto:rccm.kyoshimi@gmail.com">rccm.kyoshimi@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Amine,<br>
<br>
The searching range for location selection of points is limited by<br>
EPSILON key. You can set a bigger value to expand the searching range<br>
as below.<br>
SelectionNode.GetProperties().Set(SelectionNode.EPSILON(), 1000)<br>
<br>
Thanks<br>
<br>
2017-12-02 0:45 GMT+09:00 Amine Aboufirass <<a href="mailto:amine.aboufirass@gmail.com" target="_blank">amine.aboufirass@gmail.com</a>>:<br>
> Hello,<br>
><br>
> I am trying to figure out how to select the closest neighboring points to a<br>
> list of coordinates using the vtk library. I have a simple point data set in<br>
> the Unstructured Grid Format. The dataset contains one attribute named the<br>
> 'point_id' which is just enumerating the points starting from 1 instead of<br>
> 0. The raw text from the ASCII file is attached in testScalar.vtk below.<br>
><br>
> I have also written a script in python which I thought would function as<br>
> follows:<br>
><br>
> INPUT:<br>
><br>
> List of tuples containing world coordinates [(X1,Y1,Z1),(X2,Y2,Z2)]<br>
> name of attribute to extract as a string. in this case "point_id"<br>
><br>
> OUTPUT:<br>
><br>
> List of floating point values of the attribute for the selected points<br>
><br>
> This does work to a certain degree, for instance when I do :<br>
><br>
> ExtractByLocation('testScalar.vtk', [(5.999,0,0)], 'point_id')<br>
><br>
> I do indeed get back the following:<br>
><br>
> array([ 2.], dtype=float32)<br>
><br>
> So point_id 2 is the closest point to the coordinates I have specified.<br>
> However, as soon as I get a bit too far from one of the points, the function<br>
> starts returning an empty list. For instance:<br>
><br>
> ExtractByLocation('testScalar.vtk', [(5.888,0,0)], 'point_id')<br>
><br>
> Returns<br>
> array([], dtype=float32)<br>
><br>
> I found out that the cut off point is 5.89-5.90. If I plugin 5.9 I get the<br>
> point, if I plugin 5.89 I get back an empty list.<br>
><br>
> According to the object reference<br>
> (<a href="https://www.vtk.org/doc/nightly/html/classvtkSelectionNode.html#aa7b54148c40adf4f5019b8ad3e160535a97d8505c922b2a25c5d2755607d3cbb6" rel="noreferrer" target="_blank">https://www.vtk.org/doc/nightly/html/classvtkSelectionNode.html#aa7b54148c40adf4f5019b8ad3e160535a97d8505c922b2a25c5d2755607d3cbb6</a>)<br>
> LOCATIONS is supposed to select the points near the supplied world<br>
> coordinates. Is there an option or something that selects the nearest point<br>
> PERIOD? i.e using a simple distance formula? I would like to never get back<br>
> an empty list but always get back a list of the closest point to the<br>
> supplied coordinates.<br>
><br>
> Kind Regards,<br>
><br>
> Amine<br>
><br>
><br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div><div dir="ltr">-- <br></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div class="inbox-inbox-inbox-inbox-inbox-inbox-inbox-markdown-here-wrapper" style="font-family:"proza libre",sans-serif;color:rgb(0,56,107)"><h5 id="inbox-inbox-inbox-inbox-inbox-inbox-inbox-sankhesh-jhaveri" style="margin:1.3em 0px 1em;padding:0px;font-size:1.1em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);font-weight:bold;color:rgb(11,65,148)">Sankhesh Jhaveri</h5>
<h6 id="inbox-inbox-inbox-inbox-inbox-inbox-inbox--sr-research-development-engineer-kitware-http-www-kitware-com-518-881-4417" style="margin:1.3em 0px 1em;padding:0px;font-size:1em;color:rgb(11,83,148);font-family:"open sans",sans-serif;font-weight:normal"><em>Sr. Research & Development Engineer</em> | <a href="http://www.kitware.com/">Kitware</a> | (518) 881-4417</h6>
<div title="MDH:PGIgc3R5bGU9ImZvbnQtZmFtaWx5OiB2ZXJkYW5hLCBzYW5zLXNlcmlmOyBjb2xvcjogcmdiKDEx
LCA4MywgMTQ4KTsiPjxmb250IHNpemU9IjIiPiMjIyMjU2Fua2hlc2ggSmhhdmVyaTwvZm9udD48
L2I+PGRpdj48Zm9udCBjb2xvcj0iIzBiNTM5NCIgZmFjZT0idmVyZGFuYSwgc2Fucy1zZXJpZiIg
c2l6ZT0iMiI+PGI+PGJyPjwvYj48L2ZvbnQ+PGRpdj48c3BhbiBzdHlsZT0iZm9udC1mYW1pbHk6
IGFyaWFsLCBzYW5zLXNlcmlmOyBjb2xvcjogcmdiKDExLCA4MywgMTQ4KTsiPjxzcGFuIHN0eWxl
PSJmb250LWZhbWlseTogdmVyZGFuYSwgc2Fucy1zZXJpZjsiPjxpPiMjIyMjIypTci4gUmVzZWFy
Y2ggJmFtcDsgRGV2ZWxvcG1lbnQgRW5naW5lZXIqPC9pPiZuYnNwO3wmbmJzcDs8L3NwYW4+PC9z
cGFuPjxzcGFuIHN0eWxlPSJmb250LWZhbWlseTogdmVyZGFuYSwgc2Fucy1zZXJpZjsgY29sb3I6
IHJnYigxMSwgODMsIDE0OCk7Ij48YSBocmVmPSJodHRwOi8vd3d3LmtpdHdhcmUuY29tLyIgdGFy
Z2V0PSJfYmxhbmsiIHN0eWxlPSJjb2xvcjogcmdiKDE3LCA4NSwgMjA0KTsiPktpdHdhcmU8L2E+
Jm5ic3A7fCZuYnNwOzwvc3Bhbj48c3BhbiBzdHlsZT0iZm9udC1mYW1pbHk6IHZlcmRhbmEsIHNh
bnMtc2VyaWY7IGNvbG9yOiByZ2IoMTEsIDgzLCAxNDgpOyI+KDUxOCkgODgxLTQ0MTc8L3NwYW4+
PGJyPjwvZGl2PjxkaXY+PGRpdj48ZGl2PjxzcGFuIHN0eWxlPSJmb250LWZhbWlseTogdmVyZGFu
YSwgc2Fucy1zZXJpZjsgY29sb3I6IHJnYigxMSwgODMsIDE0OCk7Ij48L3NwYW4+PC9kaXY+PC9k
aXY+PC9kaXY+PC9kaXY+" style="height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidden;font-size:0em;padding:0px;margin:0px"></div></div></div></div>