[vtkusers] vtkImageResize doesn't resize...

David Gobbi david.gobbi at gmail.com
Mon May 23 14:50:30 EDT 2016


Hi Filippo,

The code looks correct.  It should resample the the image to "maxWidth"
and "maxHeight".  Note that "resampling" means that it changes the size
of the voxels and hence changes the resolution of the image. It does not
change the size of the image on the screen, if that is what you are trying
to do.  In order to do that, you would have to zoom in with the camera.

 - David


On Mon, May 23, 2016 at 11:56 AM, Jecko90 <filippo.santarelli at unicam.it>
wrote:

> Hi!!
>
> I'm trying to resize all the vtkImageActors of a vtkRenderer to a fixed
> width and height.
> The code snippet below in my nooby opinion should work, instead it does
> nothing.
> What are the mistakes I did?
>
> I've been stuck with this problem for days...Please help me to solve it!!
>
>         vtkSmartPointer<vtkProp> Prop = PropCollection->GetNextProp();
>         if (Prop->IsA("vtkImageActor")) {
>             vtkSmartPointer<vtkImageActor> ImageActor =
> vtkImageActor::SafeDownCast(Prop);
>
>             vtkSmartPointer<vtkImageResize> ImageResize =
> vtkSmartPointer<vtkImageResize>::New();
>             ImageResize->SetResizeMethodToOutputDimensions();
>             ImageResize->SetOutputDimensions(maxWidth, maxHeight, -1);
>             ImageResize->SetInputData(ImageActor->GetMapper()->GetInput());
>             ImageResize->Update();
>
> ImageActor->GetMapper()->SetInputConnection(ImageResize->GetOutputPort());
>         }
>         renderWindow->Render();
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160523/20267a56/attachment.html>


More information about the vtkusers mailing list