ITK  4.2.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 protected:
59  {
60  this->m_Iteration = 0;
61  }
62 
64 
67 
68  void GenerateData()
69  {
70  this->CopyInputMeshToOutputMesh();
71 
72  Initialize();
73  FillPriorityQueue();
74  m_Iteration = 0;
75 
76  do
77  {
78  this->Extract();
79 
80  if ( ProcessWithTopologicalGuarantee() )
81  {
82  return;
83  }
84 
85  ++m_Iteration;
86  }
87  while ( !IsCriterionSatisfied() );
88 
89  this->GetOutput()->SqueezePointsIds();
90  }
91 
92  virtual void Initialize() {}
93  virtual void FillPriorityQueue() = 0;
94 
95  virtual void Extract() = 0;
96 
97  virtual bool ProcessWithoutAnyTopologicalGuarantee() = 0;
98 
99  virtual bool ProcessWithTopologicalGuarantee() = 0;
100 
101  virtual bool IsCriterionSatisfied() = 0;
102 
103  void PrintSelf(std::ostream & os, Indent indent) const
104  {
105  this->Superclass::PrintSelf(os, indent);
106  os << indent << "Criterion: " << m_Criterion << std::endl;
107  }
108 
109 private:
110  DecimationQuadEdgeMeshFilter(const Self &);
111  void operator=(const Self &);
112 };
113 }
114 
115 #endif
116