1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5 #ifndef __fpa__Functors__RegionGrow__BinaryThreshold__hxx__
6 #define __fpa__Functors__RegionGrow__BinaryThreshold__hxx__
10 // -------------------------------------------------------------------------
11 template< class _TValue >
12 void fpa::Functors::RegionGrow::BinaryThreshold< _TValue >::
13 ThresholdAbove( const TValue& a )
15 this->SetLowerThreshold( a );
16 this->SetUpperThreshold( std::numeric_limits< _TValue >::max( ) );
19 // -------------------------------------------------------------------------
20 template< class _TValue >
21 void fpa::Functors::RegionGrow::BinaryThreshold< _TValue >::
22 ThresholdBetween( const TValue& a, const TValue& b )
24 this->SetLowerThreshold( ( a < b )? a: b );
25 this->SetUpperThreshold( ( b < a )? a: b );
28 // -------------------------------------------------------------------------
29 template< class _TValue >
30 void fpa::Functors::RegionGrow::BinaryThreshold< _TValue >::
31 ThresholdBelow( const TValue& a )
33 if( std::numeric_limits< _TValue >::is_integer )
34 this->SetLowerThreshold( std::numeric_limits< _TValue >::min( ) );
36 this->SetLowerThreshold( -std::numeric_limits< _TValue >::max( ) );
37 this->SetUpperThreshold( a );
40 // -------------------------------------------------------------------------
41 template< class _TValue >
42 bool fpa::Functors::RegionGrow::BinaryThreshold< _TValue >::
43 Evaluate( const TValue& v ) const
46 return( this->m_LowerThreshold < v && v < this->m_UpperThreshold );
48 return( this->m_LowerThreshold <= v && v <= this->m_UpperThreshold );
51 // -------------------------------------------------------------------------
52 template< class _TValue >
53 fpa::Functors::RegionGrow::BinaryThreshold< _TValue >::
58 this->m_UpperThreshold = std::numeric_limits< _TValue >::max( );
59 if( std::numeric_limits< _TValue >::is_integer )
60 this->m_LowerThreshold = std::numeric_limits< _TValue >::min( );
62 this->m_LowerThreshold = -this->m_UpperThreshold;
65 // -------------------------------------------------------------------------
66 template< class _TValue >
67 fpa::Functors::RegionGrow::BinaryThreshold< _TValue >::
72 #endif // __fpa__Functors__RegionGrow__BinaryThreshold__hxx__