Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkPointLocator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkPointLocator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/09/10 14:29:23 $
00007   Version:   $Revision: 1.23 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012   Portions of this code are covered under the VTK copyright.
00013   See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
00014 
00015      This software is distributed WITHOUT ANY WARRANTY; without even 
00016      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00017      PURPOSE.  See the above copyright notices for more information.
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   itkGetMacro(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   // place points in appropriate buckets
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 Bounds[6]; // bounds of points
00187   itkIdList **HashTable; // lists of point ids in buckets
00188   int NumberOfBuckets; // total size of hash table
00189   float H[3]; // width of each bucket in x-y-z directions
00190   itkNeighborPoints *Buckets;
00191 
00192   float InsertionTol2;
00193   float InsertionLevel; 
00194 #endif
00195 
00196 private:
00197   PointLocator(const Self&); //purposely not implemented
00198   void operator=(const Self&); //purposely not implemented
00199 
00200   unsigned long *m_Divisions;
00201   unsigned long m_NumberOfPointsPerBucket;
00202 
00203   PointsContainerPointer m_Points;
00204 
00205 }; // End Class: PointLocator
00206 
00207 } // end namespace itk
00208   
00209 #ifndef ITK_MANUAL_INSTANTIATION
00210 #include "itkPointLocator.txx"
00211 #endif
00212   
00213 #endif
00214 
00215 
00216 

Generated at Wed Nov 5 23:30:51 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000