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 
24 namespace itk
25 {
31 template <typename TInput, typename TOutput, typename TCriterion>
32 class ITK_TEMPLATE_EXPORT DecimationQuadEdgeMeshFilter : public QuadEdgeMeshToQuadEdgeMeshFilter<TInput, TOutput>
33 {
34 public:
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 
59 protected:
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
100  FillPriorityQueue() = 0;
101 
102  virtual void
103  Extract() = 0;
104 
105  virtual bool
106  ProcessWithoutAnyTopologicalGuarantee() = 0;
107 
108  virtual bool
109  ProcessWithTopologicalGuarantee() = 0;
110 
111  virtual bool
112  IsCriterionSatisfied() = 0;
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
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::DecimationQuadEdgeMeshFilter::MeasureType
typename CriterionType::MeasureType MeasureType
Definition: itkDecimationQuadEdgeMeshFilter.h:53
itk::DecimationQuadEdgeMeshFilter::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
Definition: itkDecimationQuadEdgeMeshFilter.h:115
itk::DecimationQuadEdgeMeshFilter::Initialize
virtual void Initialize()
Definition: itkDecimationQuadEdgeMeshFilter.h:97
itk::DecimationQuadEdgeMeshFilter::GenerateData
void GenerateData() override
Definition: itkDecimationQuadEdgeMeshFilter.h:72
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::DecimationQuadEdgeMeshFilter::CriterionType
TCriterion CriterionType
Definition: itkDecimationQuadEdgeMeshFilter.h:51
itkQuadEdgeMeshToQuadEdgeMeshFilter.h
itk::DecimationQuadEdgeMeshFilter::OutputMeshPointer
typename OutputMeshType::Pointer OutputMeshPointer
Definition: itkDecimationQuadEdgeMeshFilter.h:49
itk::DecimationQuadEdgeMeshFilter::InputMeshType
TInput InputMeshType
Definition: itkDecimationQuadEdgeMeshFilter.h:45
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::DecimationQuadEdgeMeshFilter
Definition: itkDecimationQuadEdgeMeshFilter.h:32
itk::DecimationQuadEdgeMeshFilter::PriorityQueueItemType
typename CriterionType::PriorityQueueWrapperType PriorityQueueItemType
Definition: itkDecimationQuadEdgeMeshFilter.h:55
itk::QuadEdgeMeshToQuadEdgeMeshFilter
Duplicates the content of a Mesh.
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:37
itk::DecimationQuadEdgeMeshFilter::InputMeshPointer
typename InputMeshType::Pointer InputMeshPointer
Definition: itkDecimationQuadEdgeMeshFilter.h:46
itkIntTypes.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::DecimationQuadEdgeMeshFilter::DecimationQuadEdgeMeshFilter
DecimationQuadEdgeMeshFilter()
Definition: itkDecimationQuadEdgeMeshFilter.h:60
itk::DecimationQuadEdgeMeshFilter::PriorityType
typename CriterionType::PriorityType PriorityType
Definition: itkDecimationQuadEdgeMeshFilter.h:54
itk::DecimationQuadEdgeMeshFilter::CriterionPointer
typename CriterionType::Pointer CriterionPointer
Definition: itkDecimationQuadEdgeMeshFilter.h:52
itk::DecimationQuadEdgeMeshFilter::OutputMeshType
TOutput OutputMeshType
Definition: itkDecimationQuadEdgeMeshFilter.h:48
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:86