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
00087 typedef Point< CoordRepType, VPointDimension > PointType;
00088 typedef FixedArray< CoordRepType, VPointDimension*2 > BoundsArrayType;
00089
00091 itkStaticConstMacro(PointDimension, unsigned int, VPointDimension);
00092
00094 typedef typename
00095 PointsContainer::ConstIterator PointsContainerConstIterator;
00096 typedef typename
00097 PointsContainer::Iterator PointsContainerIterator;
00098
00102 void SetPoints(const PointsContainer *);
00103 const PointsContainer * GetPoints(void) const;
00105
00107 const PointsContainer * GetCorners(void);
00108
00110 bool ComputeBoundingBox(void) const;
00111
00117 itkGetConstReferenceMacro( Bounds, BoundsArrayType );
00118
00121 PointType GetCenter(void) const;
00122
00125 PointType GetMinimum(void) const;
00126
00130 void SetMinimum(const PointType & );
00131
00134 PointType GetMaximum(void) const;
00135
00139 void SetMaximum(const PointType & );
00140
00145 void ConsiderPoint( const PointType & );
00146
00150 typedef typename NumericTraits<CoordRepType>::AccumulateType AccumulateType;
00151 AccumulateType GetDiagonalLength2(void) const;
00152
00154 bool IsInside( const PointType & ) const;
00155
00157 unsigned long GetMTime( void ) const;
00158
00160 Pointer DeepCopy() const;
00161
00162 #if 0
00163
00177 bool IntersectWithLine(CoordRepType origin[PointDimension],
00178 CoordRepType direction[PointDimension],
00179 CoordRepType coords[PointDimension],
00180 CoordRepType* t);
00181
00182 #endif
00183
00184 protected:
00185 BoundingBox();
00186 virtual ~BoundingBox();
00187 void PrintSelf(std::ostream& os, Indent indent) const;
00188
00189 typedef typename PointsContainer::ConstIterator ConstIterator;
00190
00191 private:
00192 BoundingBox(const Self&);
00193 void operator=(const Self&);
00194
00195 PointsContainerConstPointer m_PointsContainer;
00196 PointsContainerPointer m_CornersContainer;
00197 mutable BoundsArrayType m_Bounds;
00198 mutable TimeStamp m_BoundsMTime;
00199
00200
00201 };
00202
00203 }
00204
00205 #ifndef ITK_MANUAL_INSTANTIATION
00206 #include "itkBoundingBox.txx"
00207 #endif
00208
00209 #endif
00210