00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkAtanRegularizedHeavisideStepFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-05-09 21:12:23 $ 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 __itkAtanRegularizedHeavisideStepFunction_h 00019 #define __itkAtanRegularizedHeavisideStepFunction_h 00020 00021 #include "itkRegularizedHeavisideStepFunction.h" 00022 00023 namespace itk 00024 { 00025 00052 template< class TInput = float, class TOutput = double > 00053 class AtanRegularizedHeavisideStepFunction : 00054 public RegularizedHeavisideStepFunction< TInput, TOutput > 00055 { 00056 public: 00057 typedef AtanRegularizedHeavisideStepFunction 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( AtanRegularizedHeavisideStepFunction, 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 return 0.5 + ( vnl_math::one_over_pi * vcl_atan( input * this->GetOneOverEpsilon() ) ); 00074 } 00075 00077 virtual OutputType EvaluateDerivative( const InputType& input ) const 00078 { 00079 const RealType t = ( input * this->GetOneOverEpsilon() ); 00080 return static_cast< OutputType>( vnl_math::one_over_pi / (1.0 + t * t ) ); 00081 } 00083 00084 protected: 00085 AtanRegularizedHeavisideStepFunction() {} 00086 virtual ~AtanRegularizedHeavisideStepFunction() {} 00087 00088 private: 00089 AtanRegularizedHeavisideStepFunction(const Self& ); //purposely not implemented 00090 void operator=(const Self& ); //purposely not implemented 00091 00092 }; 00093 00094 } 00095 00096 #endif 00097