ITK  5.2.0
Insight Toolkit
itkPointBasedSpatialObject.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 itkPointBasedSpatialObject_h
19 #define itkPointBasedSpatialObject_h
20 
21 #include "itkSpatialObject.h"
22 #include "itkSpatialObjectPoint.h"
23 
24 namespace itk
25 {
36 template <unsigned int TDimension = 3, class TSpatialObjectPointType = SpatialObjectPoint<TDimension>>
37 class ITK_TEMPLATE_EXPORT PointBasedSpatialObject : public SpatialObject<TDimension>
38 {
39 public:
40  ITK_DISALLOW_COPY_AND_MOVE(PointBasedSpatialObject);
41 
46 
47  using ScalarType = double;
48 
49  using SpatialObjectPointType = TSpatialObjectPointType;
50  using SpatialObjectPointListType = std::vector<SpatialObjectPointType>;
51 
52  using PointType = typename Superclass::PointType;
53  using TransformType = typename Superclass::TransformType;
55  using CovariantVectorType = typename Superclass::CovariantVectorType;
56  using BoundingBoxType = typename Superclass::BoundingBoxType;
58  itkNewMacro(Self);
59 
62 
65  void
66  Clear() override;
67 
70  virtual void
71  AddPoint(const SpatialObjectPointType & newPoint);
72 
74  virtual void
75  RemovePoint(IdentifierType id);
76 
79  virtual void
80  SetPoints(const SpatialObjectPointListType & newPoints);
81 
85  {
86  return m_Points;
87  }
88 
90  virtual const SpatialObjectPointListType &
91  GetPoints() const
92  {
93  return m_Points;
94  }
95 
97  virtual const SpatialObjectPointType *
99  {
100  return &(m_Points[id]);
101  }
102 
103  virtual SpatialObjectPointType *
105  {
106  return &(m_Points[id]);
107  }
108 
110  virtual SizeValueType
112  {
113  return static_cast<SizeValueType>(m_Points.size());
114  }
115 
117  TSpatialObjectPointType
118  ClosestPointInWorldSpace(const PointType & point) const;
119 
120  TSpatialObjectPointType
121  ClosestPointInObjectSpace(const PointType & point) const;
122 
124  bool
125  IsInsideInObjectSpace(const PointType & point) const override;
126 
127  /* Avoid hiding the overload that supports depth and name arguments */
128  using Superclass::IsInsideInObjectSpace;
129 
130 protected:
132  void
133  ComputeMyBoundingBox() override;
134 
136  ~PointBasedSpatialObject() override = default;
137 
139 
141  void
142  PrintSelf(std::ostream & os, Indent indent) const override;
143 
144  typename LightObject::Pointer
145  InternalClone() const override;
146 };
147 } // end namespace itk
148 
149 #ifndef ITK_MANUAL_INSTANTIATION
150 # include "itkPointBasedSpatialObject.hxx"
151 #endif
152 
153 #endif // itkPointBasedSpatialObject_h
itk::DTITubeSpatialObjectPoint
Point used for a tube definition.
Definition: itkDTITubeSpatialObjectPoint.h:61
itk::PointBasedSpatialObject
This class serves as the base class for point-based spatial objects.
Definition: itkPointBasedSpatialObject.h:37
itk::PointBasedSpatialObject< TDimension, DTITubeSpatialObjectPoint< TDimension > >::VectorType
typename Superclass::VectorType VectorType
Definition: itkPointBasedSpatialObject.h:54
itk::PointBasedSpatialObject::GetPoint
virtual const SpatialObjectPointType * GetPoint(IdentifierType id) const
Definition: itkPointBasedSpatialObject.h:98
itk::PointBasedSpatialObject< TDimension, DTITubeSpatialObjectPoint< TDimension > >::SpatialObjectPointListType
std::vector< SpatialObjectPointType > SpatialObjectPointListType
Definition: itkPointBasedSpatialObject.h:50
itk::PointBasedSpatialObject< TDimension, DTITubeSpatialObjectPoint< TDimension > >::ScalarType
double ScalarType
Definition: itkPointBasedSpatialObject.h:47
itkSpatialObject.h
itk::GTest::TypedefsAndConstructors::Dimension2::VectorType
ImageBaseType::SpacingType VectorType
Definition: itkGTestTypedefsAndConstructors.h:53
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::PointBasedSpatialObject< TDimension, DTITubeSpatialObjectPoint< TDimension > >::PointType
typename Superclass::PointType PointType
Definition: itkPointBasedSpatialObject.h:52
itk::PointBasedSpatialObject< TDimension, DTITubeSpatialObjectPoint< TDimension > >::BoundingBoxType
typename Superclass::BoundingBoxType BoundingBoxType
Definition: itkPointBasedSpatialObject.h:56
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::PointBasedSpatialObject< TDimension, DTITubeSpatialObjectPoint< TDimension > >::CovariantVectorType
typename Superclass::CovariantVectorType CovariantVectorType
Definition: itkPointBasedSpatialObject.h:55
itk::SpatialObject
Implementation of the composite pattern.
Definition: itkSpatialObject.h:57
itk::PointBasedSpatialObject::GetPoints
virtual SpatialObjectPointListType & GetPoints()
Definition: itkPointBasedSpatialObject.h:84
itk::PointBasedSpatialObject::GetNumberOfPoints
virtual SizeValueType GetNumberOfPoints() const
Definition: itkPointBasedSpatialObject.h:111
itk::PointBasedSpatialObject::GetPoints
virtual const SpatialObjectPointListType & GetPoints() const
Definition: itkPointBasedSpatialObject.h:91
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
itk::PointBasedSpatialObject::GetPoint
virtual SpatialObjectPointType * GetPoint(IdentifierType id)
Definition: itkPointBasedSpatialObject.h:104
itk::PointBasedSpatialObject::m_Points
SpatialObjectPointListType m_Points
Definition: itkPointBasedSpatialObject.h:138
itkSpatialObjectPoint.h
itk::PointBasedSpatialObject< TDimension, DTITubeSpatialObjectPoint< TDimension > >::TransformType
typename Superclass::TransformType TransformType
Definition: itkPointBasedSpatialObject.h:53
itk::IdentifierType
SizeValueType IdentifierType
Definition: itkIntTypes.h:87
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293