1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5 #ifndef __fpa__Functors__Dijkstra__Image__Gaussian__h__
6 #define __fpa__Functors__Dijkstra__Image__Gaussian__h__
9 #include <fpa/Functors/VertexFunction.h>
21 template< class _TImage, class _TValue >
23 : public fpa::Functors::VertexFunction< typename _TImage::IndexType, _TValue >
26 typedef _TImage TImage;
27 typedef _TValue TValue;
28 typedef typename TImage::IndexType TVertex;
29 typedef fpa::Functors::VertexFunction< TVertex, TValue > Superclass;
30 typedef Gaussian Self;
31 typedef itk::SmartPointer< Self > Pointer;
32 typedef itk::SmartPointer< const Self > ConstPointer;
37 fpa::Functors::Dijkstra::Image::Gaussian,
38 fpa::Functors::VertexFunction
41 itkGetConstMacro( Beta, TValue );
42 itkSetMacro( Beta, TValue );
44 itkGetConstMacro( Epsilon, TValue );
45 itkSetMacro( Epsilon, TValue );
47 itkBooleanMacro( TreatAsWeight );
48 itkGetConstMacro( TreatAsWeight, bool );
49 itkSetMacro( TreatAsWeight, bool );
52 virtual TValue Evaluate(
53 const TVertex& v, const TVertex& p
57 dynamic_cast< const TImage* >(
58 this->m_DataObject.GetPointer( )
62 TValue d = TValue( image->GetPixel( v ) );
63 d -= TValue( image->GetPixel( p ) );
65 if( this->m_TreatAsWeight ) d = std::exp( d * d ) - TValue( 1 );
66 else d = std::exp( -std::fabs( d ) );
68 if( d < this->m_Epsilon ) return( this->m_Epsilon );
72 return( TValue( -1 ) );
78 m_Beta( TValue( 1 ) ),
79 m_Epsilon( TValue( 1e-5 ) ),
80 m_TreatAsWeight( true )
88 // Purposely not implemented.
89 Gaussian( const Self& other );
90 Self& operator=( const Self& other );
106 #endif // __fpa__Functors__Dijkstra__Gaussian__h__