ITK  6.0.0
Insight Toolkit
itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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:
38  ITK_DISALLOW_COPY_AND_MOVE(DiscretePrincipalCurvaturesQuadEdgeMeshFilter);
39 
44 
45  using typename Superclass::InputMeshType;
46  using typename Superclass::InputMeshPointer;
47  using typename Superclass::OutputMeshType;
48  using typename Superclass::OutputMeshPointer;
51  using typename Superclass::OutputPointType;
52  using typename Superclass::OutputVectorType;
53  using typename Superclass::OutputCoordType;
54  using typename Superclass::OutputPointIdentifier;
55  using typename Superclass::OutputCellIdentifier;
56  using typename Superclass::OutputQEType;
57  using typename Superclass::OutputMeshTraits;
58  using typename Superclass::OutputCurvatureType;
59 
60  using typename Superclass::TriangleType;
61 
63  itkOverrideGetNameOfClassMacro(DiscretePrincipalCurvaturesQuadEdgeMeshFilter);
64 
66 
67 #ifdef ITK_USE_CONCEPT_CHECKING
68  // Begin concept checking
70  // End concept checking
71 #endif
72 
73 protected:
75  : m_Gaussian(0.0)
76  , m_Mean(0.0)
77  {}
79 
82 
83  void
85  {
86  OutputMeshPointer output = this->GetOutput();
87 
88  OutputQEType * qe = iP.GetEdge();
89 
90  m_Mean = 0.;
91  m_Gaussian = 0.;
92 
93  if (qe != nullptr)
94  {
95  OutputVectorType Laplace{};
96 
97  OutputQEType * qe_it = qe;
98 
99  OutputCurvatureType area(0.), sum_theta(0.);
100 
101  if (qe_it != qe_it->GetOnext())
102  {
103  qe_it = qe;
104  OutputQEType * qe_it2;
105 
106  OutputPointType q0, q1;
107  OutputVectorType face_normal;
108 
109  OutputVectorType normal{};
110 
111  OutputCurvatureType temp_area;
112  OutputCoordType temp_coeff;
113 
114  CoefficientType coefficent;
115 
116  do
117  {
118  qe_it2 = qe_it->GetOnext();
119  q0 = output->GetPoint(qe_it->GetDestination());
120  q1 = output->GetPoint(qe_it2->GetDestination());
121 
122  temp_coeff = coefficent(output, qe_it);
123  Laplace += temp_coeff * (iP - q0);
124 
125  // Compute Angle;
126  sum_theta += static_cast<OutputCurvatureType>(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  } while (qe_it != qe);
136 
137  if (area > 1e-10)
138  {
139  area = 1. / area;
140  Laplace *= 0.25 * area;
141  m_Mean = Laplace * normal;
142  m_Gaussian = (2. * itk::Math::pi - sum_theta) * area;
143  }
144  }
145  }
146  }
147 
148  virtual OutputCurvatureType
150  {
151  return std::max(static_cast<OutputCurvatureType>(0.), m_Mean * m_Mean - m_Gaussian);
152  }
153 };
154 } // namespace itk
155 
156 #endif
itk::DiscreteCurvatureQuadEdgeMeshFilter::ComputeMixedArea
OutputCurvatureType ComputeMixedArea(OutputQEType *iQE1, OutputQEType *iQE2)
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:82
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputMeshPointer
typename OutputMeshType::Pointer OutputMeshPointer
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:50
itk::DiscretePrincipalCurvaturesQuadEdgeMeshFilter
FIXME add documentation here.
Definition: itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter.h:34
itk::DiscreteCurvatureQuadEdgeMeshFilter::InputMeshType
TInputMesh InputMeshType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:46
itk::MeshSource::GetOutput
OutputMeshType * GetOutput()
itk::MeshSource::OutputMeshPointer
typename OutputMeshType::Pointer OutputMeshPointer
Definition: itkMeshSource.h:69
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputMeshType
TOutputMesh OutputMeshType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:49
itk::TriangleHelper::ComputeAngle
static CoordRepType ComputeAngle(const PointType &iP1, const PointType &iP2, const PointType &iP3)
Compute angles (iA,iB,iC)
itk::DiscreteCurvatureQuadEdgeMeshFilter::InputMeshPointer
typename InputMeshType::Pointer InputMeshPointer
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:47
itkDiscreteCurvatureQuadEdgeMeshFilter.h
itk::SmartPointer< Self >
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputPointIdentifier
typename OutputMeshType::PointIdentifier OutputPointIdentifier
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:55
itk::DiscreteCurvatureQuadEdgeMeshFilter::TriangleType
TriangleHelper< OutputPointType > TriangleType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:61
itk::DiscretePrincipalCurvaturesQuadEdgeMeshFilter::m_Gaussian
OutputCurvatureType m_Gaussian
Definition: itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter.h:80
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputPointsContainerPointer
typename OutputMeshType::PointsContainerPointer OutputPointsContainerPointer
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:51
itk::ConformalMatrixCoefficients
Compute a matrix filed by Conformal Coefficients of the edge wherever two vertices are connected by a...
Definition: itkQuadEdgeMeshParamMatrixCoefficients.h:127
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputCurvatureType
typename OutputMeshTraits::PixelType OutputCurvatureType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:59
itk::QuadEdgeMeshToQuadEdgeMeshFilter::OutputVectorType
typename OutputMeshType::VectorType OutputVectorType
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:83
itkQuadEdgeMeshParamMatrixCoefficients.h
itk::Concept::IsFloatingPoint
Definition: itkConceptChecking.h:948
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputMeshTraits
typename OutputMeshType::MeshTraits OutputMeshTraits
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:58
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputPointType
typename OutputMeshType::PointType OutputPointType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:53
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputCoordType
typename OutputPointType::CoordRepType OutputCoordType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:54
itk::DiscreteCurvatureQuadEdgeMeshFilter
FIXME.
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:35
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk::TriangleHelper::ComputeNormal
static VectorType ComputeNormal(const PointType &iA, const PointType &iB, const PointType &iC)
Compute Normal vector to the triangle formed by (iA,iB,iC)
itk::DiscretePrincipalCurvaturesQuadEdgeMeshFilter::~DiscretePrincipalCurvaturesQuadEdgeMeshFilter
~DiscretePrincipalCurvaturesQuadEdgeMeshFilter() override=default
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputPointsContainerIterator
typename OutputMeshType::PointsContainerIterator OutputPointsContainerIterator
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:52
itk::DiscretePrincipalCurvaturesQuadEdgeMeshFilter::ComputeDelta
virtual OutputCurvatureType ComputeDelta()
Definition: itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter.h:149
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputQEType
typename OutputMeshType::QEType OutputQEType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:57
itk::Math::e
static constexpr double e
Definition: itkMath.h:56
itk::DiscretePrincipalCurvaturesQuadEdgeMeshFilter::DiscretePrincipalCurvaturesQuadEdgeMeshFilter
DiscretePrincipalCurvaturesQuadEdgeMeshFilter()
Definition: itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter.h:74
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputCellIdentifier
typename OutputMeshType::CellIdentifier OutputCellIdentifier
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:56
itk::Math::pi
static constexpr double pi
Definition: itkMath.h:66
itk::DiscretePrincipalCurvaturesQuadEdgeMeshFilter::ComputeMeanAndGaussianCurvatures
void ComputeMeanAndGaussianCurvatures(const OutputPointType &iP)
Definition: itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter.h:84
itk::QuadEdgeMeshToQuadEdgeMeshFilter::OutputPointType
typename OutputMeshType::PointType OutputPointType
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:80
itk::DiscretePrincipalCurvaturesQuadEdgeMeshFilter::m_Mean
OutputCurvatureType m_Mean
Definition: itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter.h:81