How to put a limit to zoom in?

Hi everyone,

I have a series of image volumes with different resolutions, and I’m developing a visualization tool with some UI features for the users to navigate different resolutions. I want to set up a limit for vtkInteractorStyleTrackballCamera::OnMouseWheelForward(), so that when the user keeps scrolling the wheel, it will eventually change switch to another volume of the same area but with lower resolution.

I notice that there’s vtkCamera::zoom() where one can explicitly specify a factor to decide how much to zoom an object. I understand that this factor is probably a relative scaling factor with respect to the current state of the object, so there’s no ‘Get’ method provided for this factor. Is there a way to measure how much an object has been zoomed in or out?

Thank you so much in advanced!

Hello,

One way to do it is to extend/customize the vtkInteractorStyleTrackballCamera classe like this one here: gammaray/v3dmouseinteractor.h at master · PauloCarvalhoRJ/gammaray · GitHub. That 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.