[vtkusers] vtkAreaPicker and vtkRenderedAreaPicker fail to pick vtkOpenGLActor objects
Renaud Lebrun
renaud.lebrun at umontpellier.fr
Thu Mar 2 10:30:38 EST 2017
Dear VTK Users,
I write you because I have troubles managing vtkAreaPicker and
vtkRenderedAreaPicker to pick vtkOpenGLActor objects containing
thousands vertices.
=> I am currently writing an application based on VTK 7.1 (
https://github.com/morphomuseum/ISE-MeshTools )
If only one vtkOpenGLActor is rendered, I have no problem to pick it, no
matter how "large" it is in terms of number of vertices, and no matter
how complex it is in terms of morphology.
But as soon as I have several vtkOpenGLActor objects rendered at the
same time, vtkAreaPicker does not behave as I would have expected.
The expected behaviour would be as follows :
- one can open several surfaces (meshes) which are opened as vtkPolyData
objects, which in turns are rendered as vtkOpenGLActor objects
- these objects can be "selected"/"unselected" using the an interactor
style such as vtkInteractorStyleRubberBandPick. The idea is that one
will interact in a second step with all the "selected" objects (= with
more than one single object at once).
I have set up my interactor style following the example :
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Picking/AreaPicking
The pick callback function is as follows :
void PickCallbackFunction(vtkObject* caller,
long unsigned int vtkNotUsed(eventId),
void* vtkNotUsed(clientData),
void* vtkNotUsed(callData))
{
std::cout << "Pick." << std::endl;
vtkAreaPicker* areaPicker= static_cast<vtkAreaPicker*>(caller);
vtkProp3DCollection* props= areaPicker->GetProp3Ds();
for(vtkIdType i= 0; i< props->GetNumberOfItems(); i++)
{
vtkProp3D* prop= props->GetNextProp3D();
std::cout << "Picked prop: " << prop<< std::endl;
}
}
As soon as I have added to the rendered several other vtkOpenGLActor
objects containing thousands of vertices, I can not get the correct
picked vtkPropr3D objects.
The same thing arises if I use a vtkRenderedAreaPicker instead.
Here is an illustration of my issue :
http://morphomuseum.com/img/vtkareapicker.jpg
Top : I have opened 5 different surface objects (mandible, maxillar,
premaxillar, upper teeth and lower teeth)
Top left : I try to select the mandible (blue rectangle)
Top right : the pickCallBack function retrieves the wrong surface object
(the maxillar => in the software I write, "selected" actors are drawn grey)
Bottom : I have opened 1 mesh containing thousands of vertices (lower
teeth) and I have set up 16 landmarks (green and orange spheres)
Bottom left : I try to pick the teeth mesh (blue rectangle).
Bottom right : nothing was selected ( props->GetNumberOfItems()==0)
Many thanks in advance if you can help,
Best wishes,
Renaud
---------------------------------------------------------
*Dr. Renaud Lebrun*
Institut des Sciences de l'Evolution
Université de Montpellier
Campus Triolet, bât. 22
Place Eugène Bataillon
34095 Montpellier cedex 5, FRANCE
Tél : +33 (0)4 67 14 32 60
renaud.Lebrun at umontpellier.fr
<mailto:renaud.lebrun at umontpellier.fr?Subject=X-Ray+%C2%B5CT+access>
MORPHOMUSEUM <http://morphomuseum.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170302/4bcd283b/attachment.html>
More information about the vtkusers
mailing list