ITK  6.0.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 * 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#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
30namespace itk
31{
32
41template <typename TPointsContainer = VectorContainer<IdentifierType, Point<float, 3>>>
42class ITK_TEMPLATE_EXPORT PointsLocator : public Object
43{
44public:
45 ITK_DISALLOW_COPY_AND_MOVE(PointsLocator);
46
52
54 itkNewMacro(Self);
55
57 itkOverrideGetNameOfClassMacro(PointsLocator);
58
60 using PointsContainer = TPointsContainer;
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
82 using NeighborsIdentifierType = typename TreeType::InstanceIdentifierVectorType;
83
85 itkSetObjectMacro(Points, PointsContainer);
86
88 itkGetModifiableObjectMacro(Points, PointsContainer);
89
91 void
93
96 FindClosestPoint(const PointType & query) const;
97
99 void
100 FindClosestNPoints(const PointType &, unsigned int, NeighborsIdentifierType &) const;
101
103 void
104 FindClosestNPoints(const PointType &, unsigned int, NeighborsIdentifierType &, std::vector<double> &) const;
105
107 void
109
110protected:
112 ~PointsLocator() override = default;
113 void
114 PrintSelf(std::ostream & os, Indent indent) const override;
115
116private:
118 SampleAdaptorPointer m_SampleAdaptor{};
119 TreeGeneratorPointer m_KdTreeGenerator{};
121};
122
123} // end namespace itk
124
125#ifndef ITK_MANUAL_INSTANTIATION
126# include "itkPointsLocator.hxx"
127#endif
128
129#endif
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Base class for most ITK classes.
Definition: itkObject.h:62
Accelerate geometric searches for points.
TPointsContainer PointsContainer
typename TreeGeneratorType::KdTreeType TreeType
typename PointsContainer::Iterator PointsContainerIterator
typename TreeType::InstanceIdentifierVectorType NeighborsIdentifierType
typename SampleAdaptorType::Pointer SampleAdaptorPointer
typename PointsContainer::ConstPointer PointsContainerConstPointer
typename PointsContainer::Pointer PointsContainerPointer
~PointsLocator() override=default
typename PointsContainer::ElementIdentifier PointIdentifier
typename TreeGeneratorType::Pointer TreeGeneratorPointer
void PrintSelf(std::ostream &os, Indent indent) const override
void FindClosestNPoints(const PointType &, unsigned int, NeighborsIdentifierType &) const
PointIdentifier FindClosestPoint(const PointType &query) const
typename PointsContainer::Element PointType
void FindPointsWithinRadius(const PointType &, double, NeighborsIdentifierType &) const
void FindClosestNPoints(const PointType &, unsigned int, NeighborsIdentifierType &, std::vector< double > &) const
typename TreeType::ConstPointer TreeConstPointer
typename PointsContainer::ConstIterator PointsContainerConstIterator
This class generates a KdTree object without centroid information.
This class provides methods for k-nearest neighbor search and related data structures for a k-d tree.
Definition: itkKdTree.h:528
This class provides ListSample interface to ITK VectorContainer.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....