[vtkusers] Set position of vtkImageSlice

David Lonie david.lonie at kitware.com
Tue Nov 13 16:24:41 EST 2012


Sorry for the noise -- message got sent too early last time...

Hi list,

I'm writing a test for some new functionality that will generate
several vtkImageData instances and render them at different positions.

I'm setting up a vtkImageSlice like this:

vtkNew<vtkImageData> image1;
// Generate image...
vtkNew<vtkImageSliceMapper> mapper1;
mapper1->SetInputData(image1.GetPointer());
vtkNew<vtkImageSlice> actor1;
actor1->SetMapper(mapper1.GetPointer());
actor1->SetPosition(10, 10, 10);

then adding the actor to the renderer as usual. The docs for vtkImageSlice say:

"Prop3D methods such as SetPosition() and RotateWXYZ() change the
position and orientation of the data with respect to VTK world
coordinates."

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?

Thanks,

Dave



More information about the vtkusers mailing list