ITK  5.4.0
Insight Toolkit
itkDiscreteGaussianCurvatureQuadEdgeMeshFilter.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 itkDiscreteGaussianCurvatureQuadEdgeMeshFilter_h
19 #define itkDiscreteGaussianCurvatureQuadEdgeMeshFilter_h
20 
22 #include "itkMath.h"
23 
24 
25 namespace itk
26 {
37 template <typename TInputMesh, typename TOutputMesh = TInputMesh>
39  : public DiscreteCurvatureQuadEdgeMeshFilter<TInputMesh, TOutputMesh>
40 {
41 public:
42  ITK_DISALLOW_COPY_AND_MOVE(DiscreteGaussianCurvatureQuadEdgeMeshFilter);
43 
48 
49  using typename Superclass::InputMeshType;
50  using typename Superclass::InputMeshPointer;
51 
52  using typename Superclass::OutputMeshType;
53  using typename Superclass::OutputMeshPointer;
54  using typename Superclass::OutputPointsContainerPointer;
55  using typename Superclass::OutputPointsContainerIterator;
56  using typename Superclass::OutputPointType;
57  using typename Superclass::OutputVectorType;
58  using typename Superclass::OutputCoordType;
59  using typename Superclass::OutputPointIdentifier;
60  using typename Superclass::OutputCellIdentifier;
61  using typename Superclass::OutputQEType;
62  using typename Superclass::OutputMeshTraits;
63  using typename Superclass::OutputCurvatureType;
64  using typename Superclass::TriangleType;
65 
67  itkOverrideGetNameOfClassMacro(DiscreteGaussianCurvatureQuadEdgeMeshFilter);
68 
70  itkNewMacro(Self);
71 
72 #ifdef ITK_USE_CONCEPT_CHECKING
73  // Begin concept checking
75  // End concept checking
76 #endif
77 
78 protected:
80  ~DiscreteGaussianCurvatureQuadEdgeMeshFilter() override = default;
81 
83  EstimateCurvature(const OutputPointType & iP) override
84  {
85  OutputMeshPointer output = this->GetOutput();
86 
87  OutputQEType * qe = iP.GetEdge();
88 
89  if (qe != nullptr)
90  {
91  OutputQEType * qe_it = qe;
92  OutputQEType * qe_it2;
93 
94  OutputPointType q0, q1;
95 
96  OutputCurvatureType sum_theta = 0.;
97  OutputCurvatureType area = 0.;
98 
99  do
100  {
101  // cell_id = qe_it->GetLeft();
102  qe_it2 = qe_it->GetOnext();
103  q0 = output->GetPoint(qe_it->GetDestination());
104  q1 = output->GetPoint(qe_it2->GetDestination());
105 
106  // Compute Angle;
107  sum_theta += static_cast<OutputCurvatureType>(TriangleType::ComputeAngle(q0, iP, q1));
108  area += this->ComputeMixedArea(qe_it, qe_it2);
109  qe_it = qe_it2;
110  } while (qe_it != qe);
111 
112  return (2.0 * itk::Math::pi - sum_theta) / area;
113  }
114 
115  return 0.;
116  }
117 };
118 } // namespace itk
119 
120 #endif
itk::MeshSource::OutputMeshPointer
typename OutputMeshType::Pointer OutputMeshPointer
Definition: itkMeshSource.h:69
itkDiscreteCurvatureQuadEdgeMeshFilter.h
itk::SmartPointer< Self >
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputCurvatureType
typename OutputMeshTraits::PixelType OutputCurvatureType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:59
itk::Concept::IsFloatingPoint
Definition: itkConceptChecking.h:946
itk::DiscreteGaussianCurvatureQuadEdgeMeshFilter
see the following paper title: Discrete Differential-Geometry Operators for Triangulated 2-Manifolds ...
Definition: itkDiscreteGaussianCurvatureQuadEdgeMeshFilter.h:38
itk::DiscreteGaussianCurvatureQuadEdgeMeshFilter::EstimateCurvature
OutputCurvatureType EstimateCurvature(const OutputPointType &iP) override
Definition: itkDiscreteGaussianCurvatureQuadEdgeMeshFilter.h:83
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::pi
static constexpr double pi
Definition: itkMath.h:66
itk::QuadEdgeMeshToQuadEdgeMeshFilter::OutputPointType
typename OutputMeshType::PointType OutputPointType
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:80
itkMath.h