Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkQuadEdgeMeshNormalFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkQuadEdgeMeshNormalFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2010-03-17 18:42:55 $
00007   Version:   $Revision: 1.4 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 
00018 #ifndef __itkQuadEdgeMeshNormalFilter_h
00019 #define __itkQuadEdgeMeshNormalFilter_h
00020 
00021 #include <itkQuadEdgeMeshToQuadEdgeMeshFilter.h>
00022 #include <itkQuadEdgeMeshPolygonCell.h>
00023 #include "itkTriangleHelper.h"
00024 
00025 namespace itk
00026 {
00065 template< class TInputMesh, class TOutputMesh >
00066 class QuadEdgeMeshNormalFilter :
00067   public QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh >
00068 {
00069 public:
00070   typedef QuadEdgeMeshNormalFilter                Self;
00071   typedef QuadEdgeMeshToQuadEdgeMeshFilter< 
00072     TInputMesh, TOutputMesh >                     Superclass;
00073   typedef SmartPointer< Self >                    Pointer;
00074   typedef SmartPointer< const Self >              ConstPointer;
00075 
00076   itkNewMacro ( Self );
00077 
00078   itkTypeMacro ( QuadEdgeMeshNormalFilter,
00079                  QuadEdgeMeshToQuadEdgeMeshFilter );
00080 
00081   typedef TInputMesh                                InputMeshType;
00082   typedef typename InputMeshType::Pointer           InputMeshPointer;
00083   typedef typename InputMeshType::PointIdentifier   InputPointIdentifier;
00084   typedef typename InputMeshType::PointType         InputPointType;
00085   typedef typename InputMeshType::VectorType        InputVectorType;
00086   typedef typename InputMeshType::QEType            InputQEType;
00087 
00088   typedef TOutputMesh                               OutputMeshType;
00089   typedef typename OutputMeshType::Pointer          OutputMeshPointer;
00090   typedef typename OutputMeshType::PointType        OutputPointType;
00091   typedef typename OutputPointType::VectorType      OutputVectorType;
00092   typedef typename OutputMeshType::QEType           OutputQEType;
00093   typedef typename OutputMeshType::PointIdentifier  OutputPointIdentifier;
00094   typedef typename OutputMeshType::PointIdIterator  OutputPointIdIterator;
00095   typedef typename OutputMeshType::PointsContainerPointer
00096                                                     OutputPointsContainerPointer;
00097   typedef typename OutputMeshType::PointsContainerIterator
00098                                                     OutputPointsContainerIterator;
00099   typedef typename OutputMeshType::CellType         OutputCellType;
00100   typedef typename OutputMeshType::CellIdentifier   OutputCellIdentifier;
00101   typedef typename OutputMeshType::CellAutoPointer  OutputCellAutoPointer;
00102   typedef typename OutputMeshType::CellsContainerConstIterator
00103                                                     OutputCellsContainerPointer;
00104   typedef typename OutputMeshType::CellsContainerConstIterator
00105                                                     OutputCellsContainerConstIterator;
00106 
00107   typedef TriangleHelper< OutputPointType >             TriangleType;
00108 
00109   typedef QuadEdgeMeshPolygonCell< OutputCellType >     OutputPolygonType;
00110   typedef typename OutputPolygonType::SelfAutoPointer   OutputPolygonAutoPointer;
00111 
00112   typedef typename OutputMeshType::CellDataContainer    OutputCellDataContainer;
00113   typedef typename OutputMeshType::PointDataContainer   OutputPointDataContainer;
00114 
00115   typedef typename OutputMeshType::MeshTraits           OutputMeshTraits;
00116   typedef typename OutputMeshTraits::PixelType          OutputVertexNormalType;
00117   typedef typename OutputVertexNormalType::ValueType    OutputVertexNormalComponentType;
00118 
00119   typedef typename OutputMeshTraits::CellPixelType      OutputFaceNormalType;
00120   typedef typename OutputFaceNormalType::ValueType      OutputFaceNormalComponentType;
00121 
00122   enum WeightType
00123     {
00124     GOURAUD = 0, // Uniform weights
00125     THURMER, // Angle on a triangle at the given vertex
00126     AREA
00127     };
00128 
00129   itkSetMacro ( Weight, WeightType );
00130   itkGetConstMacro ( Weight, WeightType );
00131 
00132 protected:
00133   QuadEdgeMeshNormalFilter( );
00134   ~QuadEdgeMeshNormalFilter( );
00135 
00136   WeightType m_Weight;
00137 
00144   OutputFaceNormalType ComputeFaceNormal ( OutputPolygonType* iPoly );
00145 
00150   void ComputeAllFaceNormals( );
00151 
00156   void ComputeAllVertexNormals( );
00157 
00162   OutputVertexNormalType ComputeVertexNormal (
00163     const OutputPointIdentifier& iId );
00164 
00168   OutputVertexNormalComponentType Weight ( const OutputPointIdentifier& iPId,
00169       const OutputCellIdentifier& iCId );
00170 
00175   void GenerateData( );
00176 
00177 private:
00178   QuadEdgeMeshNormalFilter ( const Self& );
00179   void operator = ( const Self& );
00180 };
00181 }
00182 
00183 #include "itkQuadEdgeMeshNormalFilter.txx"
00184 #endif
00185 

Generated at Mon Jul 12 2010 19:32:04 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000