ITK  6.0.0
Insight Toolkit
itkNormalQuadEdgeMeshFilter.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 itkNormalQuadEdgeMeshFilter_h
19 #define itkNormalQuadEdgeMeshFilter_h
20 
23 #include "itkTriangleHelper.h"
24 #include "ITKQuadEdgeMeshFilteringExport.h"
25 namespace itk
26 {
32 {
33 public:
37  enum class Weight : uint8_t
38  {
39  GOURAUD = 0, // Uniform weights
40  THURMER, // Angle on a triangle at the given vertex
41  AREA
42  };
43 };
44 // Define how to print enumeration
45 extern ITKQuadEdgeMeshFiltering_EXPORT std::ostream &
46  operator<<(std::ostream & out, const NormalQuadEdgeMeshFilterEnums::Weight value);
47 
92 template <typename TInputMesh, typename TOutputMesh>
93 class ITK_TEMPLATE_EXPORT NormalQuadEdgeMeshFilter : public QuadEdgeMeshToQuadEdgeMeshFilter<TInputMesh, TOutputMesh>
94 {
95 public:
96  ITK_DISALLOW_COPY_AND_MOVE(NormalQuadEdgeMeshFilter);
97 
102 
103  itkNewMacro(Self);
104 
105  itkOverrideGetNameOfClassMacro(NormalQuadEdgeMeshFilter);
106 
107  using InputMeshType = TInputMesh;
109  using InputPointIdentifier = typename InputMeshType::PointIdentifier;
112  using InputQEType = typename InputMeshType::QEType;
113 
114  using OutputMeshType = TOutputMesh;
118  using OutputQEType = typename OutputMeshType::QEType;
119  using OutputPointIdentifier = typename OutputMeshType::PointIdentifier;
120  using OutputPointIdIterator = typename OutputMeshType::PointIdIterator;
121  using OutputPointsContainerPointer = typename OutputMeshType::PointsContainerPointer;
122  using OutputPointsContainerIterator = typename OutputMeshType::PointsContainerIterator;
123  using OutputCellType = typename OutputMeshType::CellType;
124  using OutputCellIdentifier = typename OutputMeshType::CellIdentifier;
125  using OutputCellAutoPointer = typename OutputMeshType::CellAutoPointer;
126  using OutputCellsContainerPointer = typename OutputMeshType::CellsContainerConstIterator;
127  using OutputCellsContainerConstIterator = typename OutputMeshType::CellsContainerConstIterator;
128 
130 
133 
134  using OutputCellDataContainer = typename OutputMeshType::CellDataContainer;
135  using OutputPointDataContainer = typename OutputMeshType::PointDataContainer;
136 
137  using OutputMeshTraits = typename OutputMeshType::MeshTraits;
138  using OutputVertexNormalType = typename OutputMeshTraits::PixelType;
139  using OutputVertexNormalComponentType = typename OutputVertexNormalType::ValueType;
140 
141  using OutputFaceNormalType = typename OutputMeshTraits::CellPixelType;
142  using OutputFaceNormalComponentType = typename OutputFaceNormalType::ValueType;
143 
145 #if !defined(ITK_LEGACY_REMOVE)
146 
147  using WeightType = WeightEnum;
148  static constexpr WeightEnum GOURAUD = WeightEnum::GOURAUD;
149  static constexpr WeightEnum THURMER = WeightEnum::THURMER;
150  static constexpr WeightEnum AREA = WeightEnum::AREA;
151 #endif
152 
153  itkSetEnumMacro(Weight, WeightEnum);
154  itkGetConstMacro(Weight, WeightEnum);
155 
156 protected:
158  ~NormalQuadEdgeMeshFilter() override = default;
159  void
160  PrintSelf(std::ostream & os, Indent indent) const override;
161 
162  WeightEnum m_Weight{};
163 
170  OutputFaceNormalType
171  ComputeFaceNormal(OutputPolygonType * iPoly);
172 
177  void
178  ComputeAllFaceNormals();
179 
184  void
185  ComputeAllVertexNormals();
186 
191  OutputVertexNormalType
192  ComputeVertexNormal(const OutputPointIdentifier & iId, OutputMeshType * outputMesh);
193 
197  OutputVertexNormalComponentType
198  Weight(const OutputPointIdentifier & iPId, const OutputCellIdentifier & iCId, OutputMeshType * outputMesh);
199 
204  void
205  GenerateData() override;
206 };
207 } // namespace itk
210 #include "itkNormalQuadEdgeMeshFilter.hxx"
211 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
WeightEnum
itk::AutoPointer
Implements an Automatic Pointer to an object.
Definition: itkAutoPointer.h:46
itk::NormalQuadEdgeMeshFilter::OutputVertexNormalComponentType
typename OutputVertexNormalType::ValueType OutputVertexNormalComponentType
Definition: itkNormalQuadEdgeMeshFilter.h:139
itk::QuadEdgeMeshToQuadEdgeMeshFilter::OutputPointDataContainer
typename OutputMeshType::PointDataContainer OutputPointDataContainer
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:89
itk::MeshSource::OutputMeshPointer
typename OutputMeshType::Pointer OutputMeshPointer
Definition: itkMeshSource.h:69
itk::NormalQuadEdgeMeshFilter::OutputCellsContainerPointer
typename OutputMeshType::CellsContainerConstIterator OutputCellsContainerPointer
Definition: itkNormalQuadEdgeMeshFilter.h:126
itk::NormalQuadEdgeMeshFilter::OutputPolygonAutoPointer
typename OutputPolygonType::SelfAutoPointer OutputPolygonAutoPointer
Definition: itkNormalQuadEdgeMeshFilter.h:132
itk::NormalQuadEdgeMeshFilter::OutputVertexNormalType
typename OutputMeshTraits::PixelType OutputVertexNormalType
Definition: itkNormalQuadEdgeMeshFilter.h:138
itk::QuadEdgeMeshToQuadEdgeMeshFilter::OutputPointsContainerPointer
typename OutputMeshType::PointsContainerPointer OutputPointsContainerPointer
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:86
itk::NormalQuadEdgeMeshFilter::InputQEType
typename InputMeshType::QEType InputQEType
Definition: itkNormalQuadEdgeMeshFilter.h:112
itk::NormalQuadEdgeMeshFilter::OutputFaceNormalType
typename OutputMeshTraits::CellPixelType OutputFaceNormalType
Definition: itkNormalQuadEdgeMeshFilter.h:141
itk::MeshToMeshFilter::InputMeshPointer
typename InputMeshType::Pointer InputMeshPointer
Definition: itkMeshToMeshFilter.h:66
itk::GTest::TypedefsAndConstructors::Dimension2::VectorType
ImageBaseType::SpacingType VectorType
Definition: itkGTestTypedefsAndConstructors.h:53
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::NormalQuadEdgeMeshFilter
Filter which computes normals to faces and vertices and store it in the output mesh....
Definition: itkNormalQuadEdgeMeshFilter.h:93
itk::QuadEdgeMeshToQuadEdgeMeshFilter::OutputCellDataContainer
typename OutputMeshType::CellDataContainer OutputCellDataContainer
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:90
itk::NormalQuadEdgeMeshFilter::OutputQEType
typename OutputMeshType::QEType OutputQEType
Definition: itkNormalQuadEdgeMeshFilter.h:118
itk::operator<<
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::NormalQuadEdgeMeshFilter::OutputMeshTraits
typename OutputMeshType::MeshTraits OutputMeshTraits
Definition: itkNormalQuadEdgeMeshFilter.h:137
itk::TriangleHelper
A convenience class for computation of various triangle elements in 2D or 3D.
Definition: itkTriangleHelper.h:31
itk::NormalQuadEdgeMeshFilter::OutputCellType
typename OutputMeshType::CellType OutputCellType
Definition: itkNormalQuadEdgeMeshFilter.h:123
itkQuadEdgeMeshToQuadEdgeMeshFilter.h
itk::MeshToMeshFilter::InputMeshType
TInputMesh InputMeshType
Definition: itkMeshToMeshFilter.h:65
itk::QuadEdgeMeshToQuadEdgeMeshFilter::InputPointType
typename InputMeshType::PointType InputPointType
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:53
itk::NormalQuadEdgeMeshFilterEnums::Weight::GOURAUD
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::QuadEdgeMeshToQuadEdgeMeshFilter::InputPointIdentifier
typename InputMeshType::PointIdentifier InputPointIdentifier
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:54
itk::NormalQuadEdgeMeshFilter::OutputPointIdIterator
typename OutputMeshType::PointIdIterator OutputPointIdIterator
Definition: itkNormalQuadEdgeMeshFilter.h:120
itk::QuadEdgeMeshPolygonCell
Definition: itkQuadEdgeMeshPolygonCell.h:39
itkQuadEdgeMeshPolygonCell.h
itk::QuadEdgeMeshToQuadEdgeMeshFilter::OutputVectorType
typename OutputMeshType::VectorType OutputVectorType
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:83
itk::QuadEdgeMeshToQuadEdgeMeshFilter
Duplicates the content of a Mesh.
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:37
itkTriangleHelper.h
itk::NormalQuadEdgeMeshFilter::OutputCellsContainerConstIterator
typename OutputMeshType::CellsContainerConstIterator OutputCellsContainerConstIterator
Definition: itkNormalQuadEdgeMeshFilter.h:127
itk::NormalQuadEdgeMeshFilterEnums::Weight::AREA
itk::NormalQuadEdgeMeshFilter::OutputCellAutoPointer
typename OutputMeshType::CellAutoPointer OutputCellAutoPointer
Definition: itkNormalQuadEdgeMeshFilter.h:125
itk::NormalQuadEdgeMeshFilterEnums
Contains enum classes used by NormalQuadEdgeMeshFilter class.
Definition: itkNormalQuadEdgeMeshFilter.h:31
itk::NormalQuadEdgeMeshFilterEnums::Weight
Weight
Definition: itkNormalQuadEdgeMeshFilter.h:37
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::NormalQuadEdgeMeshFilterEnums::Weight::THURMER
itk::MeshSource::OutputMeshType
TOutputMesh OutputMeshType
Definition: itkMeshSource.h:68
itk::QuadEdgeMeshToQuadEdgeMeshFilter::InputVectorType
typename InputMeshType::VectorType InputVectorType
Definition: itkQuadEdgeMeshToQuadEdgeMeshFilter.h:56
itk::NormalQuadEdgeMeshFilter::OutputCellIdentifier
typename OutputMeshType::CellIdentifier OutputCellIdentifier
Definition: itkNormalQuadEdgeMeshFilter.h:124
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
itk::NormalQuadEdgeMeshFilter::OutputFaceNormalComponentType
typename OutputFaceNormalType::ValueType OutputFaceNormalComponentType
Definition: itkNormalQuadEdgeMeshFilter.h:142