[Insight-users] crop and image based on bounding box then pad to original dimensions

robert tamburo robert.tamburo at gmail.com
Thu Mar 17 11:36:51 EDT 2011


There may be a more elegant way, but I would do the following:

- Create a copy of the input image with ImageDuplicator. Fill the duplicated
image with zeroes.
- Use RegionOfInterestImageFilter to extract the computed region from the
input image.
- Perform filtering on the output of the ROI filter.
- Use PasteImageFilter to copy the filter result into the zero-filled image.

See http://www.itk.org/Wiki/ITK/Examples for example usage of the
aforementioned filters.


On Thu, Mar 17, 2011 at 10:51 AM, Alexander Taghva <alextaghva at gmail.com>wrote:

> Hello,
>
> I would like to take an image, crop it to its nonzero content, perform some
> filtering, then zero pad the image back to its original dimensions.  So far,
> I am able to compute the bounding box with a mask spatial object doing
> something like this:
>
> RegionType boundingBoxRegion = m_MaskSO->GetAxisAlignedBoundingBoxRegion();
>
>  but I don't know where to go from here.  I'm relatively new to ITK.
> Thanks for your help.
>
> Alex
>
> _____________________________________
> 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.html
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110317/07a785c4/attachment.htm>


More information about the Insight-users mailing list