00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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 inline TOutput
operator()(
const TInput & A )
00044 {
00045
return static_cast<TOutput>( exp( - m_Factor * static_cast<double>(A) ) );
00046 }
00047 void SetFactor(
double factor ) {
00048 m_Factor = factor;
00049 }
00050 double GetFactor()
const {
00051
return m_Factor;
00052 }
00053
private:
00054
double m_Factor;
00055 };
00056 }
00057
template <
class TInputImage,
class TOutputImage>
00058 class ITK_EXPORT ExpNegativeImageFilter :
00059
public
00060
UnaryFunctorImageFilter<TInputImage,TOutputImage,
00061 Function::ExpNegative<
00062 typename TInputImage::PixelType,
00063 typename TOutputImage::PixelType> >
00064 {
00065
public:
00067 typedef ExpNegativeImageFilter
Self;
00068
typedef UnaryFunctorImageFilter<TInputImage,TOutputImage,
00069
Function::ExpNegative<
typename TInputImage::PixelType,
00070 typename TOutputImage::PixelType> >
Superclass;
00071 typedef SmartPointer<Self> Pointer;
00072 typedef SmartPointer<const Self> ConstPointer;
00073
00075
itkNewMacro(
Self);
00076
00077 void SetFactor(
double factor )
00078 {
00079
if( factor == this->GetFunctor().GetFactor() )
00080 {
00081
return;
00082 }
00083 this->GetFunctor().SetFactor( factor );
00084 this->Modified();
00085 }
00086
protected:
00087 ExpNegativeImageFilter() {}
00088 virtual ~ExpNegativeImageFilter() {}
00089
00090
private:
00091 ExpNegativeImageFilter(
const Self&);
00092
void operator=(
const Self&);
00093
00094 };
00095
00096 }
00097
00098
00099
#endif