#ifndef __FPA__BASE__FUNCTORS__INVERTCOSTFUNCTION__H__
#define __FPA__BASE__FUNCTORS__INVERTCOSTFUNCTION__H__
+#include <cmath>
#include <itkFunctionBase.h>
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
{
- return( C( 1 ) / ( C( 0 ) + 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( std::pow( C( -1 ) / ( C( 1 ) - a ), this->m_Beta ) );
}
protected:
InvertCostFunction( )
- : Superclass( )
+ : Superclass( ),
+ m_Alpha( C( 1 ) ),
+ m_Beta( C( 1 ) )
{ }
virtual ~InvertCostFunction( )
{ }
// Purposely not implemented
InvertCostFunction( const Self& );
void operator=( const Self& );
+
+ protected:
+ C m_Alpha;
+ C m_Beta;
};
} // ecapseman