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

itkQuadEdgeMesh.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkQuadEdgeMesh.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/02/26 15:46:54 $
00007   Version:   $Revision: 1.12 $
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      This software is distributed WITHOUT ANY WARRANTY; without even
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 
00018 #ifndef __itkQuadEdgeMesh_h
00019 #define __itkQuadEdgeMesh_h
00020 
00021 #include "vcl_cstdarg.h"
00022 #include <queue>
00023 #include <vector>
00024 #include <list>
00025 
00026 #include "itkMesh.h"
00027 
00028 #include "itkQuadEdgeMeshTraits.h"
00029 #include "itkQuadEdgeMeshLineCell.h"
00030 #include "itkQuadEdgeMeshPolygonCell.h"
00031 
00032 #include "itkQuadEdgeMeshFrontIterator.h"
00033 #include "itkConceptChecking.h"
00034 
00097 namespace itk
00098 {
00099 
00111 template< typename TPixel, unsigned int VDimension,
00112   typename TTraits = QuadEdgeMeshTraits< TPixel, VDimension, bool, bool > >
00113 class QuadEdgeMesh : public Mesh< TPixel, VDimension, TTraits >
00114 {
00115 public:
00116 
00118   typedef TTraits Traits;
00119   typedef TPixel  PixelType;
00120 
00122   typedef QuadEdgeMesh                            Self;
00123   typedef Mesh< TPixel, VDimension, Traits >      Superclass;
00124   typedef SmartPointer< Self >                    Pointer;
00125   typedef SmartPointer< const Self >              ConstPointer;
00126 
00128   itkStaticConstMacro( PointDimension, unsigned int,
00129                        Traits::PointDimension );
00130   itkStaticConstMacro( MaxTopologicalDimension, unsigned int,
00131                        Traits::MaxTopologicalDimension );
00133 
00135   typedef typename Superclass::CellPixelType    CellPixelType;
00136   typedef typename Superclass::CoordRepType     CoordRepType;
00137   typedef typename Superclass::PointIdentifier  PointIdentifier;
00138   typedef typename Superclass::PointType        PointType;
00139   typedef typename Superclass::CellTraits       CellTraits;
00140 
00141   // Point section:
00142   typedef typename Superclass::PointsContainer        PointsContainer;
00143   typedef typename Superclass::PointsContainerPointer PointsContainerPointer;
00144   typedef typename Superclass::PointLocatorPointer    PointLocatorPointer;
00145   typedef typename Superclass::PointLocatorType       PointLocatorType;
00146   typedef CoordRepType  CoordRepArrayType[ 
00147                               itkGetStaticConstMacro( PointDimension ) ];
00148 
00149   // Point data section:
00150   typedef typename Superclass::PointDataContainer     PointDataContainer;
00151   typedef typename Superclass::PointDataContainerPointer
00152                                PointDataContainerPointer;
00153   typedef typename Superclass::PointDataContainerIterator
00154                                PointDataContainerIterator;
00155   typedef typename Superclass::PointsContainerConstIterator
00156                                PointsContainerConstIterator;
00157   typedef typename Superclass::PointsContainerIterator
00158                                PointsContainerIterator;
00159 
00160   // Cell section:
00161   typedef typename Superclass::CellIdentifier         CellIdentifier;
00162   typedef typename Superclass::CellType               CellType;
00163   typedef typename Superclass::CellAutoPointer        CellAutoPointer;
00164   typedef typename Superclass::CellFeatureIdentifier  CellFeatureIdentifier;
00165   typedef typename Superclass::CellFeatureCount       CellFeatureCount;
00166   typedef typename Superclass::CellMultiVisitorType   CellMultiVisitorType;
00167   typedef typename Superclass::CellsContainer         CellsContainer;
00168   typedef typename Superclass::CellsContainerPointer  CellsContainerPointer;
00169 
00170   typedef typename Superclass::CellsContainerConstIterator
00171                                                   CellsContainerConstIterator;
00172   typedef typename Superclass::CellsContainerIterator
00173                                                   CellsContainerIterator;
00174 
00175   typedef typename Superclass::CellLinksContainer CellLinksContainer;
00176   typedef typename Superclass::CellLinksContainerPointer
00177                                                   CellLinksContainerPointer;
00178   typedef typename Superclass::CellLinksContainerIterator
00179                                                   CellLinksContainerIterator;
00180 
00181   // Cell data section:
00182   typedef typename Superclass::CellDataContainer  CellDataContainer;
00183   typedef typename Superclass::CellDataContainerPointer
00184                                                   CellDataContainerPointer;
00185   typedef typename Superclass::CellDataContainerIterator
00186                                                   CellDataContainerIterator;
00187 
00188   // Point / Cell correspondance section:
00189   typedef typename Superclass::PointCellLinksContainer
00190                                         PointCellLinksContainer;
00191   typedef typename Superclass::PointCellLinksContainerIterator
00192                                         PointCellLinksContainerIterator;
00193 
00194   // BoundaryAssignMents section:
00195   typedef typename Superclass::BoundaryAssignmentsContainer
00196                                BoundaryAssignmentsContainer;
00197   typedef typename Superclass::BoundaryAssignmentsContainerPointer
00198                                BoundaryAssignmentsContainerPointer;
00199   typedef typename Superclass::BoundaryAssignmentsContainerVector
00200                                BoundaryAssignmentsContainerVector;
00201 
00202   // Miscelaneous section:
00203   typedef typename Superclass::BoundingBoxPointer         BoundingBoxPointer;
00204   typedef typename Superclass::BoundingBoxType            BoundingBoxType;
00205   typedef typename Superclass::RegionType                 RegionType;
00206   typedef typename Superclass::InterpolationWeightType
00207                                InterpolationWeightType;
00208 
00210   typedef typename Traits::PrimalDataType PrimalDataType;
00211   typedef typename Traits::DualDataType   DualDataType;
00212   typedef typename Traits::QEPrimal       QEPrimal;
00213   typedef typename Traits::QEDual         QEDual;
00214   typedef typename Traits::QEPrimal       QEType;
00215   // See the TODO entry dated from 2005-05-28
00216   // struct QEType : public QEPrimal, public QEDual {};
00217   typedef typename Traits::VertexRefType  VertexRefType;
00218   typedef typename Traits::FaceRefType    FaceRefType;
00219   typedef typename Traits::VectorType     VectorType;
00220 
00222   typedef QuadEdgeMeshLineCell< CellType >    EdgeCellType;
00223   typedef QuadEdgeMeshPolygonCell< CellType > PolygonCellType;
00224 
00226   typedef std::queue< PointIdentifier > FreePointIndexesType;
00227   typedef std::queue< CellIdentifier >  FreeCellIndexesType;
00228 
00230   typedef std::vector< PointIdentifier >    PointIdList;
00231   typedef std::list< QEPrimal* >            EdgeListType;
00232   typedef EdgeListType*                     EdgeListPointerType;
00233 
00235   static const PointIdentifier m_NoPoint;
00236 
00238   static const CellIdentifier m_NoFace;
00239 
00240 public:
00241 
00243   itkNewMacro( Self );
00244   itkTypeMacro( QuadEdgeMesh, Mesh );
00246 
00248   itkQEDefineFrontIteratorMethodsMacro( Self );
00249 
00250 
00251 public:
00252 
00253   virtual bool RequestedRegionIsOutsideOfTheBufferedRegion()
00254     {
00255     return false;
00256     }
00257 
00258   virtual void Clear();
00265   virtual void CopyInformation( const DataObject* data ) { (void)data; }
00266 
00268   void BuildCellLinks() { }
00269 
00270   virtual bool FindClosestPoint( const CoordRepArrayType coords,
00271                                  PointIdentifier & pointId ) const;
00272 
00274   void SetCell( CellIdentifier cId, CellAutoPointer& cell );
00275 
00277   virtual PointIdentifier FindFirstUnusedPointIndex();
00278   virtual CellIdentifier  FindFirstUnusedCellIndex();
00279   virtual void PushOnContainer( EdgeCellType* newEdge );
00281 
00282   // ////////////////// Adding Point/Edge/Face methods
00283   virtual PointIdentifier AddPoint( const PointType& p );
00284   virtual QEPrimal* AddEdge( const PointIdentifier& orgPid,
00285                              const PointIdentifier& destPid );
00286 
00288   virtual void      AddFace( QEPrimal* e );
00289 
00294   virtual QEPrimal* AddFace( const PointIdList& points );
00295 
00297   virtual QEPrimal* AddFaceTriangle( const PointIdentifier& aPid,
00298                                      const PointIdentifier& bPid,
00299                                      const PointIdentifier& cPid );
00300 
00302   virtual void DeletePoint( const PointIdentifier& pid );
00303   virtual void DeleteEdge( const PointIdentifier& orgPid,
00304                            const PointIdentifier& destPid );
00305   virtual void DeleteEdge( QEPrimal* e );
00306   virtual void LightWeightDeleteEdge( QEPrimal* e );
00307   virtual void DeleteFace( FaceRefType faceToDelete );
00309 
00310   // //////////////////
00311   virtual PointType  GetPoint ( const PointIdentifier& pid ) const;
00312   virtual VectorType GetVector( const PointIdentifier& pid ) const;
00313   virtual QEPrimal*  GetEdge() const;
00314   virtual QEPrimal*  GetEdge( const CellIdentifier& eid ) const;
00315   virtual QEPrimal*  FindEdge( const PointIdentifier& pid0 ) const;
00316   virtual QEPrimal*  FindEdge( const PointIdentifier& pid0,
00317                                const PointIdentifier& pid1 ) const;
00318 
00320   CoordRepType ComputeEdgeLength( QEPrimal* e );
00321 
00322   unsigned long ComputeNumberOfPoints() const;
00323   unsigned long ComputeNumberOfFaces() const;
00324   unsigned long ComputeNumberOfEdges() const;
00325 
00326   PointIdentifier Splice( QEPrimal* a, QEPrimal* b );
00327 
00328 #ifdef ITK_USE_CONCEPT_CHECKING
00329 
00330   itkConceptMacro(DimensionShouldBe3,
00331     (Concept::SameDimension<itkGetStaticConstMacro(PointDimension),3>));
00332 
00334 #endif
00335 
00336 protected:
00338   QuadEdgeMesh();
00339   virtual ~QuadEdgeMesh() {}
00340 
00341 private:
00342   QuadEdgeMesh( const Self& );    //purposely not implemented
00343   void operator=( const Self& );  //purposely not implemented
00344 
00345 protected:
00346   FreePointIndexesType m_FreePointIndexes;
00347   FreeCellIndexesType  m_FreeCellIndexes;
00348 
00349 };
00350 
00351 }
00352 
00353 
00354 #ifndef ITK_MANUAL_INSTANTIATION
00355 #include "itkQuadEdgeMeshMacro.h"
00356 #include "itkQuadEdgeMesh.txx"
00357 #endif
00358 
00359 #endif
00360 

Generated at Mon Mar 12 02:22:45 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000