ITK  5.3.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  * http://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 
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  Laplace.Fill(0.);
95 
96  OutputCurvatureType area(0.);
97  OutputVectorType normal;
98  normal.Fill(0.);
99 
100  if (qe != nullptr)
101  {
102  if (qe != qe->GetOnext())
103  {
104  CoefficientType coefficent;
105 
106  OutputQEType * qe_it = qe;
107  OutputQEType * qe_it2;
108 
109  OutputCurvatureType temp_area;
110  OutputCoordType temp_coeff;
111 
112  OutputPointType q0, q1;
113  OutputVectorType face_normal;
114 
115  do
116  {
117  qe_it2 = qe_it->GetOnext();
118  q0 = output->GetPoint(qe_it->GetDestination());
119  q1 = output->GetPoint(qe_it2->GetDestination());
120 
121  temp_coeff = coefficent(output, qe_it);
122  Laplace += temp_coeff * (iP - q0);
123 
124  temp_area = this->ComputeMixedArea(qe_it, qe_it2);
125  area += temp_area;
126 
127  face_normal = TriangleType::ComputeNormal(q0, iP, q1);
128  normal += face_normal;
129 
130  qe_it = qe_it2;
131  } while (qe_it != qe);
132 
133  if (area < 1e-6)
134  {
135  oH = 0.;
136  }
137  else
138  {
139  if (normal.GetSquaredNorm() > 0.)
140  {
141  normal.Normalize();
142  Laplace *= 0.25 / area;
143  oH = Laplace * normal;
144  }
145  else
146  {
147  oH = 0.;
148  }
149  }
150  }
151  }
152  return oH;
153  }
154 };
155 } // namespace itk
156 #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:59
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:946
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: itkAnnulusOperator.h:24
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputQEType
typename OutputMeshType::QEType OutputQEType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:57
itk::Math::e
static constexpr double e
Definition: itkMath.h:54
itk::QuadEdgeMeshToQuadEdgeMeshFilter::OutputPointType
typename OutputMeshType::PointType OutputPointType
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:80