ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkDiscreteMeanCurvatureQuadEdgeMeshFilter.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 itkDiscreteMeanCurvatureQuadEdgeMeshFilter_h
19#define itkDiscreteMeanCurvatureQuadEdgeMeshFilter_h
20
23
24namespace itk
25{
35template <typename TInputMesh, typename TOutputMesh = TInputMesh>
37 : public DiscreteCurvatureQuadEdgeMeshFilter<TInputMesh, TOutputMesh>
38{
39public:
40 ITK_DISALLOW_COPY_AND_MOVE(DiscreteMeanCurvatureQuadEdgeMeshFilter);
41
46
47 using typename Superclass::InputMeshType;
48 using typename Superclass::InputMeshPointer;
49
50 using typename Superclass::OutputMeshType;
51 using typename Superclass::OutputMeshPointer;
54 using typename Superclass::OutputPointType;
55 using typename Superclass::OutputVectorType;
56 using typename Superclass::OutputCoordType;
59 using typename Superclass::OutputQEType;
60 using typename Superclass::OutputMeshTraits;
62
63 using typename Superclass::TriangleType;
64
66 itkOverrideGetNameOfClassMacro(DiscreteMeanCurvatureQuadEdgeMeshFilter);
67
69 itkNewMacro(Self);
70
72
74
75protected:
78
81 {
82 const OutputMeshPointer output = this->GetOutput();
83
84 OutputQEType * qe = iP.GetEdge();
85
87
88 OutputVectorType Laplace{};
89
90 OutputCurvatureType area(0.);
91 OutputVectorType normal{};
92
93 if (qe != nullptr)
94 {
95 if (qe != qe->GetOnext())
96 {
97 const CoefficientType coefficent;
98
99 OutputQEType * qe_it = qe;
100
101 do
102 {
103 OutputQEType * qe_it2 = qe_it->GetOnext();
104 const OutputPointType q0 = output->GetPoint(qe_it->GetDestination());
105 const OutputPointType q1 = output->GetPoint(qe_it2->GetDestination());
106
107 const OutputCoordType temp_coeff = coefficent(output, qe_it);
108 Laplace += temp_coeff * (iP - q0);
109
110 const OutputCurvatureType temp_area = this->ComputeMixedArea(qe_it, qe_it2);
111 area += temp_area;
112
113 const OutputVectorType face_normal = TriangleType::ComputeNormal(q0, iP, q1);
114 normal += face_normal;
115
116 qe_it = qe_it2;
117 } while (qe_it != qe);
118
119 if (area < 1e-6)
120 {
121 oH = 0.;
122 }
123 else
124 {
125 if (normal.GetSquaredNorm() > 0.)
126 {
127 normal.Normalize();
128 Laplace *= 0.25 / area;
129 oH = Laplace * normal;
130 }
131 else
132 {
133 oH = 0.;
134 }
135 }
136 }
137 }
138 return oH;
139 }
140};
141} // namespace itk
142#endif
Compute a matrix filed by Conformal Coefficients of the edge wherever two vertices are connected by a...
OutputCurvatureType ComputeMixedArea(OutputQEType *iQE1, OutputQEType *iQE2)
DiscreteCurvatureQuadEdgeMeshFilter< TInputMesh, TOutputMesh > Superclass
~DiscreteMeanCurvatureQuadEdgeMeshFilter() override=default
ConformalMatrixCoefficients< OutputMeshType > CoefficientType
OutputCurvatureType EstimateCurvature(const OutputPointType &iP) override
OutputMeshType * GetOutput()
Implements transparent reference counting.
static VectorType ComputeNormal(const PointType &iA, const PointType &iB, const PointType &iC)
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....