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

itkQuadEdgeMeshDiscreteGaussianCurvatureEstimator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkQuadEdgeMeshDiscreteGaussianCurvatureEstimator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-10-01 21:40:25 $
00007   Version:   $Revision: 1.3 $
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 __itkQuadEdgeMeshDiscreteGaussianCurvatureEstimator_h
00019 #define __itkQuadEdgeMeshDiscreteGaussianCurvatureEstimator_h
00020 
00021 #include "itkQuadEdgeMeshDiscreteCurvatureEstimator.h"
00022 #include <vnl/vnl_math.h>
00023 
00024 //#include "itkTriangleHelper.h"
00025 
00026 namespace itk
00027 {
00037 template< class TInputMesh, class TOutputMesh >
00038 class QuadEdgeMeshDiscreteGaussianCurvatureEstimator :
00039   public QuadEdgeMeshDiscreteCurvatureEstimator< TInputMesh, TOutputMesh >
00040 {
00041 public:
00042   typedef QuadEdgeMeshDiscreteGaussianCurvatureEstimator        Self;
00043   typedef SmartPointer< Self >                                  Pointer;
00044   typedef SmartPointer< const Self >                            ConstPointer;
00045   typedef QuadEdgeMeshDiscreteCurvatureEstimator< 
00046     TInputMesh, TOutputMesh >                                   Superclass;
00047 
00048   typedef typename Superclass::InputMeshType                    InputMeshType;
00049   typedef typename Superclass::InputMeshPointer                 InputMeshPointer;
00050 
00051   typedef typename Superclass::OutputMeshType                   OutputMeshType;
00052   typedef typename Superclass::OutputMeshPointer                OutputMeshPointer;
00053   typedef typename Superclass::OutputPointsContainerPointer     OutputPointsContainerPointer;
00054   typedef typename Superclass::OutputPointsContainerIterator    OutputPointsContainerIterator;
00055   typedef typename Superclass::OutputPointType                  OutputPointType;
00056   typedef typename Superclass::OutputVectorType                 OutputVectorType;
00057   typedef typename Superclass::OutputCoordType                  OutputCoordType;
00058   typedef typename Superclass::OutputPointIdentifier            OutputPointIdentifier;
00059   typedef typename Superclass::OutputCellIdentifier             OutputCellIdentifier;
00060   typedef typename Superclass::OutputQEType                     OutputQEType;
00061   typedef typename Superclass::OutputMeshTraits                 OutputMeshTraits;
00062   typedef typename Superclass::OutputCurvatureType              OutputCurvatureType;
00063   typedef typename Superclass::TriangleType                     TriangleType;
00064   
00066   itkTypeMacro( QuadEdgeMeshDiscreteGaussianCurvatureEstimator, QuadEdgeMeshDiscreteCurvatureEstimator );
00067 
00069   itkNewMacro( Self );
00070 
00071 protected:
00072   QuadEdgeMeshDiscreteGaussianCurvatureEstimator() {}
00073   ~QuadEdgeMeshDiscreteGaussianCurvatureEstimator() {}
00074 
00075   virtual OutputCurvatureType EstimateCurvature( const OutputPointType& iP )
00076     {
00077     OutputMeshPointer output = this->GetOutput();
00078 
00079     OutputQEType* qe = iP.GetEdge( );
00080 
00081     if( qe != 0 )
00082       {
00083       OutputQEType* qe_it = qe;
00084       OutputQEType* qe_it2;
00085 
00086       OutputPointType q0, q1;
00087 
00088       OutputCurvatureType sum_theta = 0.;
00089       OutputCurvatureType area = 0.;
00090 
00091       do
00092         {
00093         // cell_id = qe_it->GetLeft();
00094         qe_it2 = qe_it->GetOnext();
00095         q0 = output->GetPoint( qe_it->GetDestination() );
00096         q1 = output->GetPoint( qe_it2->GetDestination() );
00097 
00098         // Compute Angle;
00099         sum_theta += static_cast< OutputCurvatureType >(
00100               TriangleType::ComputeAngle( q0, iP, q1 ) );
00101         area += ComputeMixedArea( qe_it, qe_it2 );
00102         qe_it = qe_it2;
00103         } while( qe_it != qe );
00104 
00105       return ( 2.0 * vnl_math::pi - sum_theta ) / area;
00106 
00107       }
00108 
00109     return 0.;
00110   
00111     }
00112 
00113 private:
00114   QuadEdgeMeshDiscreteGaussianCurvatureEstimator( const Self& ); // purposely not implemented
00115   void operator = ( const Self& ); // purposely not implemented
00116 
00117 };
00118 
00119 }
00120 
00121 #endif
00122 

Generated at Wed Nov 5 23:38:32 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000