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-02-16 20:22:11 $
00007   Version:   $Revision: 1.3 $
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 //       std::cout <<m_Iteration <<std::endl;
00079       Extract();
00080 //       if ( topological_change )
00081 //         {
00082 //         std::cout <<"ProcessWithoutAnyTopologicalGuarantee" <<std::endl;
00083 //         ProcessWithoutAnyTopologicalGuarantee();
00084 //         }
00085 //       else
00086 //         {
00087         if ( ProcessWithTopologicalGuarantee() )
00088           {
00089 //           std::cout <<"ProcessWithTopologicalGuarantee" <<std::endl;
00090           return;
00091           }
00092 //         }
00093       ++m_Iteration;
00094       } while ( !IsCriterionSatisfied() );
00095 
00096     this->GetOutput()->SqueezePointsIds( );
00097     }
00098 
00099   virtual void Initialize() {}
00100   virtual void FillPriorityQueue() = 0;
00101   virtual void Extract() = 0;
00102   virtual bool ProcessWithoutAnyTopologicalGuarantee() = 0;
00103   virtual bool ProcessWithTopologicalGuarantee() = 0;
00104   virtual bool IsCriterionSatisfied() = 0;
00105 
00106   void PrintSelf( std::ostream& os, Indent indent ) const
00107     {
00108     this->Superclass::PrintSelf( os, indent );
00109     }
00110 
00111 private:
00112   QuadEdgeMeshDecimationFilter( const Self& );
00113   void operator = ( const Self& );
00114 };
00115 }
00116 
00117 #endif
00118 

Generated at Sat Feb 28 13:18:49 2009 for ITK by doxygen 1.5.6 written by Dimitri van Heesch, © 1997-2000