[vtkusers] Re: turning auto scaling off in vtk

Anja Ende anja.ende at googlemail.com
Thu Aug 17 03:47:14 EDT 2006

Goodwin & Obada,

Thanks for your replies. I will play around with it today and if no joy, I
will stick with vtkImageViewer.

Thanks again :)

On 17/08/06, Obada Mahdi <omahdi at gmx.de> wrote:
> Hi Anja!
> Anja Ende wrote:
> [undistorted display of preprocessed image using vtkImageViewer2]
> > Another curious thing is that if I do not call ResetCamera in my derived
> > class, the image gets displayed with a very high zoom factor!
> >
> > I really do not understand what is happening with this function here.
> > Please, if anyone has some thoughts on this, please please share!
> Some thoughts, coming up:
> According to the documentation, vtkImageViewer2 provides a simple 3D
> scenario that places an vtkImageActor into the scene (facing the
> camera).  In particular, displaying an image this way involves other
> (projection) transforms defined by camera parameters, just like with any
> other 3D scenario.
> >> It seems to be the ResetCamera() function that rescales the image.
> What you are experiencing as "auto-scaling" is indeed a result of
> ResetCamera(), which tries to adjust camera parameters in a way such
> that all actors are visible (or, more precisely, such that the enclosing
> sphere of any actor's bounding box fits into the resulting view frustrum
> -- that's why a single rectangular image still doesn't max out the
> render window in either dimension).
> Without an initial call to ResetCamera(), camera defaults are used,
> which, in conjunction with your image dimensions and spacing, result in
> that "very high zoom factor" you mentioned.
> The vtkImageViewer wrapper class, on the other hand, uses 2D
> actors/mappers, so there is no projection transform to bother with.
> I guess the "right" way to deal with this depends on what you want to
> do.  If you just want to display image data exactly as produced by your
> own filtering pipeline, you might be better off with vtkImageViewer (or
> a home-brewed analogon involving vtkActor2D/vtkImageMapper).
> If, on the other hand, you'd rather stick with vtkImageViewer2 but want
> to have more control over the transform induced by camera parameters,
> you might want to have a closer look at what vtkCamera and
> vtkRenderer::ResetCamera() do.  I'd say there is a way to set up the
> camera such that the results mimic vtkImageViewer (starting with
> ParallelProjectionOn()), and calls to vtkRenderer::ResetCamera() can be
> observed and acted upon by registering for the ResetCameraEvent -- but
> frankly, I'm not sure if it is worth the effort.
> HTH, and apologies if I shared too much :-)
> Obada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060817/fa45706c/attachment.htm>

More information about the vtkusers mailing list