[vtkusers] Question about vtkImagePlaneWidget and setting interactors

Zhibo Chen zcbluesky5 at gmail.com
Wed Sep 6 11:20:11 EDT 2006


Hello All,

I found that if I put vtkImagePlaneWidget into a renderwindow, then the
default interactor style is JoystickCamera. I want to change this to be some
other style, say the RubberBandZoom.  I've listed my code below. When I run
this, I get a very weird thing. If I click inside the widget, then
everything works fine. When I click and hold the left mouse button outside
the widget, it rotates, just like it would with JoystickCamera.  When I move
the mouse, the widget continues to rotate, but I also see the white box that
RubberBandZoom creates.  So it's like both interactors are working at the
same time.  I just need the window to use one style (the RubberBandZoom),
not both.  Thank you in advance for your help.


    vtkRenderer* ren1 = vtkRenderer::New();

    vtkRenderWindow* renWin = vtkRenderWindow::New();
    renWin->AddRenderer(ren1);

    vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
    iren->SetRenderWindow(renWin);

    rbz = vtkInteractorStyleRubberBandZoom::New ();
    rbz->SetInteractor (iren);

    vtkProperty* ipwProp = vtkProperty::New();

    vtkImagePlaneWidget* ipw = vtkImagePlaneWidget::New();
    ipw->SetInput(vtkReader->GetOutput());

    ipw->DisplayTextOn();
    ipw->SetInteractor(iren);
    ipw->SetKeyPressActivationValue('z');
    ipw->SetTexturePlaneProperty(ipwProp);
    ipw->TextureInterpolateOn();
    ipw->SetResliceInterpolateToCubic();
    ipw->SetPlaneOrientationToXAxes();
    ipw->SetSliceIndex(38);
    ipw->DisplayTextOn();
    ipw->On();

    renWin->Render ();
    iren->Initialize();
    iren->Start ();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060906/24330b8c/attachment.htm>


More information about the vtkusers mailing list