Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkBoundingBox.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkBoundingBox.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/04/06 12:50:58 $
00007   Version:   $Revision: 1.36 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012   Portions of this code are covered under the VTK copyright.
00013   See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
00014 
00015      This software is distributed WITHOUT ANY WARRANTY; without even 
00016      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00017      PURPOSE.  See the above copyright notices for more information.
00018 
00019 =========================================================================*/
00020 #ifndef __itkBoundingBox_h
00021 #define __itkBoundingBox_h
00022 
00023 #include "itkObject.h"
00024 #include "itkPoint.h"
00025 #include "itkNumericTraits.h"
00026 #include "itkVectorContainer.h"
00027 #include "itkFixedArray.h"
00028 
00029 
00030 namespace itk
00031 {
00032 
00061 template <
00062   typename TPointIdentifier = unsigned long,
00063   int VPointDimension = 3,
00064   typename TCoordRep = float,
00065   typename TPointsContainer = 
00066     VectorContainer< TPointIdentifier,Point<TCoordRep, VPointDimension> >
00067   >
00068 class ITK_EXPORT BoundingBox : public Object
00069 {
00070 public:
00072   typedef BoundingBox               Self;
00073   typedef Object                    Superclass;
00074   typedef SmartPointer<Self>        Pointer;
00075   typedef SmartPointer<const Self>  ConstPointer;
00076 
00078   itkNewMacro(Self);
00079 
00081   typedef TPointIdentifier                        PointIdentifier;
00082   typedef TCoordRep                               CoordRepType;
00083   typedef TPointsContainer                        PointsContainer;
00084   typedef typename PointsContainer::Pointer       PointsContainerPointer;
00085   typedef typename PointsContainer::ConstPointer  PointsContainerConstPointer;
00086 
00087   typedef Point< CoordRepType, VPointDimension >         PointType;
00088   typedef FixedArray< CoordRepType, VPointDimension*2 >  BoundsArrayType;
00089   
00091   itkStaticConstMacro(PointDimension, unsigned int,  VPointDimension);
00092 
00094   typedef typename
00095           PointsContainer::ConstIterator        PointsContainerConstIterator;
00096   typedef typename
00097           PointsContainer::Iterator             PointsContainerIterator;
00098 
00102   void SetPoints(const PointsContainer *);
00103   const PointsContainer * GetPoints(void) const;
00105 
00107   const PointsContainer * GetCorners(void);
00108 
00110   bool ComputeBoundingBox(void) const;
00111 
00117   itkGetConstReferenceMacro( Bounds, BoundsArrayType );
00118 
00121   PointType GetCenter(void) const;
00122 
00125   PointType GetMinimum(void) const;
00126 
00130   void      SetMinimum(const PointType & );
00131 
00134   PointType GetMaximum(void) const;
00135 
00139   void      SetMaximum(const PointType & );
00140 
00145   void ConsiderPoint( const PointType & );
00146 
00150   typedef typename NumericTraits<CoordRepType>::AccumulateType AccumulateType;
00151   AccumulateType GetDiagonalLength2(void) const;
00152 
00154   bool IsInside( const PointType & ) const;
00155 
00157   unsigned long GetMTime( void ) const;
00158 
00160   Pointer DeepCopy() const; 
00161 
00162 #if 0
00163 
00177   bool IntersectWithLine(CoordRepType origin[PointDimension],
00178        CoordRepType direction[PointDimension],
00179        CoordRepType coords[PointDimension],
00180        CoordRepType* t);
00181 
00182 #endif
00183 
00184 protected:
00185   BoundingBox(); 
00186   virtual ~BoundingBox(); 
00187   void PrintSelf(std::ostream& os, Indent indent) const;
00188 
00189   typedef typename PointsContainer::ConstIterator  ConstIterator; 
00190 
00191 private:
00192   BoundingBox(const Self&); //purposely not implemented
00193   void operator=(const Self&); //purposely not implemented
00194 
00195   PointsContainerConstPointer m_PointsContainer;
00196   PointsContainerPointer      m_CornersContainer;
00197   mutable  BoundsArrayType    m_Bounds;
00198   mutable  TimeStamp          m_BoundsMTime; // The last time the bounds 
00199                                              // were computed.
00200 
00201 };
00202 
00203 } // end namespace itk
00204 
00205 #ifndef ITK_MANUAL_INSTANTIATION
00206 #include "itkBoundingBox.txx"
00207 #endif
00208   
00209 #endif
00210 

Generated at Sun Sep 23 12:03:11 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000