ITK  6.0.0
Insight Toolkit
itkContourSpatialObject.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 itkContourSpatialObject_h
19#define itkContourSpatialObject_h
20
21#include <list>
22
25
26namespace itk
27{
28/*** \class ContourSpatialObjectEnums
29 *
30 * \brief Enum classes for the ContourSpatialObject class.
31 *
32 * \ingroup ITKSpatialObjects
33 */
35{
36public:
37 /*** \class InterpolationMethodEnum
38 * \ingroup ITKSpatialObjects
39 * Hold interpolation method type
40 */
41 enum class InterpolationMethod : uint8_t
42 {
43 NO_INTERPOLATION = 0,
44 EXPLICIT_INTERPOLATION,
45 BEZIER_INTERPOLATION,
46 LINEAR_INTERPOLATION
47 };
48};
49// Define how to print enumeration
50extern ITKSpatialObjects_EXPORT std::ostream &
52
68template <unsigned int TDimension = 3>
69class ITK_TEMPLATE_EXPORT ContourSpatialObject
70 : public PointBasedSpatialObject<TDimension, ContourSpatialObjectPoint<TDimension>>
71{
72public:
73 ITK_DISALLOW_COPY_AND_MOVE(ContourSpatialObject);
74
79
80 using ScalarType = double;
81
83 using ContourPointListType = std::vector<ContourPointType>;
85 using ControlPointListType = std::vector<ControlPointType>;
86
87 using typename Superclass::PointType;
88 using typename Superclass::TransformType;
89 using typename Superclass::BoundingBoxType;
92
94#if !defined(ITK_LEGACY_REMOVE)
96 // We need to expose the enum values at the class level
97 // for backwards compatibility
98 static constexpr InterpolationMethodEnum NO_INTERPOLATION = InterpolationMethodEnum::NO_INTERPOLATION;
99 static constexpr InterpolationMethodEnum EXPLICIT_INTERPOLATION = InterpolationMethodEnum::EXPLICIT_INTERPOLATION;
100 static constexpr InterpolationMethodEnum BEZIER_INTERPOLATION = InterpolationMethodEnum::BEZIER_INTERPOLATION;
101 static constexpr InterpolationMethodEnum LINEAR_INTERPOLATION = InterpolationMethodEnum::LINEAR_INTERPOLATION;
102#endif
103
105 itkNewMacro(Self);
106
108 itkOverrideGetNameOfClassMacro(ContourSpatialObject);
109
112 void
113 Clear() override;
114
118 {
119 return m_ControlPoints;
120 }
121
123 const ControlPointListType &
125 {
126 return m_ControlPoints;
127 }
128
130 void
132
134 void
136
138 const ControlPointType *
140 {
141 return &(m_ControlPoints[id]);
142 }
143
145 ControlPointType *
147 {
148 return &(m_ControlPoints[id]);
149 }
150
154 {
155 return static_cast<SizeValueType>(m_ControlPoints.size());
156 }
157
159 itkSetEnumMacro(InterpolationMethod, InterpolationMethodEnum);
160
162 itkGetConstMacro(InterpolationMethod, InterpolationMethodEnum);
163
166 itkSetMacro(InterpolationFactor, unsigned int);
167
169 itkGetConstMacro(InterpolationFactor, unsigned int);
170
172 itkSetMacro(IsClosed, bool);
173
175 itkGetConstMacro(IsClosed, bool);
176
177 itkBooleanMacro(IsClosed);
178
180 int
182
185 itkSetMacro(AttachedToSlice, int);
186
189 itkGetConstMacro(AttachedToSlice, int);
190
192 void
193 Update() override;
194
195protected:
197 ~ContourSpatialObject() override = default;
198
200 void
201 PrintSelf(std::ostream & os, Indent indent) const override;
202
203 typename LightObject::Pointer
204 InternalClone() const override;
205
206private:
207 ContourPointListType m_ControlPoints{};
208
209 InterpolationMethodEnum m_InterpolationMethod{};
210 unsigned int m_InterpolationFactor{};
211
212 mutable bool m_IsClosed{};
213 mutable int m_OrientationInObjectSpace{};
214 mutable ModifiedTimeType m_OrientationInObjectSpaceMTime{};
215 int m_AttachedToSlice{};
216};
217} // end namespace itk
218
219#ifndef ITK_MANUAL_INSTANTIATION
220# include "itkContourSpatialObject.hxx"
221#endif
222
223#endif // itkContourSpatialObject_h
Point used for a Contour definition.
Representation of a Contour based on the spatial object classes.
ControlPointType * GetControlPoint(IdentifierType id)
int GetOrientationInObjectSpace() const
void Update() override
~ContourSpatialObject() override=default
ControlPointListType & GetControlPoints()
std::vector< ContourPointType > ContourPointListType
std::vector< ControlPointType > ControlPointListType
void SetControlPoints(const ControlPointListType &points)
void AddControlPoint(const ControlPointType &point)
SizeValueType GetNumberOfControlPoints() const
const ControlPointType * GetControlPoint(IdentifierType id) const
LightObject::Pointer InternalClone() const override
void PrintSelf(std::ostream &os, Indent indent) const override
const ControlPointListType & GetControlPoints() const
Base class for all data objects in ITK.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Base class for most ITK classes.
Definition: itkObject.h:62
This class serves as the base class for point-based spatial objects.
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
*par Constraints *The filter 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
SizeValueType IdentifierType
Definition: itkIntTypes.h:90
SizeValueType ModifiedTimeType
Definition: itkIntTypes.h:105
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:216
unsigned long SizeValueType
Definition: itkIntTypes.h:86