1 // -------------------------------------------------------------------------
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // -------------------------------------------------------------------------
5 #ifndef __CPEXTENSIONS__ALGORITHMS__RGBEXTRACTFUNCTION__H__
6 #define __CPEXTENSIONS__ALGORITHMS__RGBEXTRACTFUNCTION__H__
10 #include <vnl/vnl_math.h>
12 #include <itkRGBPixel.h>
14 namespace cpExtensions
21 struct RGBExtractFunction
23 typedef RGBExtractFunction Self;
25 typedef typename P::ValueType TValue;
27 template< class Tr, class Tg, class Tb >
28 P operator()( const Tr& r, const Tg& g, const Tb& b ) const
31 out[ 0 ] = TValue( r );
32 out[ 1 ] = TValue( g );
33 out[ 2 ] = TValue( b );
38 TOutPixel operator()( const itk::RGBPixel< C >& rgb ) const
42 rgb.GetRed( ), rgb.GetGreen( ), rgb.GetBlue( )
52 #endif // __CPEXTENSIONS__ALGORITHMS__RGBEXTRACTFUNCTION__H__