#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::InputImageType InputImageType; typedef typename Superclass::InputPixelType InputPixelType; typedef typename Superclass::OutputType OutputType; typedef typename Superclass::CoordRepType CoordRepType; typedef typename Superclass::IndexType IndexType; typedef typename Superclass::IndexValueType IndexValueType; typedef typename Superclass::ContinuousIndexType ContinuousIndexType; typedef typename Superclass::PointType PointType; public: itkNewMacro( Self ); itkTypeMacro( RegionGrowThresholdFunction, RegionGrowAllBelongsFunction ); itkGetConstMacro( LowerThreshold, InputPixelType ); itkGetConstMacro( UpperThreshold, InputPixelType ); itkSetMacro( LowerThreshold, InputPixelType ); itkSetMacro( UpperThreshold, InputPixelType ); public: virtual OutputType EvaluateAtIndex( const IndexType& index ) const { const I* img = this->GetInputImage( ); if( img != NULL ) { if( this->IsInsideBuffer( index ) ) { InputPixelType v = img->GetPixel( index ); return( this->m_LowerThreshold <= v && v <= this->m_UpperThreshold ); } // fi } // fi return( false ); } protected: RegionGrowThresholdFunction( ) : Superclass( ), m_LowerThreshold( std::numeric_limits< InputPixelType >::min( ) ), m_UpperThreshold( std::numeric_limits< InputPixelType >::max( ) ) { } virtual ~RegionGrowThresholdFunction( ) { } private: // Purposely not implemented RegionGrowThresholdFunction( const Self& ); void operator=( const Self& ); protected: InputPixelType m_LowerThreshold; InputPixelType m_UpperThreshold; }; } // ecapseman } // ecapseman } // ecapseman #endif // __FPA__IMAGE__FUNCTORS__REGIONGROWTHRESHOLDFUNCTION__H__ // eof - $RCSfile$