Medical Imaging Interaction Toolkit  2024.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 {
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 
110  IdType FindClosestPoint(mitk::PointSet::PointType point);
111 
121  DistanceType GetMinimalDistance(mitk::PointSet::PointType point);
122 
135  bool FindClosestPointAndDistance(mitk::PointSet::PointType point, IdType *id, DistanceType *dist);
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 
159  PointLocator();
160 
164  ~PointLocator() override;
165 
169  void InitANN();
170 
174  void DestroyANN();
175 
185  IdType FindClosestANNPoint(const MyANNpoint &point);
186 
196  DistanceType GetMinimalDistance(const MyANNpoint &point);
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
mitk::PointLocator::IdVectorType
std::vector< IdType > IdVectorType
Definition: mitkPointLocator.h:141
mitk::PointLocator::m_VtkPoints
vtkPoints * m_VtkPoints
Definition: mitkPointLocator.h:202
mitk::PointLocator::MyANNidx
int MyANNidx
Definition: mitkPointLocator.h:150
mitk::PointLocator::MyANNdist
double MyANNdist
Definition: mitkPointLocator.h:151
mitk::PointLocator::ITKPointSet
itk::PointSet< PixelType, 3, MeshTraits > ITKPointSet
Definition: mitkPointLocator.h:54
mitk::PointLocator::MyANNidxArray
MyANNidx * MyANNidxArray
Definition: mitkPointLocator.h:153
MitkAlgorithmsExtExports.h
mitk::PointLocator::m_ANNTree
ANNkd_tree * m_ANNTree
Definition: mitkPointLocator.h:216
MITKALGORITHMSEXT_EXPORT
#define MITKALGORITHMSEXT_EXPORT
Definition: MitkAlgorithmsExtExports.h:15
mitk::PointLocator::m_ANNDimension
unsigned int m_ANNDimension
Definition: mitkPointLocator.h:210
mitk::PointLocator
Definition: mitkPointLocator.h:39
mitk::PointLocator::m_ANNDataPoints
MyANNpointArray m_ANNDataPoints
Definition: mitkPointLocator.h:212
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitkPointSet.h
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::PointLocator::m_ANNDistances
MyANNdistArray m_ANNDistances
Definition: mitkPointLocator.h:215
mitk::PointLocator::MyANNpoint
double * MyANNpoint
Definition: mitkPointLocator.h:149
mitk::PointLocator::m_ANNEpsilon
double m_ANNEpsilon
Definition: mitkPointLocator.h:211
mitk::PointLocator::DistanceType
ScalarType DistanceType
Definition: mitkPointLocator.h:49
mitk::PointLocator::m_ANNK
unsigned int m_ANNK
Definition: mitkPointLocator.h:209
mitk::PointLocator::MyANNpointArray
MyANNpoint * MyANNpointArray
Definition: mitkPointLocator.h:152
mitk::Point< ScalarType, 3 >
mitk::PointLocator::m_ANNPointIndexes
MyANNidxArray m_ANNPointIndexes
Definition: mitkPointLocator.h:214
mitk::PointLocator::CoordRepType
double CoordRepType
Definition: mitkPointLocator.h:52
mitk::PointLocator::m_MitkPoints
mitk::PointSet * m_MitkPoints
Definition: mitkPointLocator.h:203
mitk::PointLocator::PixelType
float PixelType
Definition: mitkPointLocator.h:51
mitk::PointLocator::m_ANNQueryPoint
MyANNpoint m_ANNQueryPoint
Definition: mitkPointLocator.h:213
mitk::PointLocator::MeshTraits
itk::DefaultStaticMeshTraits< PixelType, 3, 2, CoordRepType, CoordRepType, PixelType > MeshTraits
Definition: mitkPointLocator.h:53
mitk::PointSet
Data structure which stores a set of points.
Definition: mitkPointSet.h:71
mitk::PointLocator::m_IndexToPointIdContainer
IdVectorType m_IndexToPointIdContainer
Definition: mitkPointLocator.h:200
mitk::PointLocator::m_ItkPoints
ITKPointSet * m_ItkPoints
Definition: mitkPointLocator.h:204
mitk::PointLocator::m_SearchTreeInitialized
bool m_SearchTreeInitialized
Definition: mitkPointLocator.h:198
mitk::PointLocator::IdType
int IdType
Definition: mitkPointLocator.h:46
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20
mitk::PointLocator::MyANNdistArray
MyANNdist * MyANNdistArray
Definition: mitkPointLocator.h:154