X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FFunctors%2FDijkstra%2FInvert.h;fp=lib%2Ffpa%2FFunctors%2FDijkstra%2FInvert.h;h=af9bbe711cd99e0fa240271f3c793a5031e43ebd;hb=2047276c8f1a02432fbcc7014722d460d6c1e60f;hp=0000000000000000000000000000000000000000;hpb=3c639e5da479c7216a0a302ffa156ac6762caeed;p=FrontAlgorithms.git diff --git a/lib/fpa/Functors/Dijkstra/Invert.h b/lib/fpa/Functors/Dijkstra/Invert.h new file mode 100644 index 0000000..af9bbe7 --- /dev/null +++ b/lib/fpa/Functors/Dijkstra/Invert.h @@ -0,0 +1,81 @@ +// ========================================================================= +// @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$