Question

I have an image in VTK that I'm viewing with vtkImageViewer2, and I want to zoom in on a point the user clicks on. I am working in Java. Does anyone know how to do this?

Thanks

Was it helpful?

Solution

I realize you ask for Java, but my experience doing this has been with c++; equivalent java syntax should work, minus the customizability.

Take a look at these examples for picking and zooming. Also, if you set the interactor style to 'image', the mouse wheel should cause a zoom to wherever the cursor is. You probably don't want to do literally what you asked, but rather either do rubberband zoom or have the mousewheel for zooming. Clicking should do something, not just change the view.

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/PickingAPixel2

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/RubberBandZoom

OTHER TIPS

Depending on what you mean by zoom you want to either change the position and direction of the camera (likely) or change the frustum (unlikely).

Have a look at the methods setPosition() and setFocalPoint() in class vtkCamera. Here is the documentation of vtkCamera:

http://www.vtk.org/doc/nightly/html/classvtkCamera.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top