#ifndef __FPA__IMAGE__FUNCTORS__REGIONGROWTHRESHOLDFUNCTION__H__ #define __FPA__IMAGE__FUNCTORS__REGIONGROWTHRESHOLDFUNCTION__H__ #include #include namespace fpa { namespace Image { namespace Functors { /** */ template< class I > class RegionGrowThresholdFunction : public RegionGrowAllBelongsFunction< I > { public: /// Type-related and pointers typedef RegionGrowThresholdFunction Self; typedef RegionGrowAllBelongsFunction< I > Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; // Superclass' types typedef typename Superclass::TInputImage TInputImage; typedef typename Superclass::TOutputValue TOutputValue; typedef typename Superclass::TIndex TIndex; typedef typename I::PixelType TPixel; public: itkNewMacro( Self ); itkTypeMacro( RegionGrowThresholdFunction, RegionGrowAllBelongsFunction ); itkGetConstMacro( LowerThreshold, TPixel ); itkGetConstMacro( UpperThreshold, TPixel ); itkSetMacro( LowerThreshold, TPixel ); itkSetMacro( UpperThreshold, TPixel ); public: virtual TOutputValue Evaluate( const TIndex& idx ) const { const I* img = this->GetInputImage( ); if( img != NULL ) { TPixel v = img->GetPixel( idx ); return( this->m_LowerThreshold <= v && v < this->m_UpperThreshold ); } // fi return( false ); } protected: RegionGrowThresholdFunction( ) : Superclass( ), m_LowerThreshold( std::numeric_limits< TPixel >::min( ) ), m_UpperThreshold( std::numeric_limits< TPixel >::max( ) ) { } virtual ~RegionGrowThresholdFunction( ) { } private: // Purposely not implemented RegionGrowThresholdFunction( const Self& ); void operator=( const Self& ); protected: TPixel m_LowerThreshold; TPixel m_UpperThreshold; }; } // ecapseman } // ecapseman } // ecapseman #endif // __FPA__IMAGE__FUNCTORS__REGIONGROWTHRESHOLDFUNCTION__H__ // eof - $RCSfile$