ITK  4.2.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<typename TPointIdentifier = IdentifierType, int VPointDimension = 3,
42  typename TCoordRep = float, typename TPointsContainer =
43  VectorContainer<TPointIdentifier, Point<TCoordRep, VPointDimension> >
44  >
45 class ITK_EXPORT PointsLocator : public Object
46 {
47 public:
50  typedef Object Superclass;
53 
55  itkNewMacro( Self );
56 
58  itkTypeMacro( PointsLocator, Object );
59 
61  typedef TPointIdentifier PointIdentifier;
62  typedef TCoordRep CoordRepType;
63  typedef TPointsContainer PointsContainer;
64  typedef typename PointsContainer::Pointer PointsContainerPointer;
65  typedef typename PointsContainer::ConstPointer PointsContainerConstPointer;
66 
68 
70  itkStaticConstMacro( PointDimension, unsigned int, VPointDimension );
71 
73  typedef typename PointsContainer::ConstIterator PointsContainerConstIterator;
74  typedef typename PointsContainer::Iterator PointsContainerIterator;
75 
80 
87 
89  itkSetObjectMacro( Points, PointsContainer );
90 
92  itkGetConstObjectMacro( Points, PointsContainer );
93 
95  void Initialize();
96 
98  PointIdentifier FindClosestPoint( const PointType &query ) const;
99 
101  void Search( const PointType &, unsigned int, NeighborsIdentifierType & )
102  const;
103 
105  void FindClosestNPoints( const PointType &, unsigned int,
106  NeighborsIdentifierType & ) const;
107 
109  void Search( const PointType &, double, NeighborsIdentifierType & ) const;
110 
112  void FindPointsWithinRadius( const PointType &, double,
113  NeighborsIdentifierType & ) const;
114 
115 protected:
116  PointsLocator();
117  ~PointsLocator();
118  virtual void PrintSelf(std::ostream& os, Indent indent) const;
119 
120 private:
121  PointsLocator( const Self& ); //purposely not implemented
122  void operator=( const Self& ); //purposely not implemented
123 
128 };
129 
130 } // end namespace itk
131 
132 #ifndef ITK_MANUAL_INSTANTIATION
133 #include "itkPointsLocator.hxx"
134 #endif
135 
136 #endif
137