ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkPointBasedSpatialObject.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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,
37  class TSpatialObjectPointType = SpatialObjectPoint< TDimension > >
38 class ITK_TEMPLATE_EXPORT PointBasedSpatialObject:
39  public SpatialObject< TDimension >
40 {
41 public:
42  ITK_DISALLOW_COPY_AND_ASSIGN(PointBasedSpatialObject);
43 
48 
49  using ScalarType = double;
50 
51  using SpatialObjectPointType = TSpatialObjectPointType;
52  using SpatialObjectPointListType = std::vector< SpatialObjectPointType >;
53 
54  using PointType = typename Superclass::PointType;
55  using TransformType = typename Superclass::TransformType;
57  using CovariantVectorType = typename Superclass::CovariantVectorType;
58  using BoundingBoxType = typename Superclass::BoundingBoxType;
60  itkNewMacro(Self);
61 
64 
67  virtual void AddPoint( const SpatialObjectPointType & newPoints );
68 
71  virtual void SetPoints( const SpatialObjectPointListType & newPoints );
72 
75  { return m_Points; }
76 
78  virtual const SpatialObjectPointListType & GetPoints() const
79  { return m_Points; }
80 
82  virtual const SpatialObjectPointType *
84  { return &( m_Points[id] ); }
85 
86  virtual SpatialObjectPointType *
88  { return &( m_Points[id] ); }
89 
92  { return static_cast<SizeValueType>( m_Points.size() ); }
93 
95  TSpatialObjectPointType ClosestPointInWorldSpace(
96  const PointType & point) const;
97 
98  TSpatialObjectPointType ClosestPointInObjectSpace(
99  const PointType & point) const;
100 
102  bool IsInsideInObjectSpace(const PointType & worldPoint, unsigned int depth=0,
103  const std::string & name="") const override;
104 
106  bool ComputeMyBoundingBox() const override;
107 
108 protected:
110  ~PointBasedSpatialObject() override = default;
111 
113 
115  void PrintSelf(std::ostream & os, Indent indent) const override;
116 
117  typename LightObject::Pointer InternalClone() const override;
118 
119 };
120 } // end namespace itk
121 
122 #ifndef ITK_MANUAL_INSTANTIATION
123 #include "itkPointBasedSpatialObject.hxx"
124 #endif
125 
126 #endif // itkPointBasedSpatialObject_h
virtual SizeValueType GetNumberOfPoints() const
unsigned long SizeValueType
Definition: itkIntTypes.h:83
This class serves as the base class for point-based spatial objects.
virtual SpatialObjectPointType * GetPoint(IdentifierType id)
Point used for a tube definition.
SizeValueType IdentifierType
Definition: itkIntTypes.h:87
Implementation of the composite pattern.
SpatialObjectPointListType m_Points
virtual const SpatialObjectPointListType & GetPoints() const
virtual const SpatialObjectPointType * GetPoint(IdentifierType id) const
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:60
Base class for all data objects in ITK.
virtual SpatialObjectPointListType & GetPoints()