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: 2004/02/03 20:27:39 $
00007   Version:   $Revision: 1.32 $
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   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) const;
00106 
00112   itkGetConstReferenceMacro( Bounds, BoundsArrayType );
00113 
00116   PointType GetCenter(void) const;
00117 
00120   PointType GetMinimum(void) const;
00121 
00125   void      SetMinimum(const PointType & );
00126 
00129   PointType GetMaximum(void) const;
00130 
00134   void      SetMaximum(const PointType & );
00135 
00140   void ConsiderPoint( const PointType & );
00141 
00145   typedef typename NumericTraits<CoordRepType>::AccumulateType AccumulateType;
00146   AccumulateType GetDiagonalLength2(void) const;
00147   
00149   bool IsInside( const PointType & ) const;
00150 
00152   unsigned long GetMTime( void ) const;
00153 
00154 #if 0
00155 
00169   bool IntersectWithLine(CoordRepType origin[PointDimension],
00170        CoordRepType direction[PointDimension],
00171        CoordRepType coords[PointDimension],
00172        CoordRepType* t);
00173   
00174 #endif
00175 
00176 protected:
00177   BoundingBox(); 
00178   virtual ~BoundingBox(); 
00179   void PrintSelf(std::ostream& os, Indent indent) const;
00180 
00181   typedef typename PointsContainer::ConstIterator  ConstIterator; 
00182 
00183 private:
00184   BoundingBox(const Self&); //purposely not implemented
00185   void operator=(const Self&); //purposely not implemented
00186 
00187   PointsContainerConstPointer m_PointsContainer;
00188   mutable  BoundsArrayType    m_Bounds;
00189   mutable  TimeStamp          m_BoundsMTime; //The last time the bounds were computed.
00190 
00191 };
00192 
00193 } // end namespace itk
00194 
00195 #ifndef ITK_MANUAL_INSTANTIATION
00196 #include "itkBoundingBox.txx"
00197 #endif
00198   
00199 #endif

Generated at Tue Mar 29 23:47:41 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000