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

itkSinRegularizedHeavisideStepFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkSinRegularizedHeavisideStepFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-06-08 04:17:06 $
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 __itkSinRegularizedHeavisideStepFunction_h
00019 #define __itkSinRegularizedHeavisideStepFunction_h
00020 
00021 #include "itkRegularizedHeavisideStepFunction.h"
00022 
00023 namespace itk
00024 {
00025 
00052 template< class TInput = float, class TOutput = double >
00053 class SinRegularizedHeavisideStepFunction : 
00054  public RegularizedHeavisideStepFunction< TInput, TOutput >
00055 {
00056 public:
00057   typedef SinRegularizedHeavisideStepFunction                   Self;
00058   typedef RegularizedHeavisideStepFunction< TInput, TOutput >   Superclass;
00059   typedef SmartPointer<Self>                                    Pointer;
00060   typedef SmartPointer<const Self>                              ConstPointer;
00061 
00062   itkNewMacro( Self );
00063  
00064   itkTypeMacro( SinRegularizedHeavisideStepFunction, RegularizedHeavisideStepFunction );
00065 
00066   typedef typename Superclass::InputType                        InputType;
00067   typedef typename Superclass::OutputType                       OutputType;
00068   typedef typename Superclass::RealType                         RealType;
00069 
00071   virtual OutputType Evaluate( const InputType& input ) const
00072     {
00073     if( input >= this->GetEpsilon() )
00074       {
00075       return 1.0;
00076       }
00077     else
00078       {
00079       if( input <= -this->GetEpsilon() )
00080         {
00081         return 0.0;
00082         }
00083       else
00084         {
00085         const RealType angleFactor = 0.5 * vnl_math::pi * this->GetOneOverEpsilon();
00086         const RealType angle = input * angleFactor;
00087         return 0.5 * ( 1.0 + vcl_sin( angle ) );
00088         }
00089       }
00090     }
00092 
00094   virtual OutputType EvaluateDerivative( const InputType& input ) const
00095     {
00096     if( vnl_math_abs( input ) >= this->GetEpsilon() )
00097       {
00098       return 0.0;
00099       }
00100     else
00101       {
00102       const RealType angleFactor = 0.5 * vnl_math::pi * this->GetOneOverEpsilon();
00103       const RealType angle = input * angleFactor;
00104       return 0.5 * angleFactor * vcl_cos( angle );
00105       }
00106     }
00108 
00109 protected:
00110   SinRegularizedHeavisideStepFunction() {}
00111   virtual ~SinRegularizedHeavisideStepFunction() {}
00112 
00113 private:
00114   SinRegularizedHeavisideStepFunction(const Self& ); //purposely not implemented
00115   void operator=(const Self& ); //purposely not implemented
00116 
00117 };
00118 
00119 }
00120 
00121 #endif
00122 

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