]> Creatis software - FrontAlgorithms.git/blob - libs/fpa/Image/Functors/RegionGrow/BinaryThreshold.hxx
b41db088b022025d1754ecb28cafcf8c6930c2f0
[FrontAlgorithms.git] / libs / fpa / Image / Functors / RegionGrow / BinaryThreshold.hxx
1 #ifndef __fpa__Image__Functors__RegionGrow__BinaryThreshold__hxx__
2 #define __fpa__Image__Functors__RegionGrow__BinaryThreshold__hxx__
3
4 #include <limits>
5
6 // -------------------------------------------------------------------------
7 template< class _TImage, class _TOutput >
8 _TOutput
9 fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage, _TOutput >::
10 Evaluate( const TIndex& a, const TIndex& b ) const
11 {
12   const _TImage* im =
13     dynamic_cast< const _TImage* >( this->m_Image.GetPointer( ) );
14   if( im != NULL )
15   {
16     TPixel v = im->GetPixel( b );
17
18     std::cout << a << " " << v << " " << this->m_Lower << " " << this->m_Upper << std::endl;
19
20     return(
21       ( this->m_Lower < v && v < this->m_Upper )?
22       this->m_InsideValue:
23       this->m_OutsideValue
24       );
25   }
26   else
27     return( this->m_OutsideValue );
28 }
29
30 // -------------------------------------------------------------------------
31 template< class _TImage, class _TOutput >
32 fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage, _TOutput >::
33 BinaryThreshold( )
34   : Superclass( )
35 {
36   this->m_Upper = std::numeric_limits< TPixel >::max( );
37   if( std::numeric_limits< TPixel >::is_integer )
38     this->m_Lower = std::numeric_limits< TPixel >::min( );
39   else
40     this->m_Lower = -this->m_Upper;
41 }
42
43 // -------------------------------------------------------------------------
44 template< class _TImage, class _TOutput >
45 fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage, _TOutput >::
46 ~BinaryThreshold( )
47 {
48 }
49
50 #endif // __fpa__Image__Functors__RegionGrow__BinaryThreshold__hxx__
51
52 // eof - $RCSfile$