ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkDiscreteGaussianCurvatureQuadEdgeMeshFilter.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 itkDiscreteGaussianCurvatureQuadEdgeMeshFilter_h
19#define itkDiscreteGaussianCurvatureQuadEdgeMeshFilter_h
20
22#include "itkMath.h"
23
24
25namespace itk
26{
37template <typename TInputMesh, typename TOutputMesh = TInputMesh>
39 : public DiscreteCurvatureQuadEdgeMeshFilter<TInputMesh, TOutputMesh>
40{
41public:
42 ITK_DISALLOW_COPY_AND_MOVE(DiscreteGaussianCurvatureQuadEdgeMeshFilter);
43
48
49 using typename Superclass::InputMeshType;
50 using typename Superclass::InputMeshPointer;
51
52 using typename Superclass::OutputMeshType;
53 using typename Superclass::OutputMeshPointer;
56 using typename Superclass::OutputPointType;
57 using typename Superclass::OutputVectorType;
58 using typename Superclass::OutputCoordType;
61 using typename Superclass::OutputQEType;
62 using typename Superclass::OutputMeshTraits;
64 using typename Superclass::TriangleType;
65
67 itkOverrideGetNameOfClassMacro(DiscreteGaussianCurvatureQuadEdgeMeshFilter);
68
70 itkNewMacro(Self);
71
73
74protected:
77
80 {
81 const OutputMeshPointer output = this->GetOutput();
82
83 OutputQEType * qe = iP.GetEdge();
84
85 if (qe != nullptr)
86 {
87 OutputQEType * qe_it = qe;
88
89 OutputCurvatureType sum_theta = 0.;
90 OutputCurvatureType area = 0.;
91
92 do
93 {
94 // cell_id = qe_it->GetLeft();
95 OutputQEType * qe_it2 = qe_it->GetOnext();
96 const OutputPointType q0 = output->GetPoint(qe_it->GetDestination());
97 const OutputPointType q1 = output->GetPoint(qe_it2->GetDestination());
98
99 // Compute Angle;
100 sum_theta += static_cast<OutputCurvatureType>(TriangleType::ComputeAngle(q0, iP, q1));
101 area += this->ComputeMixedArea(qe_it, qe_it2);
102 qe_it = qe_it2;
103 } while (qe_it != qe);
104
105 return (2.0 * itk::Math::pi - sum_theta) / area;
106 }
107
108 return 0.;
109 }
110};
111} // namespace itk
112
113#endif
OutputCurvatureType ComputeMixedArea(OutputQEType *iQE1, OutputQEType *iQE2)
OutputCurvatureType EstimateCurvature(const OutputPointType &iP) override
~DiscreteGaussianCurvatureQuadEdgeMeshFilter() override=default
DiscreteCurvatureQuadEdgeMeshFilter< TInputMesh, TOutputMesh > Superclass
OutputMeshType * GetOutput()
Implements transparent reference counting.
static CoordinateType ComputeAngle(const PointType &iP1, const PointType &iP2, const PointType &iP3)
#define itkConceptMacro(name, concept)
static constexpr double pi
Definition itkMath.h:66
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....