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: 2003/01/09 18:10:04 $
00007   Version:   $Revision: 1.29 $
00008 
00009   Copyright (c) 2002 Insight 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   typedef Point< CoordRepType, VPointDimension >  PointType;
00087   typedef FixedArray< CoordRepType, VPointDimension*2 >  BoundsArrayType;
00088   
00090   itkStaticConstMacro(PointDimension, unsigned int,  VPointDimension);
00091 
00093   typedef typename
00094           PointsContainer::ConstIterator        PointsContainerConstIterator;
00095   typedef typename
00096           PointsContainer::Iterator             PointsContainerIterator;
00097     
00101   void SetPoints(const PointsContainer *);
00102   const PointsContainer * GetPoints(void) const;
00103   
00105   bool ComputeBoundingBox(void);
00106 
00110   itkGetConstMacro( Bounds, BoundsArrayType );
00111 
00114   PointType GetCenter(void);
00115 
00118   PointType GetMinimum(void);
00119 
00123   void      SetMinimum(const PointType & );
00124 
00127   PointType GetMaximum(void);
00128 
00132   void      SetMaximum(const PointType & );
00133 
00138   void ConsiderPoint( const PointType & );
00139 
00143   typedef typename NumericTraits<CoordRepType>::AccumulateType AccumulateType;
00144   AccumulateType GetDiagonalLength2(void);
00145   
00147   bool IsInside( const PointType & );
00148 
00150   unsigned long GetMTime( void ) const;
00151 
00152 #if 0
00153 
00167   bool IntersectWithLine(CoordRepType origin[PointDimension],
00168        CoordRepType direction[PointDimension],
00169        CoordRepType coords[PointDimension],
00170        CoordRepType* t);
00171   
00172 #endif
00173 
00174 protected:
00175   BoundingBox(); 
00176   virtual ~BoundingBox(); 
00177   void PrintSelf(std::ostream& os, Indent indent) const;
00178 
00179   typedef typename PointsContainer::ConstIterator  ConstIterator; 
00180 
00181 private:
00182   BoundingBox(const Self&); //purposely not implemented
00183   void operator=(const Self&); //purposely not implemented
00184 
00185   PointsContainerConstPointer m_PointsContainer;
00186   BoundsArrayType m_Bounds;
00187   TimeStamp m_BoundsMTime; //The last time the bounds were computed.
00188 
00189 };
00190 
00191 } // end namespace itk
00192 
00193 #ifndef ITK_MANUAL_INSTANTIATION
00194 #include "itkBoundingBox.txx"
00195 #endif
00196   
00197 #endif

Generated at Fri May 21 01:14:29 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000