ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkDecimationQuadEdgeMeshFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkDecimationQuadEdgeMeshFilter_h
19 #define __itkDecimationQuadEdgeMeshFilter_h
20 
21 #include "itkIntTypes.h"
23 
24 namespace itk
25 {
31 template< class TInput, class TOutput, class TCriterion >
33  public QuadEdgeMeshToQuadEdgeMeshFilter< TInput, TOutput >
34 {
35 public:
40 
43 
44  typedef TInput InputMeshType;
45  typedef typename InputMeshType::Pointer InputMeshPointer;
46 
47  typedef TOutput OutputMeshType;
48  typedef typename OutputMeshType::Pointer OutputMeshPointer;
49 
50  typedef TCriterion CriterionType;
51  typedef typename CriterionType::Pointer CriterionPointer;
52  typedef typename CriterionType::MeasureType MeasureType;
53  typedef typename CriterionType::PriorityType PriorityType;
54  typedef typename CriterionType::PriorityQueueWrapperType PriorityQueueItemType;
55 
56  itkSetObjectMacro(Criterion, CriterionType);
57 
58 protected:
60  {
61  this->m_Iteration = 0;
62  this->m_OutputMesh = 0;
63  }
64 
66 
69 
70  void GenerateData()
71  {
72  this->CopyInputMeshToOutputMesh();
73 
74  Initialize();
75  FillPriorityQueue();
76  m_Iteration = 0;
77  this->m_OutputMesh = this->GetOutput();
78  do
79  {
80  this->Extract();
81 
82  if ( ProcessWithTopologicalGuarantee() )
83  {
84  return;
85  }
86 
87  ++m_Iteration;
88  }
89  while ( !IsCriterionSatisfied() );
90 
91  this->GetOutput()->SqueezePointsIds();
92  }
93 
94  virtual void Initialize() {}
95  virtual void FillPriorityQueue() = 0;
96 
97  virtual void Extract() = 0;
98 
99  virtual bool ProcessWithoutAnyTopologicalGuarantee() = 0;
100 
101  virtual bool ProcessWithTopologicalGuarantee() = 0;
102 
103  virtual bool IsCriterionSatisfied() = 0;
104 
105  void PrintSelf(std::ostream & os, Indent indent) const
106  {
107  this->Superclass::PrintSelf(os, indent);
108  os << indent << "Criterion: " << m_Criterion << std::endl;
109  }
110 
113 
114 private:
116  void operator=(const Self &);
117 };
118 }
119 
120 #endif
121