1 #ifndef __CPM__ALGORITHMS__BASE__FINDCLOSESTPOINTINMESH__H__
2 #define __CPM__ALGORITHMS__BASE__FINDCLOSESTPOINTINMESH__H__
5 #include <itkWeightedCentroidKdTreeGenerator.h>
6 #include <itkListSample.h>
8 #include <cpm/DataStructures/KDVector.h>
18 template< class M, class S = float >
19 class FindClosestPointInMesh
23 typedef FindClosestPointInMesh Self;
24 typedef itk::Object Superclass;
25 typedef itk::SmartPointer< Self > Pointer;
26 typedef itk::SmartPointer< const Self > ConstPointer;
28 itkStaticConstMacro( Dimension, unsigned int, M::PointDimension );
30 typedef cpm::DataStructures::KDVector< S, Dimension > TKDVector;
31 typedef itk::Statistics::ListSample< TKDVector > TKDSample;
34 itk::Statistics::WeightedCentroidKdTreeGenerator< TKDSample >
36 typedef typename TKDGenerator::KdTreeType TKDTree;
37 typedef typename TKDTree::KdTreeNodeType TKDNode;
41 itkTypeMacro( FindClosestPointInMesh, itkObject );
43 itkGetConstMacro( BucketSize, unsigned int );
44 itkSetMacro( BucketSize, unsigned int );
46 itkGetConstObjectMacro( Mesh, M );
49 void SetMesh( const M* m );
54 typename M::PointIdentifier FindClosestPoint( const P& p ) const;
56 template< class P, class C >
57 typename M::PointIdentifier FindClosestPoint(
58 const P& p, const C& c
61 template< class V, class N >
62 void _Dummy( TKDNode* root, const V& d, const V& n, const N& nd ) const;
65 FindClosestPointInMesh( );
66 virtual ~FindClosestPointInMesh( );
68 template< class V, class N, class P >
69 static S _LinePointDistance( const P& p0, const V& d, const V& n, const N& nd );
72 // Purposely not implemented
73 FindClosestPointInMesh( Self& );
74 Self& operator=( Self& );
77 unsigned int m_BucketSize;
78 typename M::ConstPointer m_Mesh;
79 typename TKDSample::Pointer m_KDSample;
80 typename TKDGenerator::Pointer m_KDGenerator;
81 typename TKDTree::Pointer m_KDTree;
90 #include <cpm/Algorithms/Base/FindClosestPointInMesh.hxx>
92 #endif // __CPM__ALGORITHMS__BASE__FINDCLOSESTPOINTINMESH__H__