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 
26 namespace itk
27 {
28 /*** \class ContourSpatialObjectEnums
29  *
30  * \brief Enum classes for the ContourSpatialObject class.
31  *
32  * \ingroup ITKSpatialObjects
33  */
35 {
36 public:
41  enum class InterpolationMethod : uint8_t
42  {
43  NO_INTERPOLATION = 0,
47  };
48 };
49 // Define how to print enumeration
50 extern ITKSpatialObjects_EXPORT std::ostream &
52 
68 template <unsigned int TDimension = 3>
69 class ITK_TEMPLATE_EXPORT ContourSpatialObject
70  : public PointBasedSpatialObject<TDimension, ContourSpatialObjectPoint<TDimension>>
71 {
72 public:
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)
95 
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
131  SetControlPoints(const ControlPointListType & points);
132 
134  void
135  AddControlPoint(const ControlPointType & point);
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
181  GetOrientationInObjectSpace() const;
182 
185  itkSetMacro(AttachedToSlice, int);
186 
189  itkGetConstMacro(AttachedToSlice, int);
190 
192  void
193  Update() override;
194 
195 protected:
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 
206 private:
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
itk::PointBasedSpatialObject
This class serves as the base class for point-based spatial objects.
Definition: itkPointBasedSpatialObject.h:37
itk::ContourSpatialObject
Representation of a Contour based on the spatial object classes.
Definition: itkContourSpatialObject.h:69
itk::ContourSpatialObjectPoint
Point used for a Contour definition.
Definition: itkContourSpatialObjectPoint.h:38
itk::detail::VectorContainer
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
Definition: itkVectorContainer.h:51
itk::ModifiedTimeType
SizeValueType ModifiedTimeType
Definition: itkIntTypes.h:105
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::operator<<
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ContourSpatialObjectEnums::InterpolationMethod::NO_INTERPOLATION
itk::ContourSpatialObjectEnums::InterpolationMethod::LINEAR_INTERPOLATION
itk::ContourSpatialObject::GetControlPoints
ControlPointListType & GetControlPoints()
Definition: itkContourSpatialObject.h:117
itkContourSpatialObjectPoint.h
itk::ContourSpatialObjectEnums::InterpolationMethod
InterpolationMethod
Definition: itkContourSpatialObject.h:41
itk::ContourSpatialObjectEnums
Definition: itkContourSpatialObject.h:34
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::ContourSpatialObject::GetNumberOfControlPoints
SizeValueType GetNumberOfControlPoints() const
Definition: itkContourSpatialObject.h:153
itk::ContourSpatialObjectEnums::InterpolationMethod::EXPLICIT_INTERPOLATION
itk::ContourSpatialObject::GetControlPoints
const ControlPointListType & GetControlPoints() const
Definition: itkContourSpatialObject.h:124
itk::ContourSpatialObject::GetControlPoint
ControlPointType * GetControlPoint(IdentifierType id)
Definition: itkContourSpatialObject.h:146
itk::ContourSpatialObject::ContourPointListType
std::vector< ContourPointType > ContourPointListType
Definition: itkContourSpatialObject.h:83
itk::ContourSpatialObjectEnums::InterpolationMethod::BEZIER_INTERPOLATION
itk::ContourSpatialObject::ControlPointListType
std::vector< ControlPointType > ControlPointListType
Definition: itkContourSpatialObject.h:85
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::ContourSpatialObject::ScalarType
double ScalarType
Definition: itkContourSpatialObject.h:80
itk::IdentifierType
SizeValueType IdentifierType
Definition: itkIntTypes.h:90
itk::ContourSpatialObject::GetControlPoint
const ControlPointType * GetControlPoint(IdentifierType id) const
Definition: itkContourSpatialObject.h:139
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:86
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293