[vtkusers] vtkImageViewer2 show zoom factor and visible coordinates

Christian Lackas lackas at invicro.com
Thu Sep 12 04:47:08 EDT 2013


Hi Everybody,

I display a large 2D image (larger then typical screen resolutions) in a
a vtkImageViewer2 and would like to give the user some guidance as to
which part she is currently looking at.

My questions are:
* What is the easiest way to get the zoom (ratio of image to world pixels)?
* How can I get the coordinates (in image pixels) of the par of the
  image that is currently visible?

Details:

In a first steps, I would like to show the zoom level (100% = one pixel
on screen contains exactly one pixel of the image). I looked at
vtkCamera and found the Zoom(double) function, pointing me to
ParallelScale() (ParallelProjection: On), and this variable seems to be
indeed related to the zoom (larger values indicate lower zoom), however,
I was not able to derive an absolute number from this (e.g. 50%, so two
image pixels are shown in 1 pixel on screen). In my example 100% is
around ParallelScale=140.
Also vtkCamera::Get(Model)ViewTransformObject()->GetScale() does not
work (always returns 1,1,1).
I tried to use vtkCamera's Print(stream) method, however, could not find
any other values that change with the zoom, and I could not figure out
how to use GetProjectionTransformObject(double,double,double) properly.

In a next step, I would like to show a small minimap in one corner, just
consisting of two rectangles showing the full image and the current view
port. For this I would need to know which coordinates (in image pixels)
are currently shown.
Unfortunately, ImageActors DisplayExtent just contains the full
dimensions, and I have not found any other value that seems to be useful
(also not in vtkCamera).

Any help on this is highly appreciated.

Thanks,
 Christian

-- 
Dr. Christian Lackas, Managing Partner
inviCRO, LLC -- In Imaging Yours
http://www.invicro.com/  http://www.spect-ct.com/



More information about the vtkusers mailing list