ITK  5.2.0
Insight Toolkit
itkPointsLocator.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 itkPointsLocator_h
19 #define itkPointsLocator_h
20 
21 #include "itkObject.h"
22 
23 #include "itkPoint.h"
24 #include "itkIntTypes.h"
25 #include "itkKdTree.h"
26 #include "itkKdTreeGenerator.h"
27 #include "itkVectorContainer.h"
29 
30 namespace itk
31 {
32 
41 template <typename TPointsContainer = VectorContainer<IdentifierType, Point<float, 3>>>
42 class ITK_TEMPLATE_EXPORT PointsLocator : public Object
43 {
44 public:
45  ITK_DISALLOW_COPY_AND_MOVE(PointsLocator);
46 
49  using Superclass = Object;
52 
54  itkNewMacro(Self);
55 
57  itkTypeMacro(PointsLocator, Object);
58 
60  using PointsContainer = TPointsContainer;
61  using PointsContainerPointer = typename PointsContainer::Pointer;
62  using PointsContainerConstPointer = typename PointsContainer::ConstPointer;
63  using PointIdentifier = typename PointsContainer::ElementIdentifier;
64  using PointType = typename PointsContainer::Element;
65 
67  static constexpr unsigned int PointDimension = PointType::PointDimension;
68 
70  using PointsContainerConstIterator = typename PointsContainer::ConstIterator;
71  using PointsContainerIterator = typename PointsContainer::Iterator;
72 
76 
81  using TreeConstPointer = typename TreeType::ConstPointer;
82  using NeighborsIdentifierType = typename TreeType::InstanceIdentifierVectorType;
83 
85  itkSetObjectMacro(Points, PointsContainer);
86 
88  itkGetModifiableObjectMacro(Points, PointsContainer);
89 
91  void
92  Initialize();
93 
96  FindClosestPoint(const PointType & query) const;
97 
99  void
100  Search(const PointType &, unsigned int, NeighborsIdentifierType &) const;
101 
103  void
104  FindClosestNPoints(const PointType &, unsigned int, NeighborsIdentifierType &) const;
105 
107  void
108  Search(const PointType &, double, NeighborsIdentifierType &) const;
109 
111  void
112  FindPointsWithinRadius(const PointType &, double, NeighborsIdentifierType &) const;
113 
114 protected:
115  PointsLocator();
116  ~PointsLocator() override = default;
117  void
118  PrintSelf(std::ostream & os, Indent indent) const override;
119 
120 private:
125 };
126 
127 } // end namespace itk
128 
129 #ifndef ITK_MANUAL_INSTANTIATION
130 # include "itkPointsLocator.hxx"
131 #endif
132 
133 #endif
itk::PointsLocator::TreeGeneratorPointer
typename TreeGeneratorType::Pointer TreeGeneratorPointer
Definition: itkPointsLocator.h:79
itk::PointsLocator::NeighborsIdentifierType
typename TreeType::InstanceIdentifierVectorType NeighborsIdentifierType
Definition: itkPointsLocator.h:82
itk::Statistics::KdTree
This class provides methods for k-nearest neighbor search and related data structures for a k-d tree.
Definition: itkKdTree.h:527
itk::PointsLocator::m_KdTreeGenerator
TreeGeneratorPointer m_KdTreeGenerator
Definition: itkPointsLocator.h:123
itkPoint.h
itk::PointsLocator::PointsContainer
TPointsContainer PointsContainer
Definition: itkPointsLocator.h:60
itk::PointsLocator::SampleAdaptorPointer
typename SampleAdaptorType::Pointer SampleAdaptorPointer
Definition: itkPointsLocator.h:75
itk::PointsLocator::PointIdentifier
typename PointsContainer::ElementIdentifier PointIdentifier
Definition: itkPointsLocator.h:63
itk::PointsLocator::TreeConstPointer
typename TreeType::ConstPointer TreeConstPointer
Definition: itkPointsLocator.h:81
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::PointsLocator
Accelerate geometric searches for points.
Definition: itkPointsLocator.h:42
itk::Statistics::VectorContainerToListSampleAdaptor
This class provides ListSample interface to ITK VectorContainer.
Definition: itkVectorContainerToListSampleAdaptor.h:46
itk::PointsLocator::PointsContainerIterator
typename PointsContainer::Iterator PointsContainerIterator
Definition: itkPointsLocator.h:71
itk::PointsLocator::TreeType
typename TreeGeneratorType::KdTreeType TreeType
Definition: itkPointsLocator.h:80
itk::PointsLocator::m_SampleAdaptor
SampleAdaptorPointer m_SampleAdaptor
Definition: itkPointsLocator.h:122
itk::PointsLocator::PointsContainerPointer
typename PointsContainer::Pointer PointsContainerPointer
Definition: itkPointsLocator.h:61
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::PointsLocator::m_Points
PointsContainerPointer m_Points
Definition: itkPointsLocator.h:121
itk::PointsLocator::PointType
typename PointsContainer::Element PointType
Definition: itkPointsLocator.h:64
itkKdTree.h
itkIntTypes.h
itk::PointsLocator::PointsContainerConstPointer
typename PointsContainer::ConstPointer PointsContainerConstPointer
Definition: itkPointsLocator.h:62
itkObject.h
itkVectorContainer.h
itkVectorContainerToListSampleAdaptor.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::PointsLocator::PointsContainerConstIterator
typename PointsContainer::ConstIterator PointsContainerConstIterator
Definition: itkPointsLocator.h:70
itkKdTreeGenerator.h
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::PointsLocator::m_Tree
TreeConstPointer m_Tree
Definition: itkPointsLocator.h:124
itk::Statistics::KdTreeGenerator
This class generates a KdTree object without centroid information.
Definition: itkKdTreeGenerator.h:71