ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkDiscreteCurvatureQuadEdgeMeshFilter.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 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 >
36  public QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh >
37 {
38 public:
39  ITK_DISALLOW_COPY_AND_ASSIGN(DiscreteCurvatureQuadEdgeMeshFilter);
40 
45 
46  using InputMeshType = TInputMesh;
47  using InputMeshPointer = typename InputMeshType::Pointer;
48 
49  using OutputMeshType = TOutputMesh;
50  using OutputMeshPointer = typename OutputMeshType::Pointer;
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 
65 
66 #ifdef ITK_USE_CONCEPT_CHECKING
67  // Begin concept checking
68  itkConceptMacro( OutputIsFloatingPointCheck,
70  // End concept checking
71 #endif
72 
73 protected:
75  ~DiscreteCurvatureQuadEdgeMeshFilter() override = default;
76 
78 
80  {
81 
83 
84  id[0] = iQE1->GetOrigin();
85  id[1] = iQE1->GetDestination();
86  id[2] = iQE2->GetDestination();
87 
88  OutputPointType p[3];
89 
90  for ( int i = 0; i < 3; i++ )
91  {
92  p[i] = this->m_OutputMesh->GetPoint(id[i]);
93  }
94 
95  return static_cast< OutputCurvatureType >( TriangleType::ComputeMixedArea( p[0], p[1], p[2] ) );
96  }
97 
98  void GenerateData() override
99  {
101 
102  OutputMeshPointer output = this->GetOutput();
103 
104  OutputPointsContainerPointer points = output->GetPoints();
105  OutputPointsContainerIterator p_it = points->Begin();
106 
107  OutputCurvatureType curvature;
108 
109  this->m_OutputMesh = this->GetOutput();
110  while ( p_it != points->End() )
111  {
112  curvature = this->EstimateCurvature( p_it->Value() );
113  output->SetPointData(p_it->Index(), curvature);
114  ++p_it;
115  }
116  }
117 
118 private:
121 };
122 } // end namespace itk
123 
124 #endif
typename OutputMeshType::PointsContainerIterator OutputPointsContainerIterator
Light weight base class for most itk classes.
OutputCurvatureType ComputeMixedArea(OutputQEType *iQE1, OutputQEType *iQE2)
static CoordRepType ComputeMixedArea(const PointType &iP1, const PointType &iP2, const PointType &iP3)
typename OutputMeshType::CellIdentifier OutputCellIdentifier
typename OutputMeshType::PointIdentifier OutputPointIdentifier
typename InputMeshType::Pointer InputMeshPointer
A convenience class for computation of various triangle elements in 2D or 3D.
typename OutputMeshType::Pointer OutputMeshPointer
Definition: itkMeshSource.h:69
virtual OutputCurvatureType EstimateCurvature(const OutputPointType &iP)=0
~DiscreteCurvatureQuadEdgeMeshFilter() override=default
typename OutputMeshType::PointsContainerPointer OutputPointsContainerPointer
OutputMeshType * GetOutput()
#define itkConceptMacro(name, concept)