[vtkusers] Resize an arbitrarily sized image

Cameron Lowell Palmer cameron.palmer at ntnu.no
Thu Feb 5 09:38:23 EST 2015


For the record, this is a code sample that does the job:

    auto imageChangeInformation = vtkSmartPointer<vtkImageChangeInformation>::New();
    imageChangeInformation->SetInputData(imageData);
    imageChangeInformation->SetOutputSpacing(0.035f, 0.035f, 0.035f);
    imageChangeInformation->Update();
    vtkImageData *resizeImageData = imageChangeInformation->GetOutput();

I still think manipulating the spacing is an odd way to do this.

cameron

On 5. feb. 2015, at 15.20, Cameron Lowell Palmer <cameron.palmer at ntnu.no<mailto:cameron.palmer at ntnu.no>> wrote:

That is very helpful, indeed. I’ll try it out

Thanks,

Cameron.

On 5. feb. 2015, at 15.17, Bill Lorensen <bill.lorensen at gmail.com<mailto:bill.lorensen at gmail.com>> wrote:

You can use vtkImageChangeInformation to change the pixel size(spacing
in VTK terminology). Use the SetOutputSpacing. This filter does not
resample.

On Thu, Feb 5, 2015 at 7:09 AM, Cameron Lowell Palmer
<cameron.palmer at ntnu.no<mailto:cameron.palmer at ntnu.no>> wrote:
From my standpoint an image is a bitmap, a field of dimensionless colored
dots. When it comes to output it should be a matter of saying here is your
space draw yourself here. So in my app, most objects are defined in mm
because it just makes sense to do so for organs, but I have also imported a
2000x2000 px PNG. This is purely an experiment in dealing with image
manipulation so the image is deliberately large. So I want this logo to be
7x7 cm in real terms.

Now I have some options, but the question is what is the VTK way?

* I can resample the image down to 70x70 and assign spacing of (1, 1, 1).
* I can scale the image plane it is applied to.
* Third option goes here.

I’ve tried vtkImageResample and when you set an axis magnification of 0.5f
you get a doubling of spacing and a halving of extent, but the bounds
mostly(!) remains the same. Still, this isn’t really what I want, I want to
just say, “Mr. Image you are 70mm.” BTW Talking to the image data didn’t
work either.


On 5. feb. 2015, at 14.37, Bill Lorensen <bill.lorensen at gmail.com<mailto:bill.lorensen at gmail.com>> wrote:

What do you mean by size of the image?

On Feb 5, 2015 3:21 AM, "Cameron Lowell Palmer" <cameron.palmer at ntnu.no<mailto:cameron.palmer at ntnu.no>>
wrote:

I’m looking for a recommendation on how to scale imageData to a specific
size.

I’ve used vtkImageResample, but what I really want to do is load a large
image, and then reset the size at some point. Ideally I would be able to
non-destructively change the size of the object.

Thanks,

cameron.


_______________________________________________
Powered by www.kitware.com<http://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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers





--
Unpaid intern in BillsBasement at noware dot com

_______________________________________________
Powered by www.kitware.com<http://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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150205/009af70c/attachment.html>


More information about the vtkusers mailing list