ITK  6.0.0
Insight Toolkit
itkDiscreteCurvatureQuadEdgeMeshFilter.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 itkDiscreteCurvatureQuadEdgeMeshFilter_h
19 #define itkDiscreteCurvatureQuadEdgeMeshFilter_h
20 
22 #include "itkConceptChecking.h"
23 #include "itkTriangleHelper.h"
24 
25 namespace itk
26 {
34 template <typename TInputMesh, typename TOutputMesh = TInputMesh>
35 class ITK_TEMPLATE_EXPORT DiscreteCurvatureQuadEdgeMeshFilter
36  : public QuadEdgeMeshToQuadEdgeMeshFilter<TInputMesh, TOutputMesh>
37 {
38 public:
39  ITK_DISALLOW_COPY_AND_MOVE(DiscreteCurvatureQuadEdgeMeshFilter);
40 
45 
46  using InputMeshType = TInputMesh;
48 
49  using OutputMeshType = TOutputMesh;
51  using OutputPointsContainerPointer = typename OutputMeshType::PointsContainerPointer;
52  using OutputPointsContainerIterator = typename OutputMeshType::PointsContainerIterator;
54  using OutputCoordType = typename OutputPointType::CoordRepType;
55  using OutputPointIdentifier = typename OutputMeshType::PointIdentifier;
56  using OutputCellIdentifier = typename OutputMeshType::CellIdentifier;
57  using OutputQEType = typename OutputMeshType::QEType;
58  using OutputMeshTraits = typename OutputMeshType::MeshTraits;
59  using OutputCurvatureType = typename OutputMeshTraits::PixelType;
60 
62 
64  itkOverrideGetNameOfClassMacro(DiscreteCurvatureQuadEdgeMeshFilter);
65 
66 #ifdef ITK_USE_CONCEPT_CHECKING
67  // Begin concept checking
69  // End concept checking
70 #endif
71 
72 protected:
74  : m_OutputMesh(nullptr)
75  {}
76  ~DiscreteCurvatureQuadEdgeMeshFilter() override = default;
77 
78  virtual OutputCurvatureType
79  EstimateCurvature(const OutputPointType & iP) = 0;
80 
81  OutputCurvatureType
83  {
84 
86 
87  id[0] = iQE1->GetOrigin();
88  id[1] = iQE1->GetDestination();
89  id[2] = iQE2->GetDestination();
90 
91  OutputPointType p[3];
92 
93  for (int i = 0; i < 3; ++i)
94  {
95  p[i] = this->m_OutputMesh->GetPoint(id[i]);
96  }
97 
98  return static_cast<OutputCurvatureType>(TriangleType::ComputeMixedArea(p[0], p[1], p[2]));
99  }
100 
101  void
102  GenerateData() override
103  {
104  this->CopyInputMeshToOutputMesh();
105 
106  OutputMeshPointer output = this->GetOutput();
107 
108  OutputPointsContainerPointer points = output->GetPoints();
109  OutputPointsContainerIterator p_it = points->Begin();
110 
111  OutputCurvatureType curvature;
112 
113  this->m_OutputMesh = this->GetOutput();
114  while (p_it != points->End())
115  {
116  curvature = this->EstimateCurvature(p_it->Value());
117  output->SetPointData(p_it->Index(), curvature);
118  ++p_it;
119  }
120  }
121 
122 private:
124  OutputMeshType * m_OutputMesh{};
125 };
126 } // end namespace itk
127 
128 #endif
itk::DiscreteCurvatureQuadEdgeMeshFilter::ComputeMixedArea
OutputCurvatureType ComputeMixedArea(OutputQEType *iQE1, OutputQEType *iQE2)
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:82
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::MeshSource::OutputMeshPointer
typename OutputMeshType::Pointer OutputMeshPointer
Definition: itkMeshSource.h:69
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputMeshType
TOutputMesh OutputMeshType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:49
itk::QuadEdgeMeshToQuadEdgeMeshFilter::OutputPointsContainerPointer
typename OutputMeshType::PointsContainerPointer OutputPointsContainerPointer
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:86
itk::MeshToMeshFilter::InputMeshPointer
typename InputMeshType::Pointer InputMeshPointer
Definition: itkMeshToMeshFilter.h:66
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itkConceptChecking.h
itk::SmartPointer< Self >
itk::TriangleHelper
A convenience class for computation of various triangle elements in 2D or 3D.
Definition: itkTriangleHelper.h:31
itkQuadEdgeMeshToQuadEdgeMeshFilter.h
itk::MeshToMeshFilter::InputMeshType
TInputMesh InputMeshType
Definition: itkMeshToMeshFilter.h:65
itk::DiscreteCurvatureQuadEdgeMeshFilter::GenerateData
void GenerateData() override
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:102
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputCurvatureType
typename OutputMeshTraits::PixelType OutputCurvatureType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:59
itk::QuadEdgeMeshToQuadEdgeMeshFilter
Duplicates the content of a Mesh.
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:37
itk::Concept::IsFloatingPoint
Definition: itkConceptChecking.h:948
itkTriangleHelper.h
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputMeshTraits
typename OutputMeshType::MeshTraits OutputMeshTraits
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:58
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
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputQEType
typename OutputMeshType::QEType OutputQEType
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:57
itk::DiscreteCurvatureQuadEdgeMeshFilter::DiscreteCurvatureQuadEdgeMeshFilter
DiscreteCurvatureQuadEdgeMeshFilter()
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:73
itk::DiscreteCurvatureQuadEdgeMeshFilter::OutputCellIdentifier
typename OutputMeshType::CellIdentifier OutputCellIdentifier
Definition: itkDiscreteCurvatureQuadEdgeMeshFilter.h:56
itk::QuadEdgeMeshToQuadEdgeMeshFilter::OutputPointIdentifier
typename OutputMeshType::PointIdentifier OutputPointIdentifier
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:81
itk::QuadEdgeMeshToQuadEdgeMeshFilter::OutputPointType
typename OutputMeshType::PointType OutputPointType
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:80
itk::QuadEdgeMeshToQuadEdgeMeshFilter::OutputPointsContainerIterator
typename OutputMeshType::PointsContainerIterator OutputPointsContainerIterator
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:85