ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkDiscreteGaussianCurvatureQuadEdgeMeshFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 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_ASSIGN(DiscreteGaussianCurvatureQuadEdgeMeshFilter);
43 
48  TInputMesh, TOutputMesh >;
49 
52 
66 
69 
71  itkNewMacro(Self);
72 
73 #ifdef ITK_USE_CONCEPT_CHECKING
74  // Begin concept checking
75  itkConceptMacro( OutputIsFloatingPointCheck,
77  // End concept checking
78 #endif
79 
80 protected:
83 
85  {
86  OutputMeshPointer output = this->GetOutput();
87 
88  OutputQEType *qe = iP.GetEdge();
89 
90  if ( qe != nullptr )
91  {
92  OutputQEType *qe_it = qe;
93  OutputQEType *qe_it2;
94 
95  OutputPointType q0, q1;
96 
97  OutputCurvatureType sum_theta = 0.;
98  OutputCurvatureType area = 0.;
99 
100  do
101  {
102  // cell_id = qe_it->GetLeft();
103  qe_it2 = qe_it->GetOnext();
104  q0 = output->GetPoint( qe_it->GetDestination() );
105  q1 = output->GetPoint( qe_it2->GetDestination() );
106 
107  // Compute Angle;
108  sum_theta += static_cast< OutputCurvatureType >(
109  TriangleType::ComputeAngle(q0, iP, q1) );
110  area += this->ComputeMixedArea(qe_it, qe_it2);
111  qe_it = qe_it2;
112  }
113  while ( qe_it != qe );
114 
115  return ( 2.0 * itk::Math::pi - sum_theta ) / area;
116  }
117 
118  return 0.;
119  }
120 };
121 }
122 
123 #endif
typename OutputMeshType::PointsContainerIterator OutputPointsContainerIterator
Light weight base class for most itk classes.
TOutputMesh OutputMeshType
Definition: itkMeshSource.h:68
typename OutputMeshType::PointsContainerIterator OutputPointsContainerIterator
OutputCurvatureType ComputeMixedArea(OutputQEType *iQE1, OutputQEType *iQE2)
OutputCurvatureType EstimateCurvature(const OutputPointType &iP) override
static constexpr double pi
Definition: itkMath.h:63
see the following paper title: Discrete Differential-Geometry Operators for Triangulated 2-Manifolds ...
typename OutputMeshType::CellIdentifier OutputCellIdentifier
typename OutputMeshType::PointIdentifier OutputPointIdentifier
typename InputMeshType::Pointer InputMeshPointer
A convenience class for computation of various triangle elements in 2D or 3D.
typename OutputMeshType::PointsContainerPointer OutputPointsContainerPointer
typename OutputMeshType::PointIdentifier OutputPointIdentifier
typename OutputMeshType::Pointer OutputMeshPointer
Definition: itkMeshSource.h:69
~DiscreteGaussianCurvatureQuadEdgeMeshFilter() override=default
typename OutputMeshType::VectorType OutputVectorType
typename OutputMeshType::PointsContainerPointer OutputPointsContainerPointer
OutputMeshType * GetOutput()
#define itkConceptMacro(name, concept)