[ITK] [ITK-users] Adding two images of different sizes

Bradley Lowekamp blowekamp at mail.nih.gov
Tue May 13 16:53:52 EDT 2014


Hello,

You should be able to use the ChangeInformationImageFilter to change the origin, spacing, and directions to match where you want the smaller image in the larger.

You can take advantage of the pipeline to pad the image by the correct about. Use the ConstantPadImageFilter, and set the padding to a very large number like the size of the larger image. The use the AddImageFilter with the larger image as the first input and the padded as the second.

Now this is the pipeline magic, the output image size of the AddImageFilter is defined by the size of the first input image. The requested region to the ConstantPadImageFilter is going to be the same as the size of the larger image. The Pad filter is just going to produce the an output image the size of the request. The pad filter could have a padding set to 10,000, but's its not going to ever generate an image that big because it's only going to generate the requested region.

Hope that helps,
Brad

On May 13, 2014, at 4:38 PM, Nicolas Gallego <nicgallego at gmail.com> wrote:

> Hi Ricky,
> I would start by resampling one image in the space of the other, probably with some translation and the add them or do what you need:
> itkResampleImageFilter
> itkTranslationTransform
> itkAddImageFilter
> 
> Remember that itk pipelines checks for physical space coordinates, you have to make sure both images are on the same physical space (origin and spacing)
> 
> Hope that helps
> 
> Nicolas Gallego
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users

_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users



More information about the Community mailing list