Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkPointLocator.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkPointLocator_h
14 #define mitkPointLocator_h
15 
17 #include <itkObject.h>
18 
19 #include <mitkPointSet.h>
20 
21 #include <vtkPoints.h>
22 
23 // forward declarations
24 class vtkPointSet;
25 class ANNkd_tree;
26 
27 namespace mitk
28 {
47  class MITKALGORITHMSEXT_EXPORT PointLocator : public itk::Object
48  {
49  public:
51 
52  itkFactorylessNewMacro(Self);
53 
54  itkCloneMacro(Self);
55 
56  typedef int IdType;
58 
59  typedef float PixelType;
60  typedef double CoordRepType;
61  typedef itk::DefaultStaticMeshTraits<PixelType, 3, 2, CoordRepType, CoordRepType, PixelType> MeshTraits;
62  typedef itk::PointSet<PixelType, 3, MeshTraits> ITKPointSet;
63 
69  void SetPoints(vtkPointSet *points);
70 
76  void SetPoints(mitk::PointSet *points);
77 
83  void SetPoints(ITKPointSet *pointSet);
84 
94  IdType FindClosestPoint(const double point[3]);
95 
107  IdType FindClosestPoint(double x, double y, double z);
108 
119 
130 
144 
145  protected:
146  //
147  // Definition of a vector of ids
148  //
149  typedef std::vector<IdType> IdVectorType;
150 
151  //
152  // ANN related typedefs, to prevent ANN from being in the global include path.
153  // Please note, that these line are prone to failure, if the point type in
154  // ANN changes. Please note also, that these typedefs are only used in the header
155  // file. The implementation always refers to the original types
156  //
157  typedef double *MyANNpoint;
158  typedef int MyANNidx;
159  typedef double MyANNdist;
163 
168 
172  ~PointLocator() override;
173 
177  void InitANN();
178 
182  void DestroyANN();
183 
194 
205 
207 
209 
210  vtkPoints *m_VtkPoints;
213 
214  //
215  // ANN related variables
216  //
217  unsigned int m_ANNK;
218  unsigned int m_ANNDimension;
219  double m_ANNEpsilon;
224  ANNkd_tree *m_ANNTree;
225  };
226 }
227 
228 #endif
#define MITKALGORITHMSEXT_EXPORT
Convenience wrapper around ANN (Approximate Nearest Neighbours) for fast nearest-neighbour point sear...
ITKPointSet * m_ItkPoints
IdType FindClosestPoint(double x, double y, double z)
mitkClassMacroItkParent(PointLocator, itk::Object)
MyANNpoint m_ANNQueryPoint
MyANNidxArray m_ANNPointIndexes
bool FindClosestPointAndDistance(mitk::PointSet::PointType point, IdType *id, DistanceType *dist)
MyANNdistArray m_ANNDistances
DistanceType GetMinimalDistance(const MyANNpoint &point)
std::vector< IdType > IdVectorType
MyANNpointArray m_ANNDataPoints
MyANNdist * MyANNdistArray
void SetPoints(mitk::PointSet *points)
~PointLocator() override
itk::DefaultStaticMeshTraits< PixelType, 3, 2, CoordRepType, CoordRepType, PixelType > MeshTraits
DistanceType GetMinimalDistance(mitk::PointSet::PointType point)
IdType FindClosestPoint(mitk::PointSet::PointType point)
mitk::PointSet * m_MitkPoints
void SetPoints(ITKPointSet *pointSet)
IdType FindClosestANNPoint(const MyANNpoint &point)
void SetPoints(vtkPointSet *points)
IdType FindClosestPoint(const double point[3])
IdVectorType m_IndexToPointIdContainer
unsigned int m_ANNDimension
ANNkd_tree * m_ANNTree
MyANNpoint * MyANNpointArray
itk::PointSet< PixelType, 3, MeshTraits > ITKPointSet
Data structure which stores a set of points.
Definition: mitkPointSet.h:71
Find image slices visible on a given plane.
double ScalarType
Scalar type used throughout MITK for geometric computations.