ITK  5.0.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:
40  ITK_DISALLOW_COPY_AND_ASSIGN(DiscreteMeanCurvatureQuadEdgeMeshFilter);
41 
46 
49 
62 
64 
67 
69  itkNewMacro(Self);
70 
72 
73 #ifdef ITK_USE_CONCEPT_CHECKING
74  // Begin concept checking
75  itkConceptMacro( OutputIsFloatingPointCheck,
77  // End concept checking
78 #endif
79 
80 protected:
82  ~DiscreteMeanCurvatureQuadEdgeMeshFilter() override = default;
83 
85  {
86  OutputMeshPointer output = this->GetOutput();
87 
88  OutputQEType *qe = iP.GetEdge();
89 
90  OutputCurvatureType oH(0.);
91 
92  OutputVectorType Laplace;
93 
94  Laplace.Fill(0.);
95 
96  OutputCurvatureType area(0.);
97  OutputVectorType normal;
98  normal.Fill(0.);
99 
100  if ( qe != nullptr )
101  {
102  if ( qe != qe->GetOnext() )
103  {
104  CoefficientType coefficent;
105 
106  OutputQEType *qe_it = qe;
107  OutputQEType *qe_it2;
108 
109  OutputCurvatureType temp_area;
110  OutputCoordType temp_coeff;
111 
112  OutputPointType q0, q1;
113  OutputVectorType face_normal;
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  temp_area = this->ComputeMixedArea(qe_it, qe_it2);
125  area += temp_area;
126 
127  face_normal = TriangleType::ComputeNormal(q0, iP, q1);
128  normal += face_normal;
129 
130  qe_it = qe_it2;
131  }
132  while ( qe_it != qe );
133 
134  if ( area < 1e-6 )
135  {
136  oH = 0.;
137  }
138  else
139  {
140  if ( normal.GetSquaredNorm() > 0. )
141  {
142  normal.Normalize();
143  Laplace *= 0.25 / area;
144  oH = Laplace * normal;
145  }
146  else
147  {
148  oH = 0.;
149  }
150  }
151  }
152  }
153  return oH;
154  }
155 };
156 }
157 #endif
typename OutputMeshType::PointsContainerIterator OutputPointsContainerIterator
Light weight base class for most itk classes.
TOutputMesh OutputMeshType
Definition: itkMeshSource.h:68
typename OutputMeshType::PointsContainerIterator OutputPointsContainerIterator
~DiscreteMeanCurvatureQuadEdgeMeshFilter() override=default
OutputCurvatureType ComputeMixedArea(OutputQEType *iQE1, OutputQEType *iQE2)
typename OutputMeshType::CellIdentifier OutputCellIdentifier
Compute a matrix filed by Conformal Coefficients of the edge wherever two vertices are connected by a...
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
see the following paper title: Discrete Differential-Geometry Operators for Triangulated 2-Manifolds ...
typename OutputMeshType::Pointer OutputMeshPointer
Definition: itkMeshSource.h:69
static constexpr double e
The base of the natural logarithm or Euler&#39;s number
Definition: itkMath.h:53
typename OutputMeshType::VectorType OutputVectorType
OutputCurvatureType EstimateCurvature(const OutputPointType &iP) override
typename OutputMeshType::PointsContainerPointer OutputPointsContainerPointer
OutputMeshType * GetOutput()
#define itkConceptMacro(name, concept)