ITK  4.13.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:
43 
44  typedef TInputMesh InputMeshType;
45  typedef typename InputMeshType::Pointer InputMeshPointer;
46 
47  typedef TOutputMesh OutputMeshType;
48  typedef typename OutputMeshType::Pointer OutputMeshPointer;
49  typedef typename OutputMeshType::PointsContainerPointer OutputPointsContainerPointer;
50  typedef typename OutputMeshType::PointsContainerIterator OutputPointsContainerIterator;
52  typedef typename OutputPointType::CoordRepType OutputCoordType;
53  typedef typename OutputMeshType::PointIdentifier OutputPointIdentifier;
54  typedef typename OutputMeshType::CellIdentifier OutputCellIdentifier;
55  typedef typename OutputMeshType::QEType OutputQEType;
56  typedef typename OutputMeshType::MeshTraits OutputMeshTraits;
57  typedef typename OutputMeshTraits::PixelType OutputCurvatureType;
58 
60 
63 
64 #ifdef ITK_USE_CONCEPT_CHECKING
65  // Begin concept checking
66  itkConceptMacro( OutputIsFloatingPointCheck,
68  // End concept checking
69 #endif
70 
71 protected:
73  virtual ~DiscreteCurvatureQuadEdgeMeshFilter() ITK_OVERRIDE {}
74 
76 
78  {
79 
81 
82  id[0] = iQE1->GetOrigin();
83  id[1] = iQE1->GetDestination();
84  id[2] = iQE2->GetDestination();
85 
86  OutputPointType p[3];
87 
88  for ( int i = 0; i < 3; i++ )
89  {
90  p[i] = this->m_OutputMesh->GetPoint(id[i]);
91  }
92 
93  return static_cast< OutputCurvatureType >( TriangleType::ComputeMixedArea( p[0], p[1], p[2] ) );
94  }
95 
96  virtual void GenerateData() ITK_OVERRIDE
97  {
99 
100  OutputMeshPointer output = this->GetOutput();
101 
102  OutputPointsContainerPointer points = output->GetPoints();
103  OutputPointsContainerIterator p_it = points->Begin();
104 
105  OutputCurvatureType curvature;
106 
107  this->m_OutputMesh = this->GetOutput();
108  while ( p_it != points->End() )
109  {
110  curvature = this->EstimateCurvature( p_it->Value() );
111  output->SetPointData(p_it->Index(), curvature);
112  ++p_it;
113  }
114  }
115 
116 private:
119  ITK_DISALLOW_COPY_AND_ASSIGN(DiscreteCurvatureQuadEdgeMeshFilter);
120 };
121 } // end namespace itk
123 
124 #endif
OutputCurvatureType ComputeMixedArea(OutputQEType *iQE1, OutputQEType *iQE2)
static CoordRepType ComputeMixedArea(const PointType &iP1, const PointType &iP2, const PointType &iP3)
OutputMeshType::PointsContainerIterator OutputPointsContainerIterator
QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh > Superclass
A convenience class for computation of various triangle elements in 2D or 3D.
OutputMeshType::PointsContainerPointer OutputPointsContainerPointer
virtual OutputCurvatureType EstimateCurvature(const OutputPointType &iP)=0
OutputMeshType::Pointer OutputMeshPointer
Definition: itkMeshSource.h:67
OutputMeshType::PointsContainerIterator OutputPointsContainerIterator
OutputMeshType::PointsContainerPointer OutputPointsContainerPointer
OutputMeshType * GetOutput()
#define itkConceptMacro(name, concept)