// ========================================================================= // @author Leonardo Florez Valencia // @email florez-l@javeriana.edu.co // ========================================================================= #ifndef __fpa__Base__Functors__InvertValue__h__ #define __fpa__Base__Functors__InvertValue__h__ #include #include namespace fpa { namespace Base { namespace Functors { /** */ template< class _TInputValue, class _TOutputValue > class InvertValue : public itk::FunctionBase< _TInputValue, _TOutputValue > { public: typedef InvertValue Self; typedef itk::FunctionBase< _TInputValue, _TOutputValue > Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; typedef _TInputValue TInputValue; typedef _TOutputValue TOutputValue; public: itkNewMacro( Self ); itkTypeMacro( InvertValue, itk::FunctionBase ); itkGetConstMacro( Alpha, double ); itkGetConstMacro( Beta, double ); itkSetMacro( Alpha, double ); itkSetMacro( Beta, double ); public: virtual TOutputValue Evaluate( const TInputValue& a ) const override { double d = this->m_Alpha; d += std::pow( double( a ), this->m_Beta ); double x = -1; if( std::fabs( d ) > double( 0 ) ) x = double( 1 ) / ( this->m_Alpha + std::pow( double( a ), this->m_Beta ) ); return( TOutputValue( x ) ); } protected: InvertValue( ) : Superclass( ), m_Alpha( double( 1 ) ), m_Beta( double( 1 ) ) { } virtual ~InvertValue( ) { } private: InvertValue( const Self& other ); Self& operator=( const Self& other ); protected: double m_Alpha; double m_Beta; }; } // ecapseman } // ecapseman } // ecapseman #endif // __fpa__Base__Functors__InvertValue__h__ // eof - $RCSfile$