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

itkRegularizedHeavisideStepFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkRegularizedHeavisideStepFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-05-09 21:06:28 $
00007   Version:   $Revision: 1.1 $
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 __itkRegularizedHeavisideStepFunction_h
00019 #define __itkRegularizedHeavisideStepFunction_h
00020 
00021 #include "itkHeavisideStepFunctionBase.h"
00022 #include "itkNumericTraits.h"
00023 #include "vnl/vnl_math.h"
00024 
00025 namespace itk
00026 {
00027 
00054 template< class TInput = float, class TOutput = double >
00055 class RegularizedHeavisideStepFunction : public HeavisideStepFunctionBase< TInput, TOutput >
00056 {
00057 public:
00058   typedef RegularizedHeavisideStepFunction                Self;
00059   typedef HeavisideStepFunctionBase< TInput, TOutput >    Superclass;
00060   typedef SmartPointer<Self>                              Pointer;
00061   typedef SmartPointer<const Self>                        ConstPointer;
00062 
00063   typedef typename Superclass::InputType                  InputType;
00064   typedef typename Superclass::OutputType                 OutputType;
00065 
00066   typedef typename NumericTraits< InputType >::RealType            RealType;
00067 
00069   virtual OutputType Evaluate( const InputType& input ) const = 0;
00070 
00072   virtual OutputType EvaluateDerivative( const InputType& input ) const = 0;
00073 
00074   void SetEpsilon( const RealType & ieps )
00075     {
00076     this->m_Epsilon = ieps;
00077 
00078     if ( ieps > vnl_math::eps )
00079       {
00080       m_OneOverEpsilon = 1.0 / ieps;
00081       }
00082     else
00083       {
00084       itkGenericExceptionMacro("ERROR: Epsilon needs to be greater than " << vnl_math::eps );
00085       }
00086     }
00087 
00088   RealType GetEpsilon() const
00089     {
00090     return this->m_Epsilon;
00091     }
00092 
00093   RealType GetOneOverEpsilon() const
00094     {
00095     return this->m_OneOverEpsilon;
00096     }
00097 
00098 protected:
00099   RegularizedHeavisideStepFunction()
00100     {
00101     this->m_Epsilon = 1.0;
00102     this->m_OneOverEpsilon = 1.0;
00103     }
00104 
00105   virtual ~RegularizedHeavisideStepFunction() {}
00106 
00107 private:
00108   RegularizedHeavisideStepFunction(const Self& ); //purposely not implemented
00109   void operator=(const Self& ); //purposely not implemented
00110 
00111   RealType      m_Epsilon;
00112   RealType      m_OneOverEpsilon;
00113 };
00114 
00115 }
00116 
00117 #endif
00118 

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