00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkHeavisideStepFunction.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 __itkHeavisideStepFunction_h 00019 #define __itkHeavisideStepFunction_h 00020 00021 #include "itkHeavisideStepFunctionBase.h" 00022 00023 namespace itk 00024 { 00025 00057 template< class TInput = float, class TOutput = double > 00058 class HeavisideStepFunction : 00059 public HeavisideStepFunctionBase< TInput, TOutput > 00060 { 00061 public: 00062 typedef HeavisideStepFunction Self; 00063 typedef HeavisideStepFunctionBase< TInput, TOutput > Superclass; 00064 typedef SmartPointer<Self> Pointer; 00065 typedef SmartPointer<const Self> ConstPointer; 00066 00067 itkNewMacro( Self ); 00068 00069 itkTypeMacro( HeavisideStepFunction, HeavisideStepFunctionBase ); 00070 00071 typedef typename Superclass::InputType InputType; 00072 typedef typename Superclass::OutputType OutputType; 00073 00075 virtual OutputType Evaluate( const InputType& input ) const 00076 { 00077 return ( input >= 0.0 ) ? 1.0 : 0.0; 00078 } 00079 00081 virtual OutputType EvaluateDerivative( const InputType& input ) const 00082 { 00083 return ( input == 0.0 ) ? 1.0 : 0.0; 00084 } 00085 00086 protected: 00087 HeavisideStepFunction() {} 00088 virtual ~HeavisideStepFunction() {} 00089 00090 private: 00091 HeavisideStepFunction(const Self& ); //purposely not implemented 00092 void operator=(const Self& ); //purposely not implemented 00093 00094 }; 00095 00096 } 00097 00098 #endif 00099