]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/Functors/GaussianWeight.h
...
[FrontAlgorithms.git] / lib / fpa / Image / Functors / GaussianWeight.h
index 3b2212a75ce15ab2005a04f50956ae3c44ba2b67..aaf6209c4fc534fcb95d3aa262d21d19a09530bd 100644 (file)
@@ -38,8 +38,11 @@ namespace fpa
           fpa::Image::Functors::VertexParentBase
           );
 
+        itkBooleanMacro( Invert );
         itkGetConstMacro( Beta, double );
+        itkGetConstMacro( Invert, bool );
         itkSetMacro( Beta, double );
+        itkSetMacro( Invert, bool );
 
       public:
         virtual TOutputValue Evaluate(
@@ -49,12 +52,17 @@ namespace fpa
             double va = double( this->m_Image->GetPixel( a ) );
             double vp = double( this->m_Image->GetPixel( p ) );
             double d = va - vp;
-            return( TOutputValue( std::exp( -d * d * this->m_Beta ) ) );
+            d = ( d * d ) / this->m_Beta;
+            if( this->m_Invert )
+              return( TOutputValue( double( 1 ) - std::exp( -d ) ) );
+            else
+              return( TOutputValue( std::exp( -d ) ) );
           }
 
       protected:
         GaussianWeight( )
           : Superclass( ),
+            m_Invert( false ),
             m_Beta( double( 1 ) )
           { }
         virtual ~GaussianWeight( ) { }
@@ -64,6 +72,7 @@ namespace fpa
         Self& operator=( const Self& other );
 
       protected:
+        bool   m_Invert;
         double m_Beta;
       };