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

itkQuadEdgeMeshDecimationFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkQuadEdgeMeshDecimationFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-22 01:41:45 $
00007   Version:   $Revision: 1.4 $
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 __itkQuadEdgeMeshDecimationFilter_h
00019 #define __itkQuadEdgeMeshDecimationFilter_h
00020 
00021 #include <itkQuadEdgeMeshToQuadEdgeMeshFilter.h>
00022 
00023 namespace itk
00024 {
00029 template< class TInput, class TOutput, class TCriterion >
00030 class QuadEdgeMeshDecimationFilter :
00031       public QuadEdgeMeshToQuadEdgeMeshFilter< TInput, TOutput >
00032 {
00033 public:
00034   typedef QuadEdgeMeshDecimationFilter                          Self;
00035   typedef SmartPointer< Self >                                  Pointer;
00036   typedef SmartPointer< const Self >                            ConstPointer;
00037   typedef QuadEdgeMeshToQuadEdgeMeshFilter< TInput, TOutput >   Superclass;
00038 
00040   itkTypeMacro( QuadEdgeMeshDecimationFilter, QuadEdgeMeshToQuadEdgeMeshFilter );
00041 
00042   typedef TInput                                                InputMeshType;
00043   typedef typename InputMeshType::Pointer                       InputMeshPointer;
00044 
00045   typedef TOutput                                               OutputMeshType;
00046   typedef typename OutputMeshType::Pointer                      OutputMeshPointer;
00047 
00048   typedef TCriterion                                            CriterionType;
00049   typedef typename CriterionType::Pointer                       CriterionPointer;
00050   typedef typename CriterionType::MeasureType                   MeasureType;
00051   typedef typename CriterionType::PriorityType                  PriorityType;
00052   typedef typename CriterionType::PriorityQueueWrapperType      PriorityQueueItemType;
00053 
00054   itkSetObjectMacro( Criterion, CriterionType );
00055 
00056 protected:
00057   QuadEdgeMeshDecimationFilter()
00058     {
00059     this->m_Iteration = 0;
00060     }
00061 
00062   ~QuadEdgeMeshDecimationFilter() {}
00063 
00064   CriterionPointer      m_Criterion;
00065   unsigned long         m_Iteration;
00066 
00067   void GenerateData()
00068     {
00069     this->CopyInputMeshToOutputMesh();
00070 
00071     Initialize();
00072     FillPriorityQueue();
00073     m_Iteration = 0;
00074 
00075     do
00076       {
00077       this->Extract();
00078 
00079       if ( ProcessWithTopologicalGuarantee() )
00080         {
00081         return;
00082         }
00083 
00084       ++m_Iteration;
00085       } while ( !IsCriterionSatisfied() );
00086 
00087     this->GetOutput()->SqueezePointsIds( );
00088     }
00089 
00090   virtual void Initialize() {}
00091   virtual void FillPriorityQueue() = 0;
00092   virtual void Extract() = 0;
00093   virtual bool ProcessWithoutAnyTopologicalGuarantee() = 0;
00094   virtual bool ProcessWithTopologicalGuarantee() = 0;
00095   virtual bool IsCriterionSatisfied() = 0;
00096 
00097   void PrintSelf( std::ostream& os, Indent indent ) const
00098     {
00099     this->Superclass::PrintSelf( os, indent );
00100     }
00101 
00102 private:
00103   QuadEdgeMeshDecimationFilter( const Self& );
00104   void operator = ( const Self& );
00105 };
00106 }
00107 
00108 #endif
00109 

Generated at Mon Jul 12 2010 19:30:29 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000