]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/Functors/RegionGrow/BinaryThreshold.hxx
97cf465a2ab811479afd5b3bf92c337a5c6d6b99
[FrontAlgorithms.git] / lib / 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 >
8 bool fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage >::
9 Evaluate( const TIndex& a, const TIndex& b ) const
10 {
11   const _TImage* im =
12     dynamic_cast< const _TImage* >( this->m_Image.GetPointer( ) );
13   if( im != NULL )
14   {
15     TPixel v = im->GetPixel( b );
16     return( this->m_Lower <= v && v <= this->m_Upper );
17   }
18   else
19     return( false );
20 }
21
22 // -------------------------------------------------------------------------
23 template< class _TImage >
24 fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage >::
25 BinaryThreshold( )
26   : Superclass( )
27 {
28   this->m_Upper = std::numeric_limits< TPixel >::max( );
29   if( std::numeric_limits< TPixel >::is_integer )
30     this->m_Lower = std::numeric_limits< TPixel >::min( );
31   else
32     this->m_Lower = -this->m_Upper;
33 }
34
35 // -------------------------------------------------------------------------
36 template< class _TImage >
37 fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage >::
38 ~BinaryThreshold( )
39 {
40 }
41
42 #endif // __fpa__Image__Functors__RegionGrow__BinaryThreshold__hxx__
43
44 // eof - $RCSfile$