[vtkusers] Repositioning Image within Render Window

David Gobbi david.gobbi at gmail.com
Wed Oct 20 18:40:03 EDT 2010


On Wed, Oct 20, 2010 at 4:33 PM, David Doria <daviddoria at gmail.com> wrote:
> On Wed, Oct 20, 2010 at 6:31 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>
>> 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
>
> Here is an example of using an ImageActor as David G. suggested:
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/InteractWithImage

Except that example doesn't do anything with the camera positioning.
It is impossible to adjust the image position without moving the
camera, because VTK's default camera setting will always center the
actor within the window.

  David



More information about the vtkusers mailing list