// ========================================================================= // @author Leonardo Florez Valencia // @email florez-l@javeriana.edu.co // ========================================================================= #ifndef __fpa__Functors__RegionGrow__BinaryThreshold__hxx__ #define __fpa__Functors__RegionGrow__BinaryThreshold__hxx__ #include // ------------------------------------------------------------------------- template< class _TValue > void fpa::Functors::RegionGrow::BinaryThreshold< _TValue >:: ThresholdAbove( const TValue& a ) { this->SetLowerThreshold( a ); this->SetUpperThreshold( std::numeric_limits< _TValue >::max( ) ); } // ------------------------------------------------------------------------- template< class _TValue > void fpa::Functors::RegionGrow::BinaryThreshold< _TValue >:: ThresholdBetween( const TValue& a, const TValue& b ) { this->SetLowerThreshold( ( a < b )? a: b ); this->SetUpperThreshold( ( b < a )? a: b ); } // ------------------------------------------------------------------------- template< class _TValue > void fpa::Functors::RegionGrow::BinaryThreshold< _TValue >:: ThresholdBelow( const TValue& a ) { if( std::numeric_limits< _TValue >::is_integer ) this->SetLowerThreshold( std::numeric_limits< _TValue >::min( ) ); else this->SetLowerThreshold( -std::numeric_limits< _TValue >::max( ) ); this->SetUpperThreshold( a ); } // ------------------------------------------------------------------------- template< class _TValue > bool fpa::Functors::RegionGrow::BinaryThreshold< _TValue >:: Evaluate( const TValue& v ) const { if( this->m_Strict ) return( this->m_LowerThreshold < v && v < this->m_UpperThreshold ); else return( this->m_LowerThreshold <= v && v <= this->m_UpperThreshold ); } // ------------------------------------------------------------------------- template< class _TValue > fpa::Functors::RegionGrow::BinaryThreshold< _TValue >:: BinaryThreshold( ) : Superclass( ), m_Strict( true ) { this->m_UpperThreshold = std::numeric_limits< _TValue >::max( ); if( std::numeric_limits< _TValue >::is_integer ) this->m_LowerThreshold = std::numeric_limits< _TValue >::min( ); else this->m_LowerThreshold = -this->m_UpperThreshold; } // ------------------------------------------------------------------------- template< class _TValue > fpa::Functors::RegionGrow::BinaryThreshold< _TValue >:: ~BinaryThreshold( ) { } #endif // __fpa__Functors__RegionGrow__BinaryThreshold__hxx__ // eof - $RCSfile$