1 // -------------------------------------------------------------------------
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // -------------------------------------------------------------------------
5 #ifndef __cpExtensions__Algorithms__RGBToSingleChannelFunctor__h__
6 #define __cpExtensions__Algorithms__RGBToSingleChannelFunctor__h__
8 #include <itkFunctionBase.h>
9 #include <itkRGBPixel.h>
11 namespace cpExtensions
17 template< class _TScalar >
18 class RGBToSingleChannelFunctor
19 : public itk::FunctionBase< itk::RGBPixel< _TScalar >, _TScalar >
22 typedef _TScalar TScalar;
23 typedef itk::RGBPixel< _TScalar > TPixel;
24 typedef RGBToSingleChannelFunctor Self;
25 typedef itk::FunctionBase< TPixel, TScalar > Superclass;
26 typedef itk::SmartPointer< Self > Pointer;
27 typedef itk::SmartPointer< const Self > ConstPointer;
41 itkTypeMacro( RGBToSingleChannelFunctor, itkFunctionBase );
43 itkGetConstMacro( Channel, ChannelType );
44 itkSetMacro( Channel, ChannelType );
47 bool IsChannelRed( ) const;
48 bool IsChannelGreen( ) const;
49 bool IsChannelBlue( ) const;
50 bool IsChannelHue( ) const;
51 bool IsChannelSaturation( ) const;
52 bool IsChannelValue( ) const;
54 void SetChannelToRed( );
55 void SetChannelToGreen( );
56 void SetChannelToBlue( );
57 void SetChannelToHue( );
58 void SetChannelToSaturation( );
59 void SetChannelToValue( );
61 virtual TScalar Evaluate( const TPixel& pixel ) const override;
64 RGBToSingleChannelFunctor( );
65 virtual ~RGBToSingleChannelFunctor( );
68 // Purposely not implemented.
69 RGBToSingleChannelFunctor( const Self& );
70 void operator=( const Self& );
73 ChannelType m_Channel;
80 #ifndef ITK_MANUAL_INSTANTIATION
81 # include <cpExtensions/Algorithms/RGBToSingleChannelFunctor.hxx>
82 #endif // ITK_MANUAL_INSTANTIATION
84 #endif // __cpExtensions__Algorithms__RGBToSingleChannelFunctor__h__