itkBoundingBox.h
Go to the documentation of this file.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 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&);
00196 void operator=(const Self&);
00197
00198 PointsContainerConstPointer m_PointsContainer;
00199 PointsContainerPointer m_CornersContainer;
00200 mutable BoundsArrayType m_Bounds;
00201 mutable TimeStamp m_BoundsMTime;
00202
00203
00204 };
00205
00206 }
00207
00208 #ifndef ITK_MANUAL_INSTANTIATION
00209 #include "itkBoundingBox.txx"
00210 #endif
00211
00212 #endif
00213