sankhesh.jhaveri at kitware.com
Mon Dec 11 11:00:17 EST 2017
Take a look at point locators in VTK.
Here is an example of the KdTreePointLocator:
For your particular use case, you might want to look at
Hope this helps.
On Sat, Dec 9, 2017 at 5:49 AM kenichiro yoshimi <rccm.kyoshimi at gmail.com>
> Hello Amine,
> The searching range for location selection of points is limited by
> EPSILON key. You can set a bigger value to expand the searching range
> as below.
> SelectionNode.GetProperties().Set(SelectionNode.EPSILON(), 1000)
> 2017-12-02 0:45 GMT+09:00 Amine Aboufirass <amine.aboufirass at gmail.com>:
> > Hello,
> > I am trying to figure out how to select the closest neighboring points
> to a
> > list of coordinates using the vtk library. I have a simple point data
> set in
> > the Unstructured Grid Format. The dataset contains one attribute named
> > 'point_id' which is just enumerating the points starting from 1 instead
> > 0. The raw text from the ASCII file is attached in testScalar.vtk below.
> > I have also written a script in python which I thought would function as
> > follows:
> > INPUT:
> > List of tuples containing world coordinates [(X1,Y1,Z1),(X2,Y2,Z2)]
> > name of attribute to extract as a string. in this case "point_id"
> > OUTPUT:
> > List of floating point values of the attribute for the selected points
> > This does work to a certain degree, for instance when I do :
> > ExtractByLocation('testScalar.vtk', [(5.999,0,0)], 'point_id')
> > I do indeed get back the following:
> > array([ 2.], dtype=float32)
> > So point_id 2 is the closest point to the coordinates I have specified.
> > However, as soon as I get a bit too far from one of the points, the
> > starts returning an empty list. For instance:
> > ExtractByLocation('testScalar.vtk', [(5.888,0,0)], 'point_id')
> > Returns
> > array(, dtype=float32)
> > I found out that the cut off point is 5.89-5.90. If I plugin 5.9 I get
> > point, if I plugin 5.89 I get back an empty list.
> > According to the object reference
> > (
> > LOCATIONS is supposed to select the points near the supplied world
> > coordinates. Is there an option or something that selects the nearest
> > PERIOD? i.e using a simple distance formula? I would like to never get
> > an empty list but always get back a list of the closest point to the
> > supplied coordinates.
> > Kind Regards,
> > Amine
> > _______________________________________________
> > Powered by www.kitware.com
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> > Search the list archives at: http://markmail.org/search/?q=vtkusers
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
> Powered by www.kitware.com
> Visit other Kitware open-source projects at
> Please keep messages on-topic and check the VTK FAQ at:
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> Follow this link to subscribe/unsubscribe:
Sankhesh Jhaveri *Sr. Research & Development Engineer* | Kitware
<http://www.kitware.com/> | (518) 881-4417
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers