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: 2008-10-01 18:15:23 $
00007   Version:   $Revision: 1.2 $
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     Superclass::GenerateData();
00070     
00071     Initialize();
00072     FillPriorityQueue();
00073     m_Iteration = 0;
00074     bool topological_change = this->m_Criterion->GetTopologicalChange();
00075 
00076     do
00077       {
00078       Extract();
00079       if ( topological_change )
00080         {
00081         ProcessWithoutAnyTopologicalGuarantee();
00082         }
00083       else
00084         {
00085         if ( ProcessWithTopologicalGuarantee() )
00086           {
00087           return;
00088           }
00089         }
00090       ++m_Iteration;
00091       } while ( !IsCriterionSatisfied() );
00092     
00093     this->GetOutput()->SqueezePointsIds( );
00094     }
00095 
00096   virtual void Initialize() {}
00097   virtual void FillPriorityQueue() = 0;
00098   virtual void Extract() = 0;
00099   virtual bool ProcessWithoutAnyTopologicalGuarantee() = 0;
00100   virtual bool ProcessWithTopologicalGuarantee() = 0;
00101   virtual bool IsCriterionSatisfied() = 0;
00102 
00103   void PrintSelf( std::ostream& os, Indent indent ) const
00104     {
00105     this->Superclass::PrintSelf( os, indent );
00106     }
00107 
00108 private:
00109   QuadEdgeMeshDecimationFilter( const Self& );
00110   void operator = ( const Self& );
00111 };
00112 }
00113 
00114 #endif
00115 

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