ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkPointsLocator.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 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<
42  typename TPointsContainer = VectorContainer< IdentifierType, Point< float, 3 > >
43  >
44 class ITK_TEMPLATE_EXPORT PointsLocator : public Object
45 {
46 public:
47  ITK_DISALLOW_COPY_AND_ASSIGN(PointsLocator);
48 
51  using Superclass = Object;
54 
56  itkNewMacro( Self );
57 
59  itkTypeMacro( PointsLocator, Object );
60 
62  using PointsContainer = TPointsContainer;
63  using PointsContainerPointer = typename PointsContainer::Pointer;
64  using PointsContainerConstPointer = typename PointsContainer::ConstPointer;
65  using PointIdentifier = typename PointsContainer::ElementIdentifier;
66  using PointType = typename PointsContainer::Element;
67 
69  static constexpr unsigned int PointDimension = PointType::PointDimension;
70 
72  using PointsContainerConstIterator = typename PointsContainer::ConstIterator;
73  using PointsContainerIterator = typename PointsContainer::Iterator;
74 
78 
83  using TreeConstPointer = typename TreeType::ConstPointer;
84  using NeighborsIdentifierType = typename TreeType::InstanceIdentifierVectorType;
85 
87  itkSetObjectMacro( Points, PointsContainer );
88 
90  itkGetModifiableObjectMacro(Points, PointsContainer );
91 
93  void Initialize();
94 
96  PointIdentifier FindClosestPoint( const PointType &query ) const;
97 
99  void Search( const PointType &, unsigned int, NeighborsIdentifierType & )
100  const;
101 
103  void FindClosestNPoints( const PointType &, unsigned int,
104  NeighborsIdentifierType & ) const;
105 
107  void Search( const PointType &, double, NeighborsIdentifierType & ) const;
108 
110  void FindPointsWithinRadius( const PointType &, double,
111  NeighborsIdentifierType & ) const;
112 
113 protected:
114  PointsLocator();
115  ~PointsLocator() override = default;
116  void PrintSelf(std::ostream& os, Indent indent) const override;
117 
118 private:
123 };
124 
125 } // end namespace itk
126 
127 #ifndef ITK_MANUAL_INSTANTIATION
128 #include "itkPointsLocator.hxx"
129 #endif
130 
131 #endif
typename TreeType::ConstPointer TreeConstPointer
Light weight base class for most itk classes.
typename TreeGeneratorType::KdTreeType TreeType
typename PointsContainer::ElementIdentifier PointIdentifier
This class provides ListSample interface to ITK VectorContainer.
SampleAdaptorPointer m_SampleAdaptor
TreeConstPointer m_Tree
typename TreeType::InstanceIdentifierVectorType NeighborsIdentifierType
typename PointsContainer::ConstIterator PointsContainerConstIterator
typename PointsContainer::ConstPointer PointsContainerConstPointer
Accelerate geometric searches for points.
typename PointsContainer::Element PointType
TreeGeneratorPointer m_KdTreeGenerator
typename TreeGeneratorType::Pointer TreeGeneratorPointer
TPointsContainer PointsContainer
This class generates a KdTree object without centroid information.
typename PointsContainer::Pointer PointsContainerPointer
typename PointsContainer::Iterator PointsContainerIterator
typename SampleAdaptorType::Pointer SampleAdaptorPointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
PointsContainerPointer m_Points
Base class for most ITK classes.
Definition: itkObject.h:60
This class provides methods for k-nearest neighbor search and related data structures for a k-d tree...
Definition: itkKdTree.h:483