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: 2008-10-03 21:30:29 $
00007   Version:   $Revision: 1.2 $
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 {
00037 template< class TInputMesh, class TOutputMesh >
00038 class QuadEdgeMeshNormalFilter :
00039   public QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh >
00040 {
00041 public:
00042   typedef QuadEdgeMeshNormalFilter                Self;
00043   typedef QuadEdgeMeshToQuadEdgeMeshFilter< 
00044     TInputMesh, TOutputMesh >                     Superclass;
00045   typedef SmartPointer< Self >                    Pointer;
00046   typedef SmartPointer< const Self >              ConstPointer;
00047 
00048   itkNewMacro ( Self );
00049 
00050   itkTypeMacro ( QuadEdgeMeshNormalFilter,
00051                  QuadEdgeMeshToQuadEdgeMeshFilter );
00052 
00053   typedef TInputMesh                                InputMeshType;
00054   typedef typename InputMeshType::Pointer           InputMeshPointer;
00055   typedef typename InputMeshType::PointIdentifier   InputPointIdentifier;
00056   typedef typename InputMeshType::PointType         InputPointType;
00057   typedef typename InputMeshType::VectorType        InputVectorType;
00058   typedef typename InputMeshType::QEType            InputQEType;
00059 
00060   typedef TOutputMesh                               OutputMeshType;
00061   typedef typename OutputMeshType::Pointer          OutputMeshPointer;
00062   typedef typename OutputMeshType::PointType        OutputPointType;
00063   typedef typename OutputPointType::VectorType      OutputVectorType;
00064   typedef typename OutputMeshType::QEType           OutputQEType;
00065   typedef typename OutputMeshType::PointIdentifier  OutputPointIdentifier;
00066   typedef typename OutputMeshType::PointIdIterator  OutputPointIdIterator;
00067   typedef typename OutputMeshType::PointsContainerPointer
00068                                                     OutputPointsContainerPointer;
00069   typedef typename OutputMeshType::PointsContainerIterator
00070                                                     OutputPointsContainerIterator;
00071   typedef typename OutputMeshType::CellType         OutputCellType;
00072   typedef typename OutputMeshType::CellIdentifier   OutputCellIdentifier;
00073   typedef typename OutputMeshType::CellAutoPointer  OutputCellAutoPointer;
00074   typedef typename OutputMeshType::CellsContainerConstIterator
00075                                                     OutputCellsContainerPointer;
00076   typedef typename OutputMeshType::CellsContainerConstIterator
00077                                                     OutputCellsContainerConstIterator;
00078 
00079   typedef TriangleHelper< OutputPointType >             TriangleType;
00080 
00081   typedef QuadEdgeMeshPolygonCell< OutputCellType >     OutputPolygonType;
00082   typedef typename OutputPolygonType::SelfAutoPointer   OutputPolygonAutoPointer;
00083 
00084   typedef typename OutputMeshType::CellDataContainer    OutputCellDataContainer;
00085   typedef typename OutputMeshType::PointDataContainer   OutputPointDataContainer;
00086 
00087   typedef typename OutputMeshType::MeshTraits           OutputMeshTraits;
00088   typedef typename OutputMeshTraits::PixelType          OutputVertexNormalType;
00089   typedef typename OutputVertexNormalType::ValueType    OutputVertexNormalComponentType;
00090 
00091   typedef typename OutputMeshTraits::CellPixelType      OutputFaceNormalType;
00092   typedef typename OutputFaceNormalType::ValueType      OutputFaceNormalComponentType;
00093 
00094   enum WeightType
00095     {
00096     GOURAUD = 0, // Uniform weights
00097     THURMER, // Angle on a triangle at the given vertex
00098     AREA
00099     };
00100 
00101   itkSetMacro ( Weight, WeightType );
00102   itkGetMacro ( Weight, WeightType );
00103 
00104 protected:
00105   QuadEdgeMeshNormalFilter( );
00106   ~QuadEdgeMeshNormalFilter( );
00107 
00108   WeightType m_Weight;
00109 
00116   OutputFaceNormalType ComputeFaceNormal ( OutputPolygonType* iPoly );
00117 
00122   void ComputeAllFaceNormals( );
00123 
00128   void ComputeAllVertexNormals( );
00129 
00134   OutputVertexNormalType ComputeVertexNormal (
00135     const OutputPointIdentifier& iId );
00136 
00140   OutputVertexNormalComponentType Weight ( const OutputPointIdentifier& iPId,
00141       const OutputCellIdentifier& iCId );
00142 
00147   void GenerateData( );
00148 
00149 private:
00150   QuadEdgeMeshNormalFilter ( const Self& );
00151   void operator = ( const Self& );
00152 };
00153 }
00154 
00155 #include "itkQuadEdgeMeshNormalFilter.txx"
00156 #endif
00157 

Generated at Sat Feb 28 13:20:40 2009 for ITK by doxygen 1.5.6 written by Dimitri van Heesch, © 1997-2000