ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkDiscreteMeanCurvatureQuadEdgeMeshFilter.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 itkDiscreteMeanCurvatureQuadEdgeMeshFilter_h
19 #define itkDiscreteMeanCurvatureQuadEdgeMeshFilter_h
20 
23 
24 namespace itk
25 {
35 template< typename TInputMesh, typename TOutputMesh=TInputMesh >
37  public DiscreteCurvatureQuadEdgeMeshFilter< TInputMesh, TOutputMesh >
38 {
39 public:
44 
47 
60 
62 
65 
67  itkNewMacro(Self);
68 
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  OutputCurvatureType oH(0.);
89 
90  OutputVectorType Laplace;
91 
92  Laplace.Fill(0.);
93 
94  OutputCurvatureType area(0.);
95  OutputVectorType normal;
96  normal.Fill(0.);
97 
98  if ( qe != ITK_NULLPTR )
99  {
100  if ( qe != qe->GetOnext() )
101  {
102  CoefficientType coefficent;
103 
104  OutputQEType *qe_it = qe;
105  OutputQEType *qe_it2;
106 
107  OutputCurvatureType temp_area;
108  OutputCoordType temp_coeff;
109 
110  OutputPointType q0, q1;
111  OutputVectorType face_normal;
112 
113  do
114  {
115  qe_it2 = qe_it->GetOnext();
116  q0 = output->GetPoint( qe_it->GetDestination() );
117  q1 = output->GetPoint( qe_it2->GetDestination() );
118 
119  temp_coeff = coefficent(output, qe_it);
120  Laplace += temp_coeff * ( iP - q0 );
121 
122  temp_area = this->ComputeMixedArea(qe_it, qe_it2);
123  area += temp_area;
124 
125  face_normal = TriangleType::ComputeNormal(q0, iP, q1);
126  normal += face_normal;
127 
128  qe_it = qe_it2;
129  }
130  while ( qe_it != qe );
131 
132  if ( area < 1e-6 )
133  {
134  oH = 0.;
135  }
136  else
137  {
138  if ( normal.GetSquaredNorm() > 0. )
139  {
140  normal.Normalize();
141  Laplace *= 0.25 / area;
142  oH = Laplace * normal;
143  }
144  else
145  {
146  oH = 0.;
147  }
148  }
149  }
150  }
151  return oH;
152  }
153 
154 private:
155  DiscreteMeanCurvatureQuadEdgeMeshFilter(const Self &); // purposely not
156  // implemented
157  void operator=(const Self &); // purposely not
158  // implemented
159 };
160 }
161 #endif
virtual OutputCurvatureType EstimateCurvature(const OutputPointType &iP) override
Light weight base class for most itk classes.
OutputCurvatureType ComputeMixedArea(OutputQEType *iQE1, OutputQEType *iQE2)
Compute a matrix filed by Conformal Coefficients of the edge wherever two vertices are connected by a...
Superclass::OutputPointsContainerIterator OutputPointsContainerIterator
static const double e
The base of the natural logarithm or Euler&#39;s number
Definition: itkMath.h:45
OutputMeshType::PointsContainerIterator OutputPointsContainerIterator
DiscreteCurvatureQuadEdgeMeshFilter< TInputMesh, TOutputMesh > Superclass
Superclass::OutputPointsContainerPointer OutputPointsContainerPointer
ConformalMatrixCoefficients< OutputMeshType > CoefficientType
see the following paper title: Discrete Differential-Geometry Operators for Triangulated 2-Manifolds ...
OutputMeshType::Pointer OutputMeshPointer
Definition: itkMeshSource.h:67
OutputMeshType::PointsContainerPointer OutputPointsContainerPointer
OutputMeshType * GetOutput()
#define itkConceptMacro(name, concept)