ITK  6.0.0
Insight Toolkit
itkPolygonSpatialObject.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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 
22 
23 namespace itk
24 {
31 template <unsigned int TDimension = 3>
32 class ITK_TEMPLATE_EXPORT PolygonSpatialObject
33  : public PointBasedSpatialObject<TDimension, SpatialObjectPoint<TDimension>>
34 {
35 public:
36  ITK_DISALLOW_COPY_AND_MOVE(PolygonSpatialObject);
37 
42 
44  using PolygonPointListType = std::vector<PolygonPointType>;
45 
46  using typename Superclass::PointType;
47  using typename Superclass::TransformType;
48  using typename Superclass::SpatialObjectPointType;
49 
50  using ObjectDimensionType = unsigned int;
51  static constexpr ObjectDimensionType ObjectDimension = TDimension;
52 
54  itkNewMacro(Self);
55 
57  itkOverrideGetNameOfClassMacro(PolygonSpatialObject);
58 
61  void
62  Clear() override;
63 
65  int
66  GetOrientationInObjectSpace() const;
67 
69  itkSetMacro(ThicknessInObjectSpace, double);
70 
72  itkGetConstMacro(ThicknessInObjectSpace, double);
73 
75  itkSetMacro(IsClosed, bool);
76 
78  itkGetConstMacro(IsClosed, bool);
79 
80  itkBooleanMacro(IsClosed);
81 
83  double
84  MeasureAreaInObjectSpace() const;
85 
87  double
88  MeasureVolumeInObjectSpace() const;
89 
91  double
92  MeasurePerimeterInObjectSpace() const;
93 
95  bool
96  IsInsideInObjectSpace(const PointType & point) const override;
97 
98  /* Avoid hiding the overload that supports depth and name arguments */
99  using Superclass::IsInsideInObjectSpace;
100 
101 protected:
103  ~PolygonSpatialObject() override = default;
104 
105  void
106  PrintSelf(std::ostream & os, Indent indent) const override;
107 
108  typename LightObject::Pointer
109  InternalClone() const override;
110 
111 private:
112  mutable bool m_IsClosed{};
113  mutable int m_OrientationInObjectSpace{};
114  mutable ModifiedTimeType m_OrientationInObjectSpaceMTime{};
115  double m_ThicknessInObjectSpace{};
116 };
117 
118 } // namespace itk
119 
120 #ifndef ITK_MANUAL_INSTANTIATION
121 # include "itkPolygonSpatialObject.hxx"
122 #endif
123 
124 #endif // itkPolygonSpatialObject_h
itk::PointBasedSpatialObject
This class serves as the base class for point-based spatial objects.
Definition: itkPointBasedSpatialObject.h:37
itk::PolygonSpatialObject::ObjectDimensionType
unsigned int ObjectDimensionType
Definition: itkPolygonSpatialObject.h:50
itk::ModifiedTimeType
SizeValueType ModifiedTimeType
Definition: itkIntTypes.h:105
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::PolygonSpatialObject
TODO.
Definition: itkPolygonSpatialObject.h:32
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::PolygonSpatialObject::PolygonPointListType
std::vector< PolygonPointType > PolygonPointListType
Definition: itkPolygonSpatialObject.h:44
itk::point
*par Constraints *The filter requires an image with at least two dimensions and a vector *length of at least The theory supports extension to scalar but *the implementation of the itk vector classes do not **The template parameter TRealType must be floating point(float or double) or *a user-defined "real" numerical type with arithmetic operations defined *sufficient to compute derivatives. **\par Performance *This filter will automatically multithread if run with *SetUsePrincipleComponents
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itkPointBasedSpatialObject.h
itk::Point
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:53
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293
itk::SpatialObjectPoint
Point used for spatial objects.
Definition: itkSpatialObjectPoint.h:44