00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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&);
00159 void operator=(const Self&);
00160
00161 PointsContainerConstPointer m_PointsContainer;
00162 BoundsArrayType m_Bounds;
00163 TimeStamp m_BoundsMTime;
00164
00165 };
00166
00167 }
00168
00169 #ifndef ITK_MANUAL_INSTANTIATION
00170 #include "itkBoundingBox.txx"
00171 #endif
00172
00173 #endif