ITK  5.2.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  * 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 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 ControuSpatialObject class.
31  *
32  * \ingroup ITKSpatialObjects
33  */
35 {
36 public:
37  /***\class InterpolationMethodEnum
38  * \ingroup ITKSpatialObjects
39  * Hold interpolation method type
40  */
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 PointType = typename Superclass::PointType;
88  using TransformType = typename Superclass::TransformType;
89  using BoundingBoxType = 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 
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 & newPoints);
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 
161 
162  itkGetConstMacro(InterpolationMethod, InterpolationMethodEnum)
163 
164 
166  itkSetMacro(InterpolationFactor, unsigned int)
167 
168 
169  itkGetConstMacro(InterpolationFactor, unsigned int)
170 
171 
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:
208 
210  unsigned int m_InterpolationFactor;
211 
212  mutable bool m_IsClosed;
216 };
217 } // end namespace itk
218 
219 #ifndef ITK_MANUAL_INSTANTIATION
220 # include "itkContourSpatialObject.hxx"
221 #endif
222 
223 #endif // itkContourSpatialObject_h
itk::ContourSpatialObject::TransformType
typename Superclass::TransformType TransformType
Definition: itkContourSpatialObject.h:88
itk::ContourSpatialObjectEnums::InterpolationMethod::NO_INTERPOLATION
itk::PointBasedSpatialObject
This class serves as the base class for point-based spatial objects.
Definition: itkPointBasedSpatialObject.h:37
itk::uint8_t
::uint8_t uint8_t
Definition: itkIntTypes.h:29
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::ContourSpatialObject::m_AttachedToSlice
int m_AttachedToSlice
Definition: itkContourSpatialObject.h:215
itk::ModifiedTimeType
SizeValueType ModifiedTimeType
Definition: itkIntTypes.h:102
itk::operator<<
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:213
itk::ContourSpatialObjectEnums::InterpolationMethod
InterpolationMethod
Definition: itkContourSpatialObject.h:41
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ContourSpatialObject::GetControlPoints
ControlPointListType & GetControlPoints()
Definition: itkContourSpatialObject.h:117
itk::ContourSpatialObject::m_InterpolationFactor
unsigned int m_InterpolationFactor
Definition: itkContourSpatialObject.h:210
itk::ContourSpatialObjectEnums::InterpolationMethod::LINEAR_INTERPOLATION
itkContourSpatialObjectPoint.h
itk::ContourSpatialObject::PointType
typename Superclass::PointType PointType
Definition: itkContourSpatialObject.h:87
itk::ContourSpatialObjectEnums
Definition: itkContourSpatialObject.h:34
itk::ContourSpatialObjectEnums::InterpolationMethod::EXPLICIT_INTERPOLATION
itk::ContourSpatialObject::GetNumberOfControlPoints
SizeValueType GetNumberOfControlPoints() const
Definition: itkContourSpatialObject.h:153
itk::ContourSpatialObject::GetControlPoints
const ControlPointListType & GetControlPoints() const
Definition: itkContourSpatialObject.h:124
itk::ContourSpatialObject::BoundingBoxType
typename Superclass::BoundingBoxType BoundingBoxType
Definition: itkContourSpatialObject.h:89
itk::ContourSpatialObject::GetControlPoint
ControlPointType * GetControlPoint(IdentifierType id)
Definition: itkContourSpatialObject.h:146
itk::ContourSpatialObject::m_InterpolationMethod
InterpolationMethodEnum m_InterpolationMethod
Definition: itkContourSpatialObject.h:209
itk::ContourSpatialObject::ContourPointListType
std::vector< ContourPointType > ContourPointListType
Definition: itkContourSpatialObject.h:83
itk::ContourSpatialObject::m_IsClosed
bool m_IsClosed
Definition: itkContourSpatialObject.h:212
itk::ContourSpatialObject::ControlPointListType
std::vector< ControlPointType > ControlPointListType
Definition: itkContourSpatialObject.h:85
itk::ContourSpatialObject::m_ControlPoints
ContourPointListType m_ControlPoints
Definition: itkContourSpatialObject.h:207
itk::ContourSpatialObject::m_OrientationInObjectSpaceMTime
ModifiedTimeType m_OrientationInObjectSpaceMTime
Definition: itkContourSpatialObject.h:214
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itkPointBasedSpatialObject.h
itk::ContourSpatialObject::ScalarType
double ScalarType
Definition: itkContourSpatialObject.h:80
itk::ContourSpatialObject::m_OrientationInObjectSpace
int m_OrientationInObjectSpace
Definition: itkContourSpatialObject.h:213
itk::ContourSpatialObjectEnums::InterpolationMethod::BEZIER_INTERPOLATION
itk::IdentifierType
SizeValueType IdentifierType
Definition: itkIntTypes.h:87
itk::VectorContainer
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
Definition: itkVectorContainer.h:48
itk::ContourSpatialObject::GetControlPoint
const ControlPointType * GetControlPoint(IdentifierType id) const
Definition: itkContourSpatialObject.h:139
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293