ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkPolygonSpatialObject.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkPolygonSpatialObject_h
00019 #define __itkPolygonSpatialObject_h
00020 #include "itkBlobSpatialObject.h"
00021 
00022 namespace itk
00023 {
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 
00052   typedef enum {
00053         Axial = 0,
00054         Coronal = 1,
00055         Sagittal = 2,
00056         UserPlane = 3,
00057         Unknown = 4
00058         } PolygonGroupOrientation;
00059 
00061   PolygonGroupOrientation Plane() const;
00062 
00064   itkSetMacro(Thickness, double);
00065 
00067   itkGetMacro(Thickness, double);
00068 
00070   bool IsClosed() const;
00071 
00073   unsigned int NumberOfPoints() const;
00074 
00076   PointType ClosestPoint(const PointType & curPoint) const;
00077 
00079   double MeasureArea() const;
00080 
00082   double MeasureVolume() const;
00083 
00085   double MeasurePerimeter() const;
00086 
00088   bool DeletePoint(const PointType & pointToDelete);
00089 
00091   bool AddPoint(const PointType & pointToAdd);
00092 
00094   bool InsertPoint(const PointType & point1, const PointType & pointToAdd);
00095 
00097   bool ReplacePoint(const PointType & oldpoint, const PointType & newPoint);
00098 
00100   bool RemoveSegment(const PointType & startpoint, const PointType & endPoint);
00101 
00103   virtual bool IsInside(const PointType & point,
00104                         unsigned int depth,
00105                         char *name) const;
00106 
00110   virtual bool IsInside(const PointType & point) const;
00111 
00112 protected:
00113   void PrintSelf(std::ostream & os, Indent indent) const;
00114 
00115 private:
00116   PolygonSpatialObject(const Self &); //purposely not implemented
00117   void operator=(const Self &);       //purposely not implemented
00118 
00119   PolygonGroupOrientation m_Orientation;
00120   double                  m_Thickness;
00121   PolygonSpatialObject()
00122   {
00123     m_Orientation = Unknown;
00124     m_Thickness = 0.0;
00125   }
00126 };
00127 }
00128 #ifndef ITK_MANUAL_INSTANTIATION
00129 #include "itkPolygonSpatialObject.hxx"
00130 #endif
00131 
00132 #endif  // __itkPolygonSpatialObject_h
00133