00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkPolygonSpatialObject.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-04-08 18:27:47 $ 00007 Version: $Revision: 1.14 $ 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 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __itkPolygonSpatialObject_h 00018 #define __itkPolygonSpatialObject_h 00019 #include "itkBlobSpatialObject.h" 00020 #include "itkPolygonGroupOrientation.h" 00021 00022 namespace itk 00023 { 00024 00029 template <unsigned int TDimension = 3> 00030 class ITK_EXPORT PolygonSpatialObject 00031 :public BlobSpatialObject<TDimension> 00032 { 00033 public: 00034 typedef PolygonSpatialObject<TDimension> Self; 00035 typedef BlobSpatialObject< TDimension > Superclass; 00036 typedef SmartPointer < Self > Pointer; 00037 typedef SmartPointer < const Self > ConstPointer; 00038 typedef typename Superclass::PointType PointType; 00039 typedef typename Superclass::TransformType TransformType; 00040 typedef typename Superclass::PointListType PointListType; 00041 typedef typename Superclass::BlobPointType BlobPointType; 00043 itkNewMacro( Self ); 00044 00046 itkTypeMacro( PolygonSpatialObject, BlobSpatialObject ); 00047 00049 PolygonGroupOrientation Plane() const; 00050 00052 itkSetMacro(Thickness,double); 00053 00055 itkGetMacro(Thickness,double); 00056 00058 bool IsClosed() const; 00059 00061 unsigned int NumberOfPoints() const; 00062 00064 PointType ClosestPoint( const PointType & curPoint ) const; 00065 00067 double MeasureArea() const; 00068 00070 double MeasureVolume() const; 00071 00073 double MeasurePerimeter() const; 00074 00076 bool DeletePoint( const PointType & pointToDelete ); 00077 00079 bool AddPoint( const PointType & pointToAdd ); 00080 00082 bool InsertPoint( const PointType & point1, const PointType & pointToAdd ); 00083 00085 bool ReplacePoint( const PointType & oldpoint, const PointType & newPoint ); 00086 00088 bool RemoveSegment( const PointType & startpoint, const PointType & endPoint); 00089 00091 virtual bool IsInside( const PointType & point, 00092 unsigned int depth, 00093 char * name) const; 00094 00098 virtual bool IsInside( const PointType & point) const; 00099 00100 protected: 00101 void PrintSelf( std::ostream & os, Indent indent) const; 00102 00103 private: 00104 PolygonSpatialObject(const Self&); //purposely not implemented 00105 void operator=(const Self&); //purposely not implemented 00106 00107 PolygonGroupOrientation m_Orientation; 00108 double m_Thickness; 00109 PolygonSpatialObject() 00110 { 00111 m_Orientation = Unknown; 00112 m_Thickness = 0.0; 00113 } 00114 }; 00115 } 00116 #ifndef ITK_MANUAL_INSTANTIATION 00117 #include "itkPolygonSpatialObject.txx" 00118 #endif 00119 00120 #endif // __itkPolygonSpatialObject_h 00121