[Insight-users] Re: Need a Help in ITK : How to find bounding box of an image region.

Luis Ibanez luis.ibanez at kitware.com
Sun Oct 28 14:21:25 EDT 2007



Hi Ihab,

You can use the following code for finding the bounding box of the
non-zero content of your image:

   typedef itk::ImageMaskSpatialObject< 3 > ImageMaskSpatialObjectType;

   ImageMaskSpatialObjectType::Pointer
      imageMaskSpatialObject  = ImageMaskSpatialObjectType::New();

   imageMaskSpatialObject->SetImage ( inputImage );

   MaskFloatImageType::RegionType boundingBoxRegion =
     imageMaskSpatialObject->GetAxisAlignedBoundingBoxRegion();


If your image doesn't have full zeros outside of the brain, then you
should threshold it first, before passing it to the ImageMaskSpatial
Object.


    Regards,


       Luis


-------------------
Ihab Khoury wrote:
> Dear Luis,
>  
> This is Ihab Khoury, I'm working in a Medical 3D Image Registration,
> please take a look at the attached image (1.jpg) first then (2.jpg).
>  
> I want to extract the region from image 1 as it is appears in image 2 
> "Automatically" without setting the region manualy,
>  
> so please can you help me, how can i do this? and what filters should i use?
>  
> Thank you
>  
> Regards
>  
> -----
> Ihab Khoury
> khouryit at yahoo.com
> Spain-Pamplona
> Mobile: +34 652 110 423
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 


More information about the Insight-users mailing list