[vtkusers] Set position of vtkImageSlice

David Lonie david.lonie at kitware.com
Tue Nov 13 16:40:28 EST 2012


On Tue, Nov 13, 2012 at 4:32 PM, David Doria <daviddoria at gmail.com> wrote:
> On Tue, Nov 13, 2012 at 4:24 PM, David Lonie <david.lonie at kitware.com>
> wrote:
>> Trouble is, no matter what I set the position of the actor to, the
>> image appears in the center of the scene. Is this expected behavior?
>> Is there a better class to use for this sort of thing?
>
> I would imagine a ResetCamera() is getting called somewhere after you add
> the image (which I believe "looks at" the center of the bounding box of all
> of the actors in the scene). Try adding something else to the scene (say a
> sphereSource->GetOutput()) at (0,0,0) and see if you image is in the correct
> position relative to that. If so, then we'll have to figure out how to
> suppress that ResetCamera() call.

You got it -- that was the problem. I added a call to
vtkRenderWindow::Render() before adding the actors and that fixed it.

Thanks!
Dave



More information about the vtkusers mailing list