#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 I TInputImage; typedef typename I::IndexType 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 bool Evaluate( const TIndex& idx ) const { const I* img = this->GetSpace( ); if( img != NULL ) { TPixel v = img->GetPixel( idx ); return( !( v < this->m_LowerThreshold || this->m_UpperThreshold < v ) ); } // fi return( false ); } protected: RegionGrowThresholdFunction( ) : Superclass( ) { itk::NumericTraits< TPixel >::min( this->m_LowerThreshold ); itk::NumericTraits< TPixel >::max( this->m_UpperThreshold ); } 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$