00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkRGBToLuminanceImageAdaptor_h
00018 #define __itkRGBToLuminanceImageAdaptor_h
00019
00020 #include <itkImageAdaptor.h>
00021 #include "vnl/vnl_math.h"
00022
00023 namespace itk
00024 {
00025
00026 namespace Accessor {
00038 template <class TInternalType, class TExternalType >
00039 class ITK_EXPORT RGBToLuminancePixelAccessor
00040 {
00041 public:
00044 typedef TExternalType ExternalType;
00045
00048 typedef TInternalType InternalType;
00049
00050 static inline void Set(TInternalType & output, const TExternalType & input)
00051 {output = static_cast<TInternalType>( input.GetLuminance() );}
00052
00053 static inline TExternalType Get( const TInternalType & input )
00054 {return static_cast<TExternalType>( input.GetLuminance() );}
00055 };
00056
00057 }
00058
00068 template <class TImage, class TOutputPixelType>
00069 class ITK_EXPORT RGBToLuminanceImageAdaptor : public
00070 ImageAdaptor<TImage,
00071 Accessor::RGBToLuminancePixelAccessor<
00072 typename TImage::PixelType,
00073 TOutputPixelType> >
00074 {
00075 public:
00077 typedef RGBToLuminanceImageAdaptor Self;
00078 typedef ImageAdaptor<TImage, Accessor::RGBToLuminancePixelAccessor<
00079 typename TImage::PixelType,
00080 TOutputPixelType> > Superclass;
00081 typedef SmartPointer<Self> Pointer;
00082 typedef SmartPointer<const Self> ConstPointer;
00083
00085 itkNewMacro(Self);
00086
00088 itkTypeMacro( RGBToLuminanceImageAdaptor, ImageAdaptor );
00089
00090 protected:
00091 RGBToLuminanceImageAdaptor() {}
00092 virtual ~RGBToLuminanceImageAdaptor() {}
00093
00094 private:
00095 RGBToLuminanceImageAdaptor(const Self&);
00096 void operator=(const Self&);
00097
00098 };
00099
00100 }
00101
00102 #endif