]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/Functors/RegionGrow/BinaryThreshold.hxx
...
[FrontAlgorithms.git] / lib / fpa / Image / Functors / RegionGrow / BinaryThreshold.hxx
index 97cf465a2ab811479afd5b3bf92c337a5c6d6b99..7f2b9dca99bc40f2e4b78cfdbe6a95d0ab3137ec 100644 (file)
@@ -4,8 +4,9 @@
 #include <limits>
 
 // -------------------------------------------------------------------------
-template< class _TImage >
-bool fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage >::
+template< class _TImage, class _TOutput >
+_TOutput
+fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage, _TOutput >::
 Evaluate( const TIndex& a, const TIndex& b ) const
 {
   const _TImage* im =
@@ -13,15 +14,19 @@ Evaluate( const TIndex& a, const TIndex& b ) const
   if( im != NULL )
   {
     TPixel v = im->GetPixel( b );
-    return( this->m_Lower <= v && v <= this->m_Upper );
+    return(
+      ( this->m_Lower < v && v < this->m_Upper )?
+      this->m_InsideValue:
+      this->m_OutsideValue
+      );
   }
   else
-    return( false );
+    return( this->m_OutsideValue );
 }
 
 // -------------------------------------------------------------------------
-template< class _TImage >
-fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage >::
+template< class _TImage, class _TOutput >
+fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage, _TOutput >::
 BinaryThreshold( )
   : Superclass( )
 {
@@ -33,8 +38,8 @@ BinaryThreshold( )
 }
 
 // -------------------------------------------------------------------------
-template< class _TImage >
-fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage >::
+template< class _TImage, class _TOutput >
+fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage, _TOutput >::
 ~BinaryThreshold( )
 {
 }