ITK  4.2.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< class TInputMesh, class TOutputMesh >
68 class ITK_EXPORT NormalQuadEdgeMeshFilter:
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
122  AREA
123  };
124 
125  itkSetMacro (Weight, WeightType);
126  itkGetConstMacro (Weight, WeightType);
127 protected:
130  void PrintSelf(std::ostream & os, Indent indent) const;
131 
133 
140  OutputFaceNormalType ComputeFaceNormal(OutputPolygonType *iPoly);
141 
146  void ComputeAllFaceNormals();
147 
152  void ComputeAllVertexNormals();
153 
158  OutputVertexNormalType ComputeVertexNormal(
159  const OutputPointIdentifier & iId);
160 
165  const OutputCellIdentifier & iCId);
166 
171  void GenerateData();
172 
173 private:
174  NormalQuadEdgeMeshFilter (const Self &);
175  void operator=(const Self &);
176 };
177 }
178 
179 #include "itkNormalQuadEdgeMeshFilter.hxx"
180 #endif
181