ITK  6.0.0
Insight Toolkit
itkPointSetBase.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 /*=========================================================================
19  *
20  * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21  *
22  * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23  *
24  * For complete copyright, license and disclaimer of warranty information
25  * please refer to the NOTICE file at the top of the ITK source tree.
26  *
27  *=========================================================================*/
28 #ifndef itkPointSetBase_h
29 #define itkPointSetBase_h
30 
31 #include "itkDataObject.h"
32 #include "itkVectorContainer.h"
33 #include <vector>
34 
35 namespace itk
36 {
37 
55 template <typename TPointsContainer>
56 class ITK_TEMPLATE_EXPORT PointSetBase : public DataObject
57 {
58 public:
59  ITK_DISALLOW_COPY_AND_MOVE(PointSetBase);
60 
62  using Self = PointSetBase;
66 
68  itkOverrideGetNameOfClassMacro(PointSetBase);
69 
70  itkCloneMacro(Self);
71 
73  using PointType = typename TPointsContainer::Element;
74  using CoordinateType = typename PointType::CoordinateType;
75 #ifndef ITK_FUTURE_LEGACY_REMOVE
76  using CoordRepType ITK_FUTURE_DEPRECATED(
77  "ITK 6 discourages using `CoordRepType`. Please use `CoordinateType` instead!") = CoordinateType;
78 #endif
79  using PointIdentifier = typename TPointsContainer::ElementIdentifier;
80  using PointsContainer = TPointsContainer;
81 
85 
87  static constexpr unsigned int PointDimension = PointType::PointDimension;
88 
92 
94  using PointsContainerConstIterator = typename PointsContainer::ConstIterator;
95  using PointsContainerIterator = typename PointsContainer::Iterator;
96 
98  using RegionType = long;
99 
102  itkGetConstMacro(MaximumNumberOfRegions, RegionType);
103 
104 protected:
107  PointsContainerPointer m_PointsContainer{};
108 
109 public:
113  void
114  PassStructure(Self * inputPointSet);
115 
119  void
120  Initialize() override;
121 
123  static constexpr unsigned int
125  {
126  return PointDimension;
127  }
128 
130  PointIdentifier
131  GetNumberOfPoints() const;
132 
134  void
135  SetPoints(PointsContainer *);
136 
139  void
140  SetPoints(PointsVectorContainer *);
141 
143  void
144  SetPointsByCoordinates(const std::vector<CoordinateType> & coordinates);
145 
147  PointsContainer *
148  GetPoints();
149 
151  const PointsContainer *
152  GetPoints() const;
153 
157  void SetPoint(PointIdentifier, PointType);
158 
165  bool
166  GetPoint(PointIdentifier, PointType *) const;
167 
169  PointType GetPoint(PointIdentifier) const;
170 
172  void
173  UpdateOutputInformation() override;
174 
175  void
176  SetRequestedRegionToLargestPossibleRegion() override;
177 
178  void
179  CopyInformation(const DataObject * data) override;
180 
181  bool
182  RequestedRegionIsOutsideOfTheBufferedRegion() override;
183 
184  bool
185  VerifyRequestedRegion() override;
186 
191  void
192  SetRequestedRegion(const DataObject * data) override;
193 
195  virtual void
196  SetRequestedRegion(const RegionType & region);
197 
198  itkGetConstMacro(RequestedRegion, RegionType);
199 
201  virtual void
202  SetBufferedRegion(const RegionType & region);
203 
204  itkGetConstMacro(BufferedRegion, RegionType);
205 
206 protected:
208  PointSetBase() = default;
209 
211  ~PointSetBase() override = 0;
212 
213  void
214  PrintSelf(std::ostream & os, Indent indent) const override;
215 
217  InternalClone() const override;
218 
219  // If the RegionType is ITK_UNSTRUCTURED_REGION, then the following
220  // variables represent the maximum number of region that the data
221  // object can be broken into, which region out of how many is
222  // currently in the buffered region, and the number of regions and
223  // the specific region requested for the update. Data objects that
224  // do not support any division of the data can simply leave the
225  // MaximumNumberOfRegions as 1. The RequestedNumberOfRegions and
226  // RequestedRegion are used to define the currently requested
227  // region. The LargestPossibleRegion is always requested region = 0
228  // and number of regions = 1;
229  RegionType m_MaximumNumberOfRegions{ 1 };
230  RegionType m_NumberOfRegions{ 1 };
231  RegionType m_RequestedNumberOfRegions{};
232  RegionType m_BufferedRegion{ -1 };
233  RegionType m_RequestedRegion{ -1 };
234 };
235 } // end namespace itk
236 
237 #ifndef ITK_MANUAL_INSTANTIATION
238 # include "itkPointSetBase.hxx"
239 #endif
240 
241 #endif
itk::PointSetBase< DefaultDynamicMeshTraits< TCoordinate, 2, 2, TCoordinate > ::PointsContainer >::PointType
typename DefaultDynamicMeshTraits< TCoordinate, 2, 2, TCoordinate > ::PointsContainer ::Element PointType
Definition: itkPointSetBase.h:73
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::PointSetBase< DefaultDynamicMeshTraits< TCoordinate, 2, 2, TCoordinate > ::PointsContainer >::PointIdentifier
typename DefaultDynamicMeshTraits< TCoordinate, 2, 2, TCoordinate > ::PointsContainer ::ElementIdentifier PointIdentifier
Definition: itkPointSetBase.h:79
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::PointSetBase< DefaultDynamicMeshTraits< TCoordinate, 2, 2, TCoordinate > ::PointsContainer >::PointsVectorContainerPointer
typename PointsVectorContainer::Pointer PointsVectorContainerPointer
Definition: itkPointSetBase.h:84
itk::detail::VectorContainer
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
Definition: itkVectorContainer.h:51
itk::PointSetBase< DefaultDynamicMeshTraits< TCoordinate, 2, 2, TCoordinate > ::PointsContainer >::CoordinateType
typename PointType::CoordinateType CoordinateType
Definition: itkPointSetBase.h:74
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::PointSetBase::GetPointDimension
static constexpr unsigned int GetPointDimension()
Definition: itkPointSetBase.h:124
itkDataObject.h
itk::PointSetBase< DefaultDynamicMeshTraits< TCoordinate, 2, 2, TCoordinate > ::PointsContainer >::PointsContainerIterator
typename PointsContainer::Iterator PointsContainerIterator
Definition: itkPointSetBase.h:95
itk::PointSetBase< DefaultDynamicMeshTraits< TCoordinate, 2, 2, TCoordinate > ::PointsContainer >::PointsContainer
DefaultDynamicMeshTraits< TCoordinate, 2, 2, TCoordinate > ::PointsContainer PointsContainer
Definition: itkPointSetBase.h:80
itk::PointSetBase< DefaultDynamicMeshTraits< TCoordinate, 2, 2, TCoordinate > ::PointsContainer >::PointsContainerConstPointer
typename PointsContainer::ConstPointer PointsContainerConstPointer
Definition: itkPointSetBase.h:91
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::PointSetBase
A superclass of PointSet supports point (geometric coordinate and attribute) definition.
Definition: itkPointSetBase.h:56
itk::DataObject
class ITK_FORWARD_EXPORT DataObject
Definition: itkDataObject.h:42
itkVectorContainer.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::PointSetBase< DefaultDynamicMeshTraits< TCoordinate, 2, 2, TCoordinate > ::PointsContainer >::PointsContainerConstIterator
typename PointsContainer::ConstIterator PointsContainerConstIterator
Definition: itkPointSetBase.h:94
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itk::PointSetBase< DefaultDynamicMeshTraits< TCoordinate, 2, 2, TCoordinate > ::PointsContainer >::RegionType
long RegionType
Definition: itkPointSetBase.h:98
AddImageFilter
Definition: itkAddImageFilter.h:81
itk::PointSetBase< DefaultDynamicMeshTraits< TCoordinate, 2, 2, TCoordinate > ::PointsContainer >::PointsVectorContainer
typename itk::VectorContainer< PointIdentifier, CoordinateType > PointsVectorContainer
Definition: itkPointSetBase.h:83
itk::PointSetBase< DefaultDynamicMeshTraits< TCoordinate, 2, 2, TCoordinate > ::PointsContainer >::PointsContainerPointer
typename PointsContainer::Pointer PointsContainerPointer
Definition: itkPointSetBase.h:90
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293