[vtkusers] Problem with resizing an image

David Gobbi david.gobbi at gmail.com
Thu Mar 1 05:17:45 EST 2018


On Wed, Feb 28, 2018 at 4:11 PM, ochampao <ochampao at hotmail.com> wrote:
>
> The first approach uses vtkImageResize. When using this approach the image
> that I am trying to resize appears unchanged on the screen.
>

Well, vtkImageResize is actually a resampling filter.  So if you use it to
change the Dimensions of the image, it's really resampling the image
at a new resolution (i.e. a new pixel Spacing).

So if you want to stretch one PNG so that it fits over another, then two
steps are needed:
1) use vtkImageResize to resample
2) then use vtkImageChangeInformation to set the Spacing to be
the same as the other image

Also look at the BorderOn()/BorderOff() option of vtkImageResize.



> The second approach uses vtkImageReslice. When using this approach the
> image
> is cropped rather than resized to match the dimensions of the first image
> (the image to be resized has larger dimensions). So this approach works
> partially.
>

I won't go into detail, but the general idea is that unless you use
SetResliceTransform() or SetResliceAxes() to apply a physical image
transformation, vtkImageReslice just does resampling and/or cropping
and padding.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180301/d89bd2d4/attachment.html>


More information about the vtkusers mailing list