ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkPolygonSpatialObject.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkPolygonSpatialObject_h
19 #define __itkPolygonSpatialObject_h
20 #include "itkBlobSpatialObject.h"
21 
22 namespace itk
23 {
29 template< unsigned int TDimension = 3 >
30 class ITK_EXPORT PolygonSpatialObject:
31  public BlobSpatialObject< TDimension >
32 {
33 public:
38  typedef typename Superclass::PointType PointType;
39  typedef typename Superclass::TransformType TransformType;
40  typedef typename Superclass::PointListType PointListType;
41  typedef typename Superclass::BlobPointType BlobPointType;
43  itkNewMacro(Self);
44 
47 
52  typedef enum {
53  Axial = 0,
54  Coronal = 1,
55  Sagittal = 2,
56  UserPlane = 3,
57  Unknown = 4
58  } PolygonGroupOrientation;
59 
61  PolygonGroupOrientation Plane() const;
62 
64  itkSetMacro(Thickness, double);
65 
67  itkGetMacro(Thickness, double);
68 
70  bool IsClosed() const;
71 
73  unsigned int NumberOfPoints() const;
74 
76  PointType ClosestPoint(const PointType & curPoint) const;
77 
79  double MeasureArea() const;
80 
82  double MeasureVolume() const;
83 
85  double MeasurePerimeter() const;
86 
88  bool DeletePoint(const PointType & pointToDelete);
89 
91  bool AddPoint(const PointType & pointToAdd);
92 
94  bool InsertPoint(const PointType & point1, const PointType & pointToAdd);
95 
97  bool ReplacePoint(const PointType & oldpoint, const PointType & newPoint);
98 
100  bool RemoveSegment(const PointType & startpoint, const PointType & endPoint);
101 
103  virtual bool IsInside(const PointType & point,
104  unsigned int depth,
105  char *name) const;
106 
110  virtual bool IsInside(const PointType & point) const;
111 
112 protected:
113  void PrintSelf(std::ostream & os, Indent indent) const;
114 
115 private:
116  PolygonSpatialObject(const Self &); //purposely not implemented
117  void operator=(const Self &); //purposely not implemented
118 
120  double m_Thickness;
122  {
123  m_Orientation = Unknown;
124  m_Thickness = 0.0;
125  }
126 };
127 }
128 #ifndef ITK_MANUAL_INSTANTIATION
129 #include "itkPolygonSpatialObject.hxx"
130 #endif
131 
132 #endif // __itkPolygonSpatialObject_h
133