ITK  6.0.0
Insight Toolkit
itkDecimationQuadEdgeMeshFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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
24namespace itk
25{
31template <typename TInput, typename TOutput, typename TCriterion>
32class ITK_TEMPLATE_EXPORT DecimationQuadEdgeMeshFilter : public QuadEdgeMeshToQuadEdgeMeshFilter<TInput, TOutput>
33{
34public:
35 ITK_DISALLOW_COPY_AND_MOVE(DecimationQuadEdgeMeshFilter);
36
41
43 itkOverrideGetNameOfClassMacro(DecimationQuadEdgeMeshFilter);
44
45 using InputMeshType = TInput;
47
48 using OutputMeshType = TOutput;
50
51 using CriterionType = TCriterion;
53 using MeasureType = typename CriterionType::MeasureType;
54 using PriorityType = typename CriterionType::PriorityType;
55 using PriorityQueueItemType = typename CriterionType::PriorityQueueWrapperType;
56
57 itkSetObjectMacro(Criterion, CriterionType);
58
59protected:
61 {
62 this->m_Iteration = 0;
63 this->m_OutputMesh = nullptr;
64 }
65
66 ~DecimationQuadEdgeMeshFilter() override = default;
67
68 CriterionPointer m_Criterion{};
69 SizeValueType m_Iteration{};
70
71 void
72 GenerateData() override
73 {
74 this->CopyInputMeshToOutputMesh();
75
76 Initialize();
77 FillPriorityQueue();
78 m_Iteration = 0;
79 this->m_OutputMesh = this->GetOutput();
80 do
81 {
82 this->Extract();
83
84 if (ProcessWithTopologicalGuarantee())
85 {
86 return;
87 }
88
89 ++m_Iteration;
90 } while (!IsCriterionSatisfied());
91
92 this->GetOutput()->SqueezePointsIds();
93 this->GetOutput()->DeleteUnusedCellData();
94 }
95
96 virtual void
98 {}
99 virtual void
101
102 virtual void
103 Extract() = 0;
104
105 virtual bool
107
108 virtual bool
110
111 virtual bool
113
114 void
115 PrintSelf(std::ostream & os, Indent indent) const override
116 {
117 this->Superclass::PrintSelf(os, indent);
118 os << indent << "Criterion: " << m_Criterion << std::endl;
119 }
120
122 OutputMeshType * m_OutputMesh{};
123};
124} // namespace itk
125
126#endif
virtual bool ProcessWithTopologicalGuarantee()=0
typename CriterionType::Pointer CriterionPointer
typename CriterionType::PriorityQueueWrapperType PriorityQueueItemType
void PrintSelf(std::ostream &os, Indent indent) const override
virtual bool IsCriterionSatisfied()=0
virtual bool ProcessWithoutAnyTopologicalGuarantee()=0
~DecimationQuadEdgeMeshFilter() override=default
typename InputMeshType::Pointer InputMeshPointer
typename CriterionType::PriorityType PriorityType
typename CriterionType::MeasureType MeasureType
typename OutputMeshType::Pointer OutputMeshPointer
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:86