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: 2002/09/11 19:57:13 $
00007   Version:   $Revision: 1.22 $
00008 
00009   Copyright (c) 2002 Insight 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);
00093   
00095   itkSetClampMacro(NumberOfPointsPerBucket,
00096                    unsigned long,1,NumericTraits<unsigned long>::max());
00097   itkGetMacro(NumberOfPointsPerBucket,unsigned long);
00098   
00103   void InitPointInsertion(PointsContainer *newPts, BoundingBoxPointer bbox);
00104 
00109   void InitIncrementalPointInsertion(PointsContainer *newPts, BoundingBoxPointer bbox);
00110 
00111 #if 0
00112 
00115   virtual int FindClosestPoint(float x[3]);
00116   int FindClosestPoint(float x, float y, float z);
00117 
00121   virtual int InitPointInsertion(itkPoints *newPts, float bounds[6], 
00122          int estSize);
00123 
00130   virtual void InsertPoint(int ptId, float x[3]);
00131 
00139   virtual int InsertNextPoint(float x[3]);
00140 
00144   int IsInsertedPoint(float x, float  y, float z)
00145     {
00146     float xyz[3];
00147     xyz[0] = x; xyz[1] = y; xyz[2] = z;
00148     return this->IsInsertedPoint (xyz);
00149     };
00150   virtual int IsInsertedPoint(float x[3]);
00151 
00158   virtual int InsertUniquePoint(float x[3], int &ptId);
00159 
00162   virtual int FindClosestInsertedPoint(float x[3]);
00163 #endif
00164 
00165 protected:
00166   PointLocator();
00167   ~PointLocator();
00168   virtual void PrintSelf(std::ostream& os, Indent indent) const;
00169 
00170 #if 0
00171   // place points in appropriate buckets
00172   void GetBucketNeighbors(int ijk[3], int ndivs[3], int level);
00173   void GetOverlappingBuckets(float x[3], int ijk[3], float dist, int level);
00174   void GetOverlappingBuckets(float x[3], float dist, int prevMinLevel[3],
00175                                            int prevMaxLevel[3]);
00176   void GenerateFace(int face, int i, int j, int k, 
00177                     itkPoints *pts, itkCellArray *polys);
00178   float Distance2ToBucket(float x[3], int nei[3]);
00179   float Distance2ToBounds(float x[3], float bounds[6]);
00180 
00181 
00182   float Bounds[6]; // bounds of points
00183   itkIdList **HashTable; // lists of point ids in buckets
00184   int NumberOfBuckets; // total size of hash table
00185   float H[3]; // width of each bucket in x-y-z directions
00186   itkNeighborPoints *Buckets;
00187 
00188   float InsertionTol2;
00189   float InsertionLevel; 
00190 #endif
00191 
00192 private:
00193   PointLocator(const Self&); //purposely not implemented
00194   void operator=(const Self&); //purposely not implemented
00195 
00196   unsigned long *m_Divisions;
00197   unsigned long m_NumberOfPointsPerBucket;
00198 
00199   PointsContainerPointer m_Points;
00200 
00201 }; // End Class: PointLocator
00202 
00203 } // end namespace itk
00204   
00205 #ifndef ITK_MANUAL_INSTANTIATION
00206 #include "itkPointLocator.txx"
00207 #endif
00208   
00209 #endif
00210 
00211 

Generated at Fri May 21 01:15:12 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000