// ------------------------------------------------------------------------- // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) // ------------------------------------------------------------------------- #ifndef __cpExtensions__Algorithms__RGBToSingleChannelFunctor__h__ #define __cpExtensions__Algorithms__RGBToSingleChannelFunctor__h__ #include #include namespace cpExtensions { namespace Algorithms { /** */ template< class _TScalar > class RGBToSingleChannelFunctor : public itk::FunctionBase< itk::RGBPixel< _TScalar >, _TScalar > { public: typedef _TScalar TScalar; typedef itk::RGBPixel< _TScalar > TPixel; typedef RGBToSingleChannelFunctor Self; typedef itk::FunctionBase< TPixel, TScalar > Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; enum ChannelType { Red = 0, Green, Blue, Hue, Saturation, Value }; public: itkNewMacro( Self ); itkTypeMacro( RGBToSingleChannelFunctor, itkFunctionBase ); itkGetConstMacro( Channel, ChannelType ); itkSetMacro( Channel, ChannelType ); public: bool IsChannelRed( ) const; bool IsChannelGreen( ) const; bool IsChannelBlue( ) const; bool IsChannelHue( ) const; bool IsChannelSaturation( ) const; bool IsChannelValue( ) const; void SetChannelToRed( ); void SetChannelToGreen( ); void SetChannelToBlue( ); void SetChannelToHue( ); void SetChannelToSaturation( ); void SetChannelToValue( ); virtual TScalar Evaluate( const TPixel& pixel ) const override; protected: RGBToSingleChannelFunctor( ); virtual ~RGBToSingleChannelFunctor( ); private: // Purposely not implemented. RGBToSingleChannelFunctor( const Self& ); void operator=( const Self& ); protected: ChannelType m_Channel; }; } // ecapseman } // ecapseman #ifndef ITK_MANUAL_INSTANTIATION # include #endif // ITK_MANUAL_INSTANTIATION #endif // __cpExtensions__Algorithms__RGBToSingleChannelFunctor__h__ // eof - $RCSfile$