Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _MITK_POINT_LOCATOR__H__
00019 #define _MITK_POINT_LOCATOR__H__
00020
00021 #include <itkObject.h>
00022 #include "MitkExtExports.h"
00023
00024 #include "mitkPointSet.h"
00025
00026 #include <vtkPoints.h>
00027
00028
00029
00030 class vtkPointSet;
00031 class ANNkd_tree;
00032
00033 namespace mitk
00034 {
00035
00046 class MitkExt_EXPORT PointLocator : public itk::Object
00047 {
00048 public:
00049
00050 mitkClassMacro( PointLocator, Object );
00051
00052 itkNewMacro( Self );
00053
00054 typedef int IdType;
00055 typedef float DistanceType;
00056
00057 typedef float PixelType;
00058 typedef double CoordRepType;
00059 typedef itk::DefaultStaticMeshTraits<PixelType, 3, 2, CoordRepType,
00060 CoordRepType, PixelType> MeshTraits;
00061 typedef itk::PointSet<PixelType, 3, MeshTraits> ITKPointSet;
00062
00068 void SetPoints( vtkPointSet* points );
00069
00075 void SetPoints( mitk::PointSet* points );
00076
00082 void SetPoints( ITKPointSet* pointSet );
00083
00084
00094 IdType FindClosestPoint( const vtkFloatingPointType point[3] );
00095
00107 IdType FindClosestPoint( vtkFloatingPointType x, vtkFloatingPointType y, vtkFloatingPointType z );
00108
00118 IdType FindClosestPoint( mitk::PointSet::PointType point );
00119
00129 DistanceType GetMinimalDistance( mitk::PointSet::PointType point );
00130
00140 bool FindClosestPointAndDistance( mitk::PointSet::PointType point, IdType* id, DistanceType* dist);
00141
00142 protected:
00143
00144
00145
00146 typedef std::vector<IdType> IdVectorType;
00147
00148
00149
00150
00151
00152
00153
00154 typedef float* MyANNpoint;
00155 typedef int MyANNidx;
00156 typedef float MyANNdist;
00157 typedef MyANNpoint* MyANNpointArray;
00158 typedef MyANNidx* MyANNidxArray;
00159 typedef MyANNdist* MyANNdistArray;
00160
00164 PointLocator();
00165
00169 ~PointLocator();
00170
00174 void InitANN();
00175
00179 void DestroyANN();
00180
00190 IdType FindClosestPoint( const MyANNpoint& point);
00191
00200 DistanceType GetMinimalDistance( const MyANNpoint& point);
00201
00202 bool m_SearchTreeInitialized;
00203
00204 IdVectorType m_IndexToPointIdContainer;
00205
00206 vtkPoints* m_VtkPoints;
00207 mitk::PointSet* m_MitkPoints;
00208 ITKPointSet* m_ItkPoints;
00209
00210
00211
00212
00213
00214 unsigned int m_ANNK;
00215 unsigned int m_ANNDimension;
00216 double m_ANNEpsilon;
00217 MyANNpointArray m_ANNDataPoints;
00218 MyANNpoint m_ANNQueryPoint;
00219 MyANNidxArray m_ANNPointIndexes;
00220 MyANNdistArray m_ANNDistances;
00221 ANNkd_tree* m_ANNTree;
00222 };
00223
00224 }
00225
00226 #endif