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

itkExpNegativeImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkExpNegativeImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/09/27 11:36:40 $
00007   Version:   $Revision: 1.8 $
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 #ifndef __itkExpNegativeImageFilter_h
00018 #define __itkExpNegativeImageFilter_h
00019 
00020 #include "itkUnaryFunctorImageFilter.h"
00021 #include "vnl/vnl_math.h"
00022 
00023 namespace itk
00024 {
00025   
00036 namespace Function {  
00037 template< class TInput, class TOutput>
00038 class ExpNegative
00039 {
00040 public:
00041   ExpNegative() { m_Factor = 1.0; }
00042   ~ExpNegative() {};
00043 
00044   bool operator!=( const ExpNegative & other ) const
00045   {
00046     if( m_Factor != other.m_Factor )
00047       {
00048       return true;
00049       }
00050     return false;
00051   }
00052   bool operator==( const ExpNegative & other ) const
00053   {
00054     return !(*this != other);
00055   }
00056   
00057   inline TOutput operator()( const TInput & A )
00058   {
00059     return static_cast<TOutput>( vcl_exp(- m_Factor * static_cast<double>(A) ) );
00060   }
00061 
00062   void SetFactor( double factor ) {
00063     m_Factor = factor;
00064   }
00065   double GetFactor() const {
00066     return m_Factor;
00067   }
00068 private:
00069   double  m_Factor;
00070 }; 
00071 }
00072 template <class TInputImage, class TOutputImage>
00073 class ITK_EXPORT ExpNegativeImageFilter :
00074     public
00075 UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00076                         Function::ExpNegative< 
00077   typename TInputImage::PixelType, 
00078   typename TOutputImage::PixelType>   >
00079 {
00080 public:
00082   typedef ExpNegativeImageFilter  Self;
00083   typedef UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00084                                   Function::ExpNegative< typename TInputImage::PixelType, 
00085                                                          typename TOutputImage::PixelType> >  Superclass;
00086   typedef SmartPointer<Self>   Pointer;
00087   typedef SmartPointer<const Self>  ConstPointer;
00088 
00090   itkNewMacro(Self);
00091 
00093   itkTypeMacro(ExpNegativeImageFilter, 
00094                UnaryFunctorImageFilter);
00095 
00096   void SetFactor( double factor )
00097   {
00098     if( factor == this->GetFunctor().GetFactor() ) 
00099       {
00100       return;
00101       }
00102     this->GetFunctor().SetFactor( factor );
00103     this->Modified();
00104   }
00105 
00106 #ifdef ITK_USE_CONCEPT_CHECKING
00107 
00108   itkConceptMacro(InputConvertibleToDoubleCheck,
00109     (Concept::Convertible<typename TInputImage::PixelType, double>));
00110   itkConceptMacro(DoubleConvertibleToOutputCheck,
00111     (Concept::Convertible<double, typename TOutputImage::PixelType>));
00112 
00114 #endif
00115 
00116 protected:
00117   ExpNegativeImageFilter() {}
00118   virtual ~ExpNegativeImageFilter() {}
00119 
00120 private:
00121   ExpNegativeImageFilter(const Self&); //purposely not implemented
00122   void operator=(const Self&); //purposely not implemented
00123 
00124 };
00125 
00126 } // end namespace itk
00127 
00128 
00129 #endif
00130 

Generated at Tue Jul 29 19:53:35 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000