[vtkusers] Nearest Pixel to a point
Matias Montroull
matimontg at gmail.com
Tue Mar 11 20:13:29 EDT 2014
one thing to keep in mind is that for this section:
var indice = kdtree.FindClosestPoint(x, y, z, ref
dist_minima); //where x, y and z are your 2D image points..
var closestpoint = kdtree.GetDataSet().GetPoint(indice);
You actually need to do iteration to go through all points in the 2D
image.. and find the closest point to each point in the 3D image,
On Tue, Mar 11, 2014 at 9:11 PM, Matias Montroull <matimontg at gmail.com>wrote:
> I've used vtkKdTree:
>
> vtkPolyData polydata = new vtkPolyData();
> polydata.SetPoints(yourpoints3D);
>
> vtkKdTree kdtree = new vtkKdTree();
> kdtree.SetDataSet(polydata);
> kdtree.BuildLocatorFromPoints(yourpoints3D);
>
> Then somewhere in your code:
>
> double dist_minima = 0;
> var indice = kdtree.FindClosestPoint(x, y, z, ref
> dist_minima); //where x, y and z are your 2D image points..
> var closestpoint =
> kdtree.GetDataSet().GetPoint(indice);
>
>
> On Tue, Mar 11, 2014 at 8:59 PM, Fabian Torres <fabian.trobles at gmail.com>wrote:
>
>> Hi all
>>
>> 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).
>>
>> Is there a way I can find the nearest pixel of the vtkImage to a point in
>> pointCloud?
>>
>> --
>> Fabián Torres Robles
>> Maestria en Ciencias en Ingeniería Electrónica
>> Ingeniería en Sistemas Electrónicos
>> tel. 58081280, 0445534661338
>> e-mail fabian.trobles at gmail.com, dae.wong at gmail.com
>>
>> _______________________________________________
>> 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
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140311/18734fa2/attachment.html>
More information about the vtkusers
mailing list