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-10-27 19:51:42 $
00007   Version:   $Revision: 1.37 $
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   itkTypeMacro( BoundingBox, Object );
00079 
00081   itkNewMacro(Self);
00082 
00084   typedef TPointIdentifier                        PointIdentifier;
00085   typedef TCoordRep                               CoordRepType;
00086   typedef TPointsContainer                        PointsContainer;
00087   typedef typename PointsContainer::Pointer       PointsContainerPointer;
00088   typedef typename PointsContainer::ConstPointer  PointsContainerConstPointer;
00089 
00090   typedef Point< CoordRepType, VPointDimension >         PointType;
00091   typedef FixedArray< CoordRepType, VPointDimension*2 >  BoundsArrayType;
00092   
00094   itkStaticConstMacro(PointDimension, unsigned int,  VPointDimension);
00095 
00097   typedef typename
00098           PointsContainer::ConstIterator        PointsContainerConstIterator;
00099   typedef typename
00100           PointsContainer::Iterator             PointsContainerIterator;
00101 
00105   void SetPoints(const PointsContainer *);
00106   const PointsContainer * GetPoints(void) const;
00108 
00110   const PointsContainer * GetCorners(void);
00111 
00113   bool ComputeBoundingBox(void) const;
00114 
00120   itkGetConstReferenceMacro( Bounds, BoundsArrayType );
00121 
00124   PointType GetCenter(void) const;
00125 
00128   PointType GetMinimum(void) const;
00129 
00133   void      SetMinimum(const PointType & );
00134 
00137   PointType GetMaximum(void) const;
00138 
00142   void      SetMaximum(const PointType & );
00143 
00148   void ConsiderPoint( const PointType & );
00149 
00153   typedef typename NumericTraits<CoordRepType>::AccumulateType AccumulateType;
00154   AccumulateType GetDiagonalLength2(void) const;
00155 
00157   bool IsInside( const PointType & ) const;
00158 
00160   unsigned long GetMTime( void ) const;
00161 
00163   Pointer DeepCopy() const; 
00164 
00165 #if 0
00166 
00180   bool IntersectWithLine(CoordRepType origin[PointDimension],
00181        CoordRepType direction[PointDimension],
00182        CoordRepType coords[PointDimension],
00183        CoordRepType* t);
00184 
00185 #endif
00186 
00187 protected:
00188   BoundingBox(); 
00189   virtual ~BoundingBox(); 
00190   void PrintSelf(std::ostream& os, Indent indent) const;
00191 
00192   typedef typename PointsContainer::ConstIterator  ConstIterator; 
00193 
00194 private:
00195   BoundingBox(const Self&); //purposely not implemented
00196   void operator=(const Self&); //purposely not implemented
00197 
00198   PointsContainerConstPointer m_PointsContainer;
00199   PointsContainerPointer      m_CornersContainer;
00200   mutable  BoundsArrayType    m_Bounds;
00201   mutable  TimeStamp          m_BoundsMTime; // The last time the bounds 
00202                                              // were computed.
00203 
00204 };
00205 
00206 } // end namespace itk
00207 
00208 #ifndef ITK_MANUAL_INSTANTIATION
00209 #include "itkBoundingBox.txx"
00210 #endif
00211   
00212 #endif
00213 

Generated at Mon Apr 14 11:50:12 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000