ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkNormalQuadEdgeMeshFilter.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 itkNormalQuadEdgeMeshFilter_h
19 #define itkNormalQuadEdgeMeshFilter_h
20 
23 #include "itkTriangleHelper.h"
24 
25 namespace itk
26 {
67 template< typename TInputMesh, typename TOutputMesh >
69  public QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh >
70 {
71 public:
76 
77  itkNewMacro (Self);
78 
79  itkTypeMacro (NormalQuadEdgeMeshFilter,
81 
82  typedef TInputMesh InputMeshType;
83  typedef typename InputMeshType::Pointer InputMeshPointer;
84  typedef typename InputMeshType::PointIdentifier InputPointIdentifier;
85  typedef typename InputMeshType::PointType InputPointType;
86  typedef typename InputMeshType::VectorType InputVectorType;
87  typedef typename InputMeshType::QEType InputQEType;
88 
89  typedef TOutputMesh OutputMeshType;
90  typedef typename OutputMeshType::Pointer OutputMeshPointer;
91  typedef typename OutputMeshType::PointType OutputPointType;
92  typedef typename OutputPointType::VectorType OutputVectorType;
93  typedef typename OutputMeshType::QEType OutputQEType;
94  typedef typename OutputMeshType::PointIdentifier OutputPointIdentifier;
95  typedef typename OutputMeshType::PointIdIterator OutputPointIdIterator;
96  typedef typename OutputMeshType::PointsContainerPointer OutputPointsContainerPointer;
97  typedef typename OutputMeshType::PointsContainerIterator OutputPointsContainerIterator;
98  typedef typename OutputMeshType::CellType OutputCellType;
99  typedef typename OutputMeshType::CellIdentifier OutputCellIdentifier;
100  typedef typename OutputMeshType::CellAutoPointer OutputCellAutoPointer;
101  typedef typename OutputMeshType::CellsContainerConstIterator OutputCellsContainerPointer;
102  typedef typename OutputMeshType::CellsContainerConstIterator OutputCellsContainerConstIterator;
103 
105 
108 
109  typedef typename OutputMeshType::CellDataContainer OutputCellDataContainer;
110  typedef typename OutputMeshType::PointDataContainer OutputPointDataContainer;
111 
112  typedef typename OutputMeshType::MeshTraits OutputMeshTraits;
113  typedef typename OutputMeshTraits::PixelType OutputVertexNormalType;
114  typedef typename OutputVertexNormalType::ValueType OutputVertexNormalComponentType;
115 
116  typedef typename OutputMeshTraits::CellPixelType OutputFaceNormalType;
117  typedef typename OutputFaceNormalType::ValueType OutputFaceNormalComponentType;
118 
119  enum WeightType {
120  GOURAUD = 0, // Uniform weights
121  THURMER, // Angle on a triangle at the given vertex
123  };
124 
125  itkSetMacro (Weight, WeightType);
126  itkGetConstMacro (Weight, WeightType);
127 
128 protected:
131  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
132 
134 
142 
147  void ComputeAllFaceNormals();
148 
154 
160 
165  const OutputCellIdentifier & iCId,
166  OutputMeshType *outputMesh);
167 
172  void GenerateData() ITK_OVERRIDE;
173 
174 private:
175  NormalQuadEdgeMeshFilter (const Self &);
176  void operator=(const Self &);
177 };
178 }
179 
180 #include "itkNormalQuadEdgeMeshFilter.hxx"
181 #endif
OutputPolygonType::SelfAutoPointer OutputPolygonAutoPointer
OutputPointType::VectorType OutputVectorType
Light weight base class for most itk classes.
OutputMeshType::PointType OutputPointType
TOutputMesh OutputMeshType
Definition: itkMeshSource.h:66
OutputVertexNormalComponentType Weight(const OutputPointIdentifier &iPId, const OutputCellIdentifier &iCId, OutputMeshType *outputMesh)
Definition of the weight in the 0-ring used for the vertex normal computation. By default m_Weight = ...
InputMeshType::VectorType InputVectorType
OutputMeshType::CellsContainerConstIterator OutputCellsContainerConstIterator
OutputMeshType::PointDataContainer OutputPointDataContainer
OutputMeshType::PointIdentifier OutputPointIdentifier
OutputMeshType::MeshTraits OutputMeshTraits
SmartPointer< const Self > ConstPointer
OutputMeshType::PointIdIterator OutputPointIdIterator
Filter which computes normals to faces and vertices and store it in the output mesh. Normals to face are first computed, then normals to vertices are computed as linear combination of neighbor face normals, i.e. .
OutputVertexNormalType ComputeVertexNormal(const OutputPointIdentifier &iId, OutputMeshType *outputMesh)
Compute the normal to one vertex by a weighted sum of the faces normal in the 0-ring.
OutputMeshType::PointsContainerPointer OutputPointsContainerPointer
OutputMeshType::CellDataContainer OutputCellDataContainer
void ComputeAllVertexNormals()
Compute the normal to all vertices on the mesh.
void PrintSelf(std::ostream &os, Indent indent) const override
OutputMeshTraits::PixelType OutputVertexNormalType
void ComputeAllFaceNormals()
Compute the normal to all faces on the mesh.
QuadEdgeMeshPolygonCell< OutputCellType > OutputPolygonType
OutputFaceNormalType ComputeFaceNormal(OutputPolygonType *iPoly)
Compute the normal to a face iPoly. It assumes that iPoly != 0 and iPoly is a Triangle, i.e. 3 points only.
A convenience class for computation of various triangle elements in 2D or 3D.
OutputMeshType::CellsContainerConstIterator OutputCellsContainerPointer
OutputFaceNormalType::ValueType OutputFaceNormalComponentType
OutputMeshTraits::CellPixelType OutputFaceNormalType
OutputMeshType::PointsContainerIterator OutputPointsContainerIterator
QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh > Superclass
Implements an Automatic Pointer to an object.
OutputMeshType::CellIdentifier OutputCellIdentifier
Control indentation during Print() invocation.
Definition: itkIndent.h:49
InputMeshType::PointIdentifier InputPointIdentifier
OutputMeshType::CellAutoPointer OutputCellAutoPointer
OutputVertexNormalType::ValueType OutputVertexNormalComponentType
TriangleHelper< OutputPointType > TriangleType