ITK  5.3.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  * 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>
32 class ITK_TEMPLATE_EXPORT DecimationQuadEdgeMeshFilter : public QuadEdgeMeshToQuadEdgeMeshFilter<TInput, TOutput>
33 {
34 public:
35  ITK_DISALLOW_COPY_AND_MOVE(DecimationQuadEdgeMeshFilter);
36 
41 
44 
45  using InputMeshType = TInput;
46  using InputMeshPointer = typename InputMeshType::Pointer;
47 
48  using OutputMeshType = TOutput;
49  using OutputMeshPointer = typename OutputMeshType::Pointer;
50 
51  using CriterionType = TCriterion;
52  using CriterionPointer = typename CriterionType::Pointer;
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 
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 
123 };
124 } // namespace itk
125 
126 #endif
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::m_Iteration
SizeValueType m_Iteration
Definition: itkDecimationQuadEdgeMeshFilter.h:69
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::m_Criterion
CriterionPointer m_Criterion
Definition: itkDecimationQuadEdgeMeshFilter.h:68
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:59
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: itkAnnulusOperator.h:24
itk::DecimationQuadEdgeMeshFilter::m_OutputMesh
OutputMeshType * m_OutputMesh
Definition: itkDecimationQuadEdgeMeshFilter.h:122
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:83