ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter.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 itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter_h
19#define itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter_h
20
23
24namespace itk
25{
33template <typename TInputMesh, typename TOutputMesh = TInputMesh>
35 : public DiscreteCurvatureQuadEdgeMeshFilter<TInputMesh, TOutputMesh>
36{
37public:
38 ITK_DISALLOW_COPY_AND_MOVE(DiscretePrincipalCurvaturesQuadEdgeMeshFilter);
39
44
45 using typename Superclass::InputMeshType;
46 using typename Superclass::InputMeshPointer;
47 using typename Superclass::OutputMeshType;
48 using typename Superclass::OutputMeshPointer;
51 using typename Superclass::OutputPointType;
52 using typename Superclass::OutputVectorType;
53 using typename Superclass::OutputCoordType;
56 using typename Superclass::OutputQEType;
57 using typename Superclass::OutputMeshTraits;
59
60 using typename Superclass::TriangleType;
61
63 itkOverrideGetNameOfClassMacro(DiscretePrincipalCurvaturesQuadEdgeMeshFilter);
64
66
68
69protected:
75
78
79 void
81 {
82 const OutputMeshPointer output = this->GetOutput();
83
84 OutputQEType * qe = iP.GetEdge();
85
86 m_Mean = 0.;
87 m_Gaussian = 0.;
88
89 if (qe != nullptr)
90 {
91 OutputVectorType Laplace{};
92
93 OutputQEType * qe_it = qe;
94
95 OutputCurvatureType area(0.);
96 OutputCurvatureType sum_theta(0.);
97
98 if (qe_it != qe_it->GetOnext())
99 {
100 qe_it = qe;
101
102 OutputVectorType normal{};
103 const CoefficientType coefficent;
104 do
105 {
106 OutputQEType * qe_it2 = qe_it->GetOnext();
107 const OutputPointType q0 = output->GetPoint(qe_it->GetDestination());
108 const OutputPointType q1 = output->GetPoint(qe_it2->GetDestination());
109
110 const OutputCoordType temp_coeff = coefficent(output, qe_it);
111 Laplace += temp_coeff * (iP - q0);
112
113 // Compute Angle;
114 sum_theta += static_cast<OutputCurvatureType>(TriangleType::ComputeAngle(q0, iP, q1));
115
116 const OutputCurvatureType temp_area = this->ComputeMixedArea(qe_it, qe_it2);
117 area += temp_area;
118
119 const OutputVectorType face_normal = TriangleType::ComputeNormal(q0, iP, q1);
120 normal += face_normal;
121
122 qe_it = qe_it2;
123 } while (qe_it != qe);
124
125 if (area > 1e-10)
126 {
127 area = 1. / area;
128 Laplace *= 0.25 * area;
129 m_Mean = Laplace * normal;
130 m_Gaussian = (2. * itk::Math::pi - sum_theta) * area;
131 }
132 }
133 }
134 }
135
136 virtual OutputCurvatureType
138 {
139 return std::max(static_cast<OutputCurvatureType>(0.), m_Mean * m_Mean - m_Gaussian);
140 }
141};
142} // namespace itk
143
144#endif
Compute a matrix filed by Conformal Coefficients of the edge wherever two vertices are connected by a...
OutputCurvatureType ComputeMixedArea(OutputQEType *iQE1, OutputQEType *iQE2)
OutputMeshType * GetOutput()
Implements transparent reference counting.
static VectorType ComputeNormal(const PointType &iA, const PointType &iB, const PointType &iC)
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....