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);
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&);
00183 void operator=(const Self&);
00184
00185 PointsContainerConstPointer m_PointsContainer;
00186 BoundsArrayType m_Bounds;
00187 TimeStamp m_BoundsMTime;
00188
00189 };
00190
00191 }
00192
00193 #ifndef ITK_MANUAL_INSTANTIATION
00194 #include "itkBoundingBox.txx"
00195 #endif
00196
00197 #endif