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: 2002/09/11 19:39:03 $
00007   Version:   $Revision: 1.28 $
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) const;
00115 
00119   typedef typename NumericTraits<CoordRepType>::AccumulateType AccumulateType;
00120   AccumulateType GetDiagonalLength2(void);
00121   
00123   bool IsInside( const PointType & );
00124 
00126   unsigned long GetMTime( void ) const;
00127 
00128 #if 0
00129 
00143   bool IntersectWithLine(CoordRepType origin[PointDimension],
00144        CoordRepType direction[PointDimension],
00145        CoordRepType coords[PointDimension],
00146        CoordRepType* t);
00147   
00148 #endif
00149 
00150 protected:
00151   BoundingBox(); 
00152   virtual ~BoundingBox(); 
00153   void PrintSelf(std::ostream& os, Indent indent) const;
00154 
00155   typedef typename PointsContainer::ConstIterator  ConstIterator; 
00156 
00157 private:
00158   BoundingBox(const Self&); //purposely not implemented
00159   void operator=(const Self&); //purposely not implemented
00160 
00161   PointsContainerConstPointer m_PointsContainer;
00162   BoundsArrayType m_Bounds;
00163   TimeStamp m_BoundsMTime; //The last time the bounds were computed.
00164 
00165 };
00166 
00167 } // end namespace itk
00168 
00169 #ifndef ITK_MANUAL_INSTANTIATION
00170 #include "itkBoundingBox.txx"
00171 #endif
00172   
00173 #endif

Generated at Wed Mar 12 01:12:49 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000