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: 2009-04-01 14:36:19 $
00007   Version:   $Revision: 1.10 $
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 ) const
00058     {
00059     return static_cast<TOutput>( vcl_exp(- m_Factor * static_cast<double>(A) ) );
00060     }
00061 
00062   void SetFactor( double factor )
00063     {
00064     m_Factor = factor;
00065     }
00066   double GetFactor() const
00067     {
00068     return m_Factor;
00069     }
00070 private:
00071   double  m_Factor;
00072 }; 
00073 }
00074 template <class TInputImage, class TOutputImage>
00075 class ITK_EXPORT ExpNegativeImageFilter :
00076     public
00077 UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00078                         Function::ExpNegative< 
00079   typename TInputImage::PixelType, 
00080   typename TOutputImage::PixelType>   >
00081 {
00082 public:
00084   typedef ExpNegativeImageFilter                                Self;
00085   typedef UnaryFunctorImageFilter<
00086     TInputImage,TOutputImage, 
00087     Function::ExpNegative< typename TInputImage::PixelType, 
00088                            typename TOutputImage::PixelType> >  Superclass;
00089   typedef SmartPointer<Self>                                    Pointer;
00090   typedef SmartPointer<const Self>                              ConstPointer;
00091 
00093   itkNewMacro(Self);
00094 
00096   itkTypeMacro(ExpNegativeImageFilter, 
00097                UnaryFunctorImageFilter);
00098 
00099   void SetFactor( double factor )
00100     {
00101     if( factor == this->GetFunctor().GetFactor() ) 
00102       {
00103       return;
00104       }
00105     this->GetFunctor().SetFactor( factor );
00106     this->Modified();
00107     }
00108 
00109 #ifdef ITK_USE_CONCEPT_CHECKING
00110 
00111   itkConceptMacro(InputConvertibleToDoubleCheck,
00112     (Concept::Convertible<typename TInputImage::PixelType, double>));
00113   itkConceptMacro(DoubleConvertibleToOutputCheck,
00114     (Concept::Convertible<double, typename TOutputImage::PixelType>));
00115 
00117 #endif
00118 
00119 protected:
00120   ExpNegativeImageFilter() {}
00121   virtual ~ExpNegativeImageFilter() {}
00122 
00123 private:
00124   ExpNegativeImageFilter(const Self&); //purposely not implemented
00125   void operator=(const Self&); //purposely not implemented
00126 
00127 };
00128 
00129 } // end namespace itk
00130 
00131 
00132 #endif
00133 

Generated at Thu May 28 09:53:11 2009 for ITK by doxygen 1.5.5 written by Dimitri van Heesch, © 1997-2000