ITK  6.0.0
Insight Toolkit
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 
24 namespace itk
25 {
35 template <typename TInputMesh, typename TOutputMesh = TInputMesh>
36 class ITK_TEMPLATE_EXPORT DiscreteMeanCurvatureQuadEdgeMeshFilter
37  : public DiscreteCurvatureQuadEdgeMeshFilter<TInputMesh, TOutputMesh>
38 {
39 public:
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;
52  using typename Superclass::OutputPointsContainerPointer;
53  using typename Superclass::OutputPointsContainerIterator;
54  using typename Superclass::OutputPointType;
55  using typename Superclass::OutputVectorType;
56  using typename Superclass::OutputCoordType;
57  using typename Superclass::OutputPointIdentifier;
58  using typename Superclass::OutputCellIdentifier;
59  using typename Superclass::OutputQEType;
60  using typename Superclass::OutputMeshTraits;
61  using typename Superclass::OutputCurvatureType;
62 
63  using typename Superclass::TriangleType;
64 
66  itkOverrideGetNameOfClassMacro(DiscreteMeanCurvatureQuadEdgeMeshFilter);
67 
69  itkNewMacro(Self);
70 
72 
73 #ifdef ITK_USE_CONCEPT_CHECKING
74  // Begin concept checking
76  // End concept checking
77 #endif
78 
79 protected:
81  ~DiscreteMeanCurvatureQuadEdgeMeshFilter() override = default;
82 
84  EstimateCurvature(const OutputPointType & iP) override
85  {
86  const OutputMeshPointer output = this->GetOutput();
87 
88  OutputQEType * qe = iP.GetEdge();
89 
90  OutputCurvatureType oH(0.);
91 
92  OutputVectorType Laplace{};
93 
94  OutputCurvatureType area(0.);
95  OutputVectorType normal{};
96 
97  if (qe != nullptr)
98  {
99  if (qe != qe->GetOnext())
100  {
101  const CoefficientType coefficent;
102 
103  OutputQEType * qe_it = qe;
104 
105  do
106  {
107  OutputQEType * qe_it2 = qe_it->GetOnext();
108  const OutputPointType q0 = output->GetPoint(qe_it->GetDestination());
109  const OutputPointType q1 = output->GetPoint(qe_it2->GetDestination());
110 
111  const OutputCoordType temp_coeff = coefficent(output, qe_it);
112  Laplace += temp_coeff * (iP - q0);
113 
114  const OutputCurvatureType temp_area = this->ComputeMixedArea(qe_it, qe_it2);
115  area += temp_area;
116 
117  const OutputVectorType face_normal = TriangleType::ComputeNormal(q0, iP, q1);
118  normal += face_normal;
119 
120  qe_it = qe_it2;
121  } while (qe_it != qe);
122 
123  if (area < 1e-6)
124  {
125  oH = 0.;
126  }
127  else
128  {
129  if (normal.GetSquaredNorm() > 0.)
130  {
131  normal.Normalize();
132  Laplace *= 0.25 / area;
133  oH = Laplace * normal;
134  }
135  else
136  {
137  oH = 0.;
138  }
139  }
140  }
141  }
142  return oH;
143  }
144 };
145 } // namespace itk
146 #endif
itk::DiscreteMeanCurvatureQuadEdgeMeshFilter
see the following paper title: Discrete Differential-Geometry Operators for Triangulated 2-Manifolds ...
Definition: itkDiscreteMeanCurvatureQuadEdgeMeshFilter.h:36
itk::MeshSource::OutputMeshPointer
typename OutputMeshType::Pointer OutputMeshPointer
Definition: itkMeshSource.h:69
itkDiscreteCurvatureQuadEdgeMeshFilter.h
itk::SmartPointer< Self >
itk::DiscreteMeanCurvatureQuadEdgeMeshFilter::EstimateCurvature
OutputCurvatureType EstimateCurvature(const OutputPointType &iP) override
Definition: itkDiscreteMeanCurvatureQuadEdgeMeshFilter.h:84
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::ConformalMatrixCoefficients
Compute a matrix filed by Conformal Coefficients of the edge wherever two vertices are connected by a...
Definition: itkQuadEdgeMeshParamMatrixCoefficients.h:139
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputCurvatureType
typename OutputMeshTraits::PixelType OutputCurvatureType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:59
itk::QuadEdgeMeshToQuadEdgeMeshFilter::OutputVectorType
typename OutputMeshType::VectorType OutputVectorType
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:91
itkQuadEdgeMeshParamMatrixCoefficients.h
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputCoordType
typename OutputPointType::CoordinateType OutputCoordType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:54
itk::Concept::IsFloatingPoint
Definition: itkConceptChecking.h:953
itk::DiscreteCurvatureQuadEdgeMeshFilter
FIXME.
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:35
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputQEType
typename OutputMeshType::QEType OutputQEType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:57
itk::Math::e
static constexpr double e
Definition: itkMath.h:56
itk::QuadEdgeMeshToQuadEdgeMeshFilter::OutputPointType
typename OutputMeshType::PointType OutputPointType
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:88