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

Dawood Masslawi masslawi at gmail.com
Sat Mar 19 10:52:21 EDT 2011


Hi Alexander,
In addition to what Robert said, take a look at this submission to the Insight Journal by
David Doria (Criminisi Inpainting), see if it's what you are looking for,
http://hdl.handle.net/10380/3250
Good luck,
Dawood

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

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


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110319/e90af0d8/attachment.htm>


More information about the Insight-users mailing list