[vtkusers] Set position of vtkImageSlice

Jonathan Ruiz Peinado jonathan.ruiz3 at gmail.com
Tue Nov 13 16:37:38 EST 2012


You can perform translations, origin relocation, etc with
vtkImageChangeInformation, I think it could work for you.

vtkImageChangeInformation normalized = new vtkImageChangeInformation();
normalized.SetInputConnection( reader.GetOutputPort() );   // You can use
setInput instead
normalized.SetOutputOrigin( 100, 100, 0 );     //There're others methods
that can fit better your needs take a look to the documentation.
                .SetOrigin
                .Set...Translation
normalized.Update();

2012/11/13 David Lonie <david.lonie at kitware.com>

> 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
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121113/0439ec17/attachment.htm>


More information about the vtkusers mailing list