ITK  4.8.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 "vnl/vnl_math.h"
23 
24 
25 namespace itk
26 {
37 template< typename TInputMesh, typename TOutputMesh=TInputMesh >
39  public DiscreteCurvatureQuadEdgeMeshFilter< TInputMesh, TOutputMesh >
40 {
41 public:
46  TInputMesh, TOutputMesh > Superclass;
47 
50 
64 
67 
69  itkNewMacro(Self);
70 
71 #ifdef ITK_USE_CONCEPT_CHECKING
72  // Begin concept checking
73  itkConceptMacro( OutputIsFloatingPointCheck,
75  // End concept checking
76 #endif
77 
78 protected:
81 
82  virtual OutputCurvatureType EstimateCurvature(const OutputPointType & iP) ITK_OVERRIDE
83  {
84  OutputMeshPointer output = this->GetOutput();
85 
86  OutputQEType *qe = iP.GetEdge();
87 
88  if ( qe != ITK_NULLPTR )
89  {
90  OutputQEType *qe_it = qe;
91  OutputQEType *qe_it2;
92 
93  OutputPointType q0, q1;
94 
95  OutputCurvatureType sum_theta = 0.;
96  OutputCurvatureType area = 0.;
97 
98  do
99  {
100  // cell_id = qe_it->GetLeft();
101  qe_it2 = qe_it->GetOnext();
102  q0 = output->GetPoint( qe_it->GetDestination() );
103  q1 = output->GetPoint( qe_it2->GetDestination() );
104 
105  // Compute Angle;
106  sum_theta += static_cast< OutputCurvatureType >(
107  TriangleType::ComputeAngle(q0, iP, q1) );
108  area += this->ComputeMixedArea(qe_it, qe_it2);
109  qe_it = qe_it2;
110  }
111  while ( qe_it != qe );
112 
113  return ( 2.0 * vnl_math::pi - sum_theta ) / area;
114  }
115 
116  return 0.;
117  }
118 
119 private:
120  DiscreteGaussianCurvatureQuadEdgeMeshFilter(const Self &); // purposely not
121  // implemented
122  void operator=(const Self &); // purposely not
123  // implemented
124 };
125 }
126 
127 #endif
DiscreteCurvatureQuadEdgeMeshFilter< TInputMesh, TOutputMesh > Superclass
Light weight base class for most itk classes.
OutputCurvatureType ComputeMixedArea(OutputQEType *iQE1, OutputQEType *iQE2)
static const double pi
Definition: itkMath.h:55
see the following paper title: Discrete Differential-Geometry Operators for Triangulated 2-Manifolds ...
OutputMeshType::PointsContainerIterator OutputPointsContainerIterator
virtual OutputCurvatureType EstimateCurvature(const OutputPointType &iP) override
OutputMeshType::Pointer OutputMeshPointer
Definition: itkMeshSource.h:67
OutputMeshType::PointsContainerPointer OutputPointsContainerPointer
OutputMeshType * GetOutput()
#define itkConceptMacro(name, concept)