X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FFunctors%2FInvertCostFunction.h;h=22644adb38d9ef4c70f3c0b4052b3bda719c7ea2;hb=aaeabf9e79b8db1b97bc3381e95e46c77da4d891;hp=fa04ed4841625428bb0d84e4988e59040d5d8c68;hpb=5b7ed1fdb6665dd1ebc4451062a5032d75597e4a;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/Functors/InvertCostFunction.h b/lib/fpa/Base/Functors/InvertCostFunction.h index fa04ed4..22644ad 100644 --- a/lib/fpa/Base/Functors/InvertCostFunction.h +++ b/lib/fpa/Base/Functors/InvertCostFunction.h @@ -1,6 +1,7 @@ #ifndef __FPA__BASE__FUNCTORS__INVERTCOSTFUNCTION__H__ #define __FPA__BASE__FUNCTORS__INVERTCOSTFUNCTION__H__ +#include #include namespace fpa @@ -26,18 +27,27 @@ namespace fpa itkNewMacro( Self ); itkTypeMacro( InvertCostFunction, itkFunctionBase ); + itkGetConstMacro( Alpha, C ); + itkGetConstMacro( Beta, C ); + + itkSetMacro( Alpha, C ); + itkSetMacro( Beta, C ); + public: - virtual C Evaluate( const C& input ) const + virtual C Evaluate( const C& input ) const ITK_OVERRIDE { - if( input < C( 0 ) ) - return( C( -1 ) / ( C( 1 ) + C( input ) ) ); + C a = std::pow( input, this->m_Alpha ); + if( input >= C( 0 ) ) + return( std::pow( C( 1 ) / ( C( 1 ) + a ), this->m_Beta ) ); else - return( C( 1 ) / ( C( 1 ) + C( input ) ) ); + return( std::pow( C( -1 ) / ( C( 1 ) - a ), this->m_Beta ) ); } protected: InvertCostFunction( ) - : Superclass( ) + : Superclass( ), + m_Alpha( C( 1 ) ), + m_Beta( C( 1 ) ) { } virtual ~InvertCostFunction( ) { } @@ -46,6 +56,10 @@ namespace fpa // Purposely not implemented InvertCostFunction( const Self& ); void operator=( const Self& ); + + protected: + C m_Alpha; + C m_Beta; }; } // ecapseman