Medical Imaging Interaction Toolkit  2025.12.02
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 {
39  class MITKALGORITHMSEXT_EXPORT PointLocator : public itk::Object
40  {
41  public:
43 
44  itkFactorylessNewMacro(Self);
45 
46  itkCloneMacro(Self);
47 
48  typedef int IdType;
50 
51  typedef float PixelType;
52  typedef double CoordRepType;
53  typedef itk::DefaultStaticMeshTraits<PixelType, 3, 2, CoordRepType, CoordRepType, PixelType> MeshTraits;
54  typedef itk::PointSet<PixelType, 3, MeshTraits> ITKPointSet;
55 
61  void SetPoints(vtkPointSet *points);
62 
68  void SetPoints(mitk::PointSet *points);
69 
75  void SetPoints(ITKPointSet *pointSet);
76 
86  IdType FindClosestPoint(const double point[3]);
87 
99  IdType FindClosestPoint(double x, double y, double z);
100 
111 
122 
136 
137  protected:
138  //
139  // Definition of a vector of ids
140  //
141  typedef std::vector<IdType> IdVectorType;
142 
143  //
144  // ANN related typedefs, to prevent ANN from being in the global include path.
145  // Please note, that these line are prone to failure, if the point type in
146  // ANN changes. Please note also, that these typedefs are only used in the header
147  // file. The implementation always refers to the original types
148  //
149  typedef double *MyANNpoint;
150  typedef int MyANNidx;
151  typedef double MyANNdist;
155 
160 
164  ~PointLocator() override;
165 
169  void InitANN();
170 
174  void DestroyANN();
175 
186 
197 
199 
201 
202  vtkPoints *m_VtkPoints;
205 
206  //
207  // ANN related variables
208  //
209  unsigned int m_ANNK;
210  unsigned int m_ANNDimension;
211  double m_ANNEpsilon;
216  ANNkd_tree *m_ANNTree;
217  };
218 }
219 
220 #endif
#define MITKALGORITHMSEXT_EXPORT
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:72
Find image slices visible on a given plane.
double ScalarType