Change response of render window to interactions

I am using a Qvtkwidget to display images in an application. Image interactions are enabled via render window interactor. vtkinteractorstyle image is used. Clicking and dragging on the image results in window and level change. However the scale of this change is drastic. Is there any way to reduce the range of this change? Or rather change the response of click and drag to say, panning the image.

Pressing down shift button + click and drag OR
Mouse wheel down and drag, results in panning the image.
Could it be manipulated so that simple click and drag pans the image.

Hello,

One way to do it is to extend/customize one of the vtkInteractorStyle* classes like this one here: gammaray/v3dmouseinteractor.h at master · PauloCarvalhoRJ/gammaray · GitHub. This one is a modified vtkInteractorStyleTrackballCamera to enable probing of mesh values via mouse picking with a probe marker. The probe marker is a small red sphere that must be resized according to the zoom applied so its angular size stays the same. To use a custom interactor style, do like this:

    m_myInteractorStyle = vtkSmartPointer<myInteractorStyle>::New();
    m_myInteractorStyle->SetDefaultRenderer( m_renderer );
    m_vtkwidget->renderWindow()->GetInteractor()->SetInteractorStyle( m_myInteractorStyle );

In the example above, m_vtkwidget is a QVTKOpenGLNativeWidget.

1 Like

I was able to implement a custom interactor class keeping the link you shared as reference. And could achieve the desired behavior. Thanks a ton!

1 Like