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  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  CoefficientType coefficent;
102 
103  OutputQEType * qe_it = qe;
104  OutputQEType * qe_it2;
105 
106  OutputCurvatureType temp_area;
107  OutputCoordType temp_coeff;
108 
109  OutputPointType q0, q1;
110  OutputVectorType face_normal;
111 
112  do
113  {
114  qe_it2 = qe_it->GetOnext();
115  q0 = output->GetPoint(qe_it->GetDestination());
116  q1 = output->GetPoint(qe_it2->GetDestination());
117 
118  temp_coeff = coefficent(output, qe_it);
119  Laplace += temp_coeff * (iP - q0);
120 
121  temp_area = this->ComputeMixedArea(qe_it, qe_it2);
122  area += temp_area;
123 
124  face_normal = TriangleType::ComputeNormal(q0, iP, q1);
125  normal += face_normal;
126 
127  qe_it = qe_it2;
128  } while (qe_it != qe);
129 
130  if (area < 1e-6)
131  {
132  oH = 0.;
133  }
134  else
135  {
136  if (normal.GetSquaredNorm() > 0.)
137  {
138  normal.Normalize();
139  Laplace *= 0.25 / area;
140  oH = Laplace * normal;
141  }
142  else
143  {
144  oH = 0.;
145  }
146  }
147  }
148  }
149  return oH;
150  }
151 };
152 } // namespace itk
153 #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:127
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputCurvatureType
typename OutputMeshTraits::PixelType OutputCurvatureType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:59
itk::QuadEdgeMeshToQuadEdgeMeshFilter::OutputVectorType
typename OutputMeshType::VectorType OutputVectorType
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:83
itkQuadEdgeMeshParamMatrixCoefficients.h
itk::Concept::IsFloatingPoint
Definition: itkConceptChecking.h:948
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputCoordType
typename OutputPointType::CoordRepType OutputCoordType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:54
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:80