// ========================================================================= // @author Leonardo Florez Valencia // @email florez-l@javeriana.edu.co // ========================================================================= #ifndef __fpa__Functors__Dijkstra__Invert__h__ #define __fpa__Functors__Dijkstra__Invert__h__ #include namespace fpa { namespace Functors { namespace Dijkstra { /** */ template< class _TValue > class Invert : public itk::FunctionBase< _TValue, _TValue > { public: typedef _TValue TValue; typedef itk::FunctionBase< _TValue, _TValue > Superclass; typedef Invert Self; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; public: itkNewMacro( Self ); itkTypeMacro( fpa::Functors::Dijkstra::Invert, itk::FunctionBase ); itkGetConstMacro( Alpha, double ); itkSetMacro( Alpha, double ); itkGetConstMacro( Beta, double ); itkSetMacro( Beta, double ); public: virtual TValue Evaluate( const TValue& v ) const override { double a = double( v ); 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( TValue( x ) ); } protected: Invert( ) : Superclass( ), m_Alpha( double( 1 ) ), m_Beta( double( 1 ) ) { } virtual ~Invert( ) { } private: // Purposely not implemented. Invert( const Self& other ); Self& operator=( const Self& other ); protected: double m_Alpha; double m_Beta; }; } // ecapseman } // ecapseman } // ecapseman #endif // __fpa__Functors__Dijkstra__Invert__h__ // eof - $RCSfile$