// ========================================================================= // @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 { /** * w_{i,j}=\left(\exp\left(\left(\frac{w_{i}-w_{j}}{\beta}\right)^{2}\right)-1\right)^{\alpha} */ 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 ); itkGetConstMacro( Alpha, double ); itkSetMacro( Alpha, double ); itkGetConstMacro( Beta, double ); itkSetMacro( Beta, double ); public: 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 /= this->m_Beta; d = std::exp( d * d ) - double( 1 ); return( _TOutputValue( std::pow( d, this->m_Alpha ) ) ); } 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$