ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter.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 itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter_h
19 #define itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter_h
20 
23 
24 namespace itk
25 {
33 template< typename TInputMesh, typename TOutputMesh=TInputMesh >
35  public DiscreteCurvatureQuadEdgeMeshFilter< TInputMesh, TOutputMesh >
36 {
37 public:
42  TInputMesh, TOutputMesh > Superclass;
43 
58 
60 
63 
65 
66 #ifdef ITK_USE_CONCEPT_CHECKING
67  // Begin concept checking
68  itkConceptMacro( OutputIsFloatingPointCheck,
70  // End concept checking
71 #endif
72 
73 protected:
75  m_Gaussian(0.0), m_Mean(0.0){}
77 
80 
82  {
83  OutputMeshPointer output = this->GetOutput();
84 
85  OutputQEType *qe = iP.GetEdge();
86 
87  m_Mean = 0.;
88  m_Gaussian = 0.;
89 
90  if ( qe != ITK_NULLPTR )
91  {
92  OutputVectorType Laplace;
93  Laplace.Fill(0.);
94 
95  OutputQEType *qe_it = qe;
96 
97  OutputCurvatureType area(0.), sum_theta(0.);
98 
99  if ( qe_it != qe_it->GetOnext() )
100  {
101  qe_it = qe;
102  OutputQEType *qe_it2;
103 
104  OutputPointType q0, q1;
105  OutputVectorType face_normal;
106 
107  OutputVectorType normal;
108  normal.Fill(0.);
109 
110  OutputCurvatureType temp_area;
111  OutputCoordType temp_coeff;
112 
113  CoefficientType coefficent;
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  // Compute Angle;
125  sum_theta += static_cast< OutputCurvatureType >(
126  TriangleType::ComputeAngle(q0, iP, q1) );
127 
128  temp_area = this->ComputeMixedArea(qe_it, qe_it2);
129  area += temp_area;
130 
131  face_normal = TriangleType::ComputeNormal(q0, iP, q1);
132  normal += face_normal;
133 
134  qe_it = qe_it2;
135  }
136  while ( qe_it != qe );
137 
138  if ( area > 1e-10 )
139  {
140  area = 1. / area;
141  Laplace *= 0.25 * area;
142  m_Mean = Laplace * normal;
143  m_Gaussian = ( 2. * itk::Math::pi - sum_theta ) * area;
144  }
145  }
146  }
147  }
148 
150  {
151  return std::max( static_cast<OutputCurvatureType>( 0. ),
152  m_Mean * m_Mean - m_Gaussian );
153  }
154 
155 private:
157  // not
158  // implemented
159  void operator=(const Self &); // purposely
160  // not
161  // implemented
162 };
163 }
164 
165 #endif
DiscreteCurvatureQuadEdgeMeshFilter< TInputMesh, TOutputMesh > Superclass
OutputCurvatureType ComputeMixedArea(OutputQEType *iQE1, OutputQEType *iQE2)
static ITK_CONSTEXPR_VAR double pi
Definition: itkMath.h:66
Compute a matrix filed by Conformal Coefficients of the edge wherever two vertices are connected by a...
OutputMeshType::PointsContainerIterator OutputPointsContainerIterator
OutputMeshType::Pointer OutputMeshPointer
Definition: itkMeshSource.h:67
OutputMeshType::PointsContainerPointer OutputPointsContainerPointer
OutputMeshType * GetOutput()
static ITK_CONSTEXPR_VAR double e
The base of the natural logarithm or Euler&#39;s number
Definition: itkMath.h:56
#define itkConceptMacro(name, concept)