// ========================================================================= // @author Leonardo Florez Valencia // @email florez-l@javeriana.edu.co // ========================================================================= #ifndef __fpa__Image__Functors__Dijkstra__Invert__h__ #define __fpa__Image__Functors__Dijkstra__Invert__h__ #include #include namespace fpa { namespace Image { namespace Functors { namespace Dijkstra { /** */ template< class _TInputImage, class _TOutputValue > class Invert : public fpa::Image::Functors::Dijkstra::Function< _TInputImage, _TOutputValue > { public: typedef Invert Self; typedef fpa::Image::Functors::Dijkstra::Function< _TInputImage, _TOutputValue > Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; typedef typename Superclass::TVertex TVertex; public: itkNewMacro( Self ); itkTypeMacro( fpa::Image::Functors::Dijkstra::Invert, fpa::Image::Functors::Dijkstra::Function ); itkGetConstMacro( Alpha, double ); itkGetConstMacro( Beta, double ); itkSetMacro( Alpha, double ); itkSetMacro( Beta, double ); public: virtual _TOutputValue Evaluate( const TVertex& v, const TVertex& p ) const override { double a = double( this->m_Image->GetPixel( 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( _TOutputValue( 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 } // ecapseman #endif // __fpa__Image__Functors__Dijkstra__Invert__h__ // eof - $RCSfile$