// ========================================================================= // @author Leonardo Florez Valencia // @email florez-l@javeriana.edu.co // ========================================================================= #ifndef __fpa__Image__Functors__Dijkstra__Gaussian__h__ #define __fpa__Image__Functors__Dijkstra__Gaussian__h__ #include #include namespace fpa { namespace Image { namespace Functors { namespace Dijkstra { /** */ template< class _TInputImage, class _TOutputValue > class Gaussian : public fpa::Image::Functors::Dijkstra::Function< _TInputImage, _TOutputValue > { public: typedef Gaussian 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::Gaussian, fpa::Image::Functors::Dijkstra::Function ); public: double GetAlpha( ) const { return( double( 1 ) - this->m_Alpha ); } double GetBeta( ) const { return( std::sqrt( this->m_Beta ) ); } void SetAlpha( const double& v ) { this->m_Alpha = double( 1 ) - v; this->Modified( ); } void SetBeta( const double& v ) { this->m_Beta = v * v; this->Modified( ); } virtual _TOutputValue Evaluate( const TVertex& v, const TVertex& p ) const override { double d = double( this->m_Image->GetPixel( v ) ); d -= double( this->m_Image->GetPixel( p ) ); d = ( d * d ) / this->m_Beta; return( _TOutputValue( double( 1 ) - ( this->m_Alpha * std::exp( -d ) ) ) ); } protected: Gaussian( ) : Superclass( ), m_Alpha( double( 1 ) ), m_Beta( double( 1 ) ) { } virtual ~Gaussian( ) { } private: // Purposely not implemented Gaussian( const Self& other ); Self& operator=( const Self& other ); protected: double m_Alpha; double m_Beta; }; } // ecapseman } // ecapseman } // ecapseman } // ecapseman #endif // __fpa__Image__Functors__Dijkstra__Gaussian__h__ // eof - $RCSfile$