00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __itkPointLocator_h
00021 #define __itkPointLocator_h
00022
00023 #include "itkObject.h"
00024 #include "itkPoint.h"
00025 #include "itkNumericTraits.h"
00026 #include "itkBoundingBox.h"
00027
00028 namespace itk
00029 {
00030
00052 template <
00053 typename TPointIdentifier = unsigned long,
00054 int VPointDimension = 3,
00055 typename TCoordRep = float,
00056 typename TPointsContainer =
00057 VectorContainer< TPointIdentifier,Point<TCoordRep,VPointDimension> >
00058 >
00059 class ITK_EXPORT PointLocator : public Object
00060 {
00061 public:
00063 typedef PointLocator Self;
00064 typedef Object Superclass;
00065 typedef SmartPointer<Self> Pointer;
00066 typedef SmartPointer<const Self> ConstPointer;
00067
00069 itkNewMacro(Self);
00070
00072 itkTypeMacro(PointLocator, Object);
00073
00075 itkStaticConstMacro(PointDimension, unsigned int, VPointDimension);
00076
00079 typedef TPointIdentifier PointIdentifier;
00080 typedef TCoordRep CoordRepType;
00081 typedef TPointsContainer PointsContainer;
00082 typedef typename PointsContainer::Pointer PointsContainerPointer;
00083 typedef Point< CoordRepType, VPointDimension > PointType;
00084
00086 typedef BoundingBox<PointIdentifier,VPointDimension,
00087 CoordRepType,PointsContainer> BoundingBoxType;
00088 typedef typename BoundingBoxType::Pointer BoundingBoxPointer;
00089
00091 itkSetVectorMacro(Divisions,unsigned long,VPointDimension);
00092 itkGetVectorMacro(Divisions,unsigned long,VPointDimension);
00094
00096 itkSetClampMacro(NumberOfPointsPerBucket,
00097 unsigned long,1,NumericTraits<unsigned long>::max());
00098 itkGetConstMacro(NumberOfPointsPerBucket,unsigned long);
00100
00105 void InitPointInsertion(PointsContainer *newPts, BoundingBoxPointer bbox);
00106
00111 void InitIncrementalPointInsertion(PointsContainer *newPts, BoundingBoxPointer bbox);
00112
00113 #if 0
00114
00117 virtual int FindClosestPoint(float x[3]);
00118 int FindClosestPoint(float x, float y, float z);
00120
00124 virtual int InitPointInsertion(itkPoints *newPts, float bounds[6],
00125 int estSize);
00126
00133 virtual void InsertPoint(int ptId, float x[3]);
00134
00142 virtual int InsertNextPoint(float x[3]);
00143
00147 int IsInsertedPoint(float x, float y, float z)
00148 {
00149 float xyz[3];
00150 xyz[0] = x; xyz[1] = y; xyz[2] = z;
00151 return this->IsInsertedPoint (xyz);
00152 };
00153 virtual int IsInsertedPoint(float x[3]);
00155
00162 virtual int InsertUniquePoint(float x[3], int &ptId);
00163
00166 virtual int FindClosestInsertedPoint(float x[3]);
00167 #endif
00168
00169 protected:
00170 PointLocator();
00171 ~PointLocator();
00172 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00173
00174 #if 0
00175
00176 void GetBucketNeighbors(int ijk[3], int ndivs[3], int level);
00177 void GetOverlappingBuckets(float x[3], int ijk[3], float dist, int level);
00178 void GetOverlappingBuckets(float x[3], float dist, int prevMinLevel[3],
00179 int prevMaxLevel[3]);
00180 void GenerateFace(int face, int i, int j, int k,
00181 itkPoints *pts, itkCellArray *polys);
00182 float Distance2ToBucket(float x[3], int nei[3]);
00183 float Distance2ToBounds(float x[3], float bounds[6]);
00184
00185
00186 float m_Bounds[6];
00187 itkIdList **m_HashTable;
00188 int m_NumberOfBuckets;
00189 float m_H[3];
00190 itkNeighborPoints *m_Buckets;
00191
00192 float m_InsertionTol2;
00193 float m_InsertionLevel;
00194 #endif
00195
00196 private:
00197 PointLocator(const Self&);
00198 void operator=(const Self&);
00199
00200 unsigned long *m_Divisions;
00201 unsigned long m_NumberOfPointsPerBucket;
00202
00203 PointsContainerPointer m_Points;
00204
00205 };
00206
00207 }
00208
00209 #ifndef ITK_MANUAL_INSTANTIATION
00210 #include "itkPointLocator.txx"
00211 #endif
00212
00213 #endif
00214