ITK  5.0.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< typename TInput, typename TOutput, typename TCriterion >
33  public QuadEdgeMeshToQuadEdgeMeshFilter< TInput, TOutput >
34 {
35 public:
40 
43 
44  using InputMeshType = TInput;
45  using InputMeshPointer = typename InputMeshType::Pointer;
46 
47  using OutputMeshType = TOutput;
48  using OutputMeshPointer = typename OutputMeshType::Pointer;
49 
50  using CriterionType = TCriterion;
51  using CriterionPointer = typename CriterionType::Pointer;
52  using MeasureType = typename CriterionType::MeasureType;
53  using PriorityType = typename CriterionType::PriorityType;
54  using PriorityQueueItemType = typename CriterionType::PriorityQueueWrapperType;
55 
56  itkSetObjectMacro(Criterion, CriterionType);
57 
58 protected:
60  {
61  this->m_Iteration = 0;
62  this->m_OutputMesh = nullptr;
63  }
64 
65  ~DecimationQuadEdgeMeshFilter() override = default;
66 
69 
70  void GenerateData() override
71  {
73 
74  Initialize();
76  m_Iteration = 0;
77  this->m_OutputMesh = this->GetOutput();
78  do
79  {
80  this->Extract();
81 
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 override
106  {
107  this->Superclass::PrintSelf(os, indent);
108  os << indent << "Criterion: " << m_Criterion << std::endl;
109  }
110 
113 
114 private:
115  DecimationQuadEdgeMeshFilter(const Self &) = delete;
116  void operator=(const Self &) = delete;
117 };
118 }
119 
120 #endif
Light weight base class for most itk classes.
virtual bool IsCriterionSatisfied()=0
unsigned long SizeValueType
Definition: itkIntTypes.h:83
void operator=(const Self &)=delete
virtual bool ProcessWithoutAnyTopologicalGuarantee()=0
typename CriterionType::PriorityQueueWrapperType PriorityQueueItemType
void PrintSelf(std::ostream &os, Indent indent) const override
typename CriterionType::MeasureType MeasureType
void PrintSelf(std::ostream &os, Indent indent) const override
typename CriterionType::PriorityType PriorityType
typename OutputMeshType::Pointer OutputMeshPointer
~DecimationQuadEdgeMeshFilter() override=default
typename CriterionType::Pointer CriterionPointer
virtual bool ProcessWithTopologicalGuarantee()=0
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename InputMeshType::Pointer InputMeshPointer
OutputMeshType * GetOutput()