[vtkusers] Repositioning Image within Render Window
David Gobbi
david.gobbi at gmail.com
Wed Oct 20 18:31:42 EDT 2010
Hi Alexis,
The vtkImageActor is the most common way of displaying an image. It
assumes that the image data is already in the correct coordinate
system (and if the image is not yet in the right coordinate system,
then its Origin and Spacing can be adjusted with
vtkImageChangeInformation). That is usually the best method for
displaying an image. If you try displaying an image with vtkTexture
instead, then you have to take care of all the details like aspect
ratio, position, texture coords, etc. yourself.
And, as John said, you must also consider the camera, because it is
what determines how the "World Coordinates" of the 3D scene are
translated into view that you see on the computer screen. For 2D
image viewing, you usually want to set ParallelProjectionOn() and use
SetParallelScale() to set how large the view is, in world coordinates.
Then set the camera FocalPoint to the center of your image, set the
camera Position about 1000mm away from the focal point (i.e. looking
towards it), and then set the ViewUp() so that the image will be
correctly oriented on the screen.
David
On Wed, Oct 20, 2010 at 4:15 PM, Alexis Cheng <acheng_1221 at hotmail.com> wrote:
> Hi,
>
> I am trying to map a texture on a quad similar to this tutorial :
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/TextureMapQuad
>
> I'm having trouble displaying the image at the desired position on a render
> window. I've tried changing the the value of points and it scales the image
> with respect to each of the other points, but has no effect on the image's
> position. I've also tried texturedQuad->SetPosition( x, y, z) with no
> success. What other functions could be used to position an image within a
> render window? Thanks in advance.
>
> Alexis Cheng
> Electrical Engineering
> University of British Columbia
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
More information about the vtkusers
mailing list