[Insight-users] Is there any itk::BoundingBox example?

Juliette Deniau juliette.deniau at yahoo.fr
Mon Oct 26 12:25:12 EDT 2009


Thank you Luis for adding the required example. However, how can I do to access this file?
Shall I download the latest version or is there any fastest method to get this file?
Sorry for my silly question!
Thanks 
Juliette


--- En date de : Mer 21.10.09, Luis Ibanez <luis.ibanez at kitware.com> a écrit :


De: Luis Ibanez <luis.ibanez at kitware.com>
Objet: Re: [Insight-users] Is there any itk::BoundingBox example?
À: "Juliette Deniau" <juliette.deniau at yahoo.fr>
Cc: "insight" <insight-users at itk.org>
Date: Mercredi 21 Octobre 2009, 17h32



Hi Juliette,


For your convenience,

We just added to ITK an example on how to do this 
by using the ImageMaskSpatial object and its method:

          GetAxisAlignedBoundingBoxRegion()


This new example  is now under the directory:

            Insight/Examples/SpatialObjects

The filename is:

   BoundingBoxFromImageMaskSpatialObject.cxx

and the essential part of the code is:


 typedef itk::ImageMaskSpatialObject<3>      ImageMaskSpatialObject;

  typedef ImageMaskSpatialObject::ImageType   ImageType;
  typedef ImageType::RegionType               RegionType;
  typedef itk::ImageFileReader< ImageType >   ReaderType;

  ReaderType::Pointer reader = ReaderType::New();

  reader->SetFileName( argv[1] );
  reader->Update();

  ImageMaskSpatialObject::Pointer maskSO = ImageMaskSpatialObject::New();

  maskSO->SetImage ( reader->GetOutput() );

  RegionType boundingBoxRegion  = maskSO->GetAxisAlignedBoundingBoxRegion();

  std::cout << "Bounding Box Region: " << boundingBoxRegion << std::endl;


Here we assume that you are reading a binary image.

Note  that the bounding box is actually stored in an
itk::Region<3> class, instead of an itk::BoundingBox
class.

The main difference between these two classes is that the
Region represents pixels (discrete positions on the image 
grid), while the itk::BoundingBox represents physical 
coordinates in Space.


Another option that you may want to consider is the use 
of the LabelMap classes contributed by Gaetan Lehmann.

  http://www.insight-journal.org/browse/publication/176

These classes are now in the directory:

           Insight/Code/Review

In particular the 

          itkAutoCropLabelMapFilter.h

will do both:

  * Computing the bounding box
  * Extracting that region from the image.

These family of classes will also compute features
such as the center of gravity, if you actually need
such values as well.


  Regards,


        Luis


-------------------------------------------------------------------------------------

On Mon, Oct 19, 2009 at 6:48 AM, Juliette Deniau <juliette.deniau at yahoo.fr> wrote:






Hi, 
I would like to get the bounding box of a segmented object .  Currently I’m doing that by computing the min, max, and the center of gravity of the object . I would like to do it using the already itk class itk:: BoundingBox,  however I don’t know how? Any help is appreciated. 
Thanks 
Juliette

_____________________________________
Powered by 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 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/20091026/018172eb/attachment.htm>


More information about the Insight-users mailing list