[vtkusers] how to pick one vtkimageviewer2 from multi-vtkimageviewer2?

Mark Jefferson mark.jefferson at qq.com
Sun May 4 21:53:59 EDT 2008


Hi, everyone,
  I am displaying several 2D images using class vtkImageViewer2, of course, there is several objects of class vtkImageViewer2. and I want to know which object would be picked when I press my mouse left button. so I want to use vtkPointPicker to do it.
  however, the actor of class vtkImageViewer2 is vtkImageActor, while class vtkPointPicker could only get a object of class vtkActor by method GetActor(). so I have to change my mind. I want to testify which vtkImageViewer2 would be picked by class vtkRenderWindowInteractor.
  I add a mouse events observer like:
virtual void execute(...) {
    // picker and viewer are pointers to the actual vtkPointPicker/vtkImageViewer2 objects.
    int i = picker->Pick(viewer->GetRenderWindow()->GetInteractor()->GetEventPosition()[0],
          viewer->GetRenderWindow()->GetInteractor()->GetEventPosition()[1],
          viewer->GetSlice(), viewer->GetRenderer());
    if (i == 0) 
    {
        return;
    }
    vtkRenderWindowInteractor * temp = picker->GetRenderer()->GetRenderWindow()->GetInteractor();
    // .... and then test which vtkImageViewer2 the interactor is in
    // but it don't work!!!!
} 
  who can tell me how to pick one object of vtkImageViewer2 from the objects set of vtkImageViewer2? is there any method to know whick one I have picked?
  thank you!
  MJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080505/32f50294/attachment.htm>


More information about the vtkusers mailing list