KWStyle - itkRGBToLuminanceImageAdaptor.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkRGBToLuminanceImageAdaptor.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:47 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 #ifndef __itkRGBToLuminanceImageAdaptor_h
18 #define __itkRGBToLuminanceImageAdaptor_h
19
20 #include <itkImageAdaptor.h>
21 #include "vnl/vnl_math.h"
22
23 namespace itk
24 {
25  
26 namespace Accessor {
27 /** \class RGBToLuminancePixelAccessor
28  * \brief Give access to Luminance of a color pixel type.
29  *
30  * RGBToLuminancePixelAccessor is templated over an internal type and an
31  * external type representation. This class cast the input applies the funtion
32  * to it and cast the result according to the types defined as template
33  * parameters. The input pixel type must support the GetLuminance() method.
34  * This is the case of the RGBPixel class for example.
35  *
36  * \ingroup ImageAdaptors
37  */
38 template <class TInternalType, class TExternalType >
39 class ITK_EXPORT RGBToLuminancePixelAccessor  
40 {
41 public:
42   /** External typedef. It defines the external aspect
43    * that this class will exhibit. */
44   typedef TExternalType ExternalType;
45
46   /** Internal typedef. It defines the internal real
47    * representation of data. */
48   typedef TInternalType InternalType;
49
50   static inline void Set(TInternalType & output, const TExternalType & input) 
51     {output = static_cast<TInternalType>( input.GetLuminance() );}
52
53   static inline TExternalType Get( const TInternalType & input ) 
54     {return static_cast<TExternalType>( input.GetLuminance() );}
55 };
56   
57 // end namespace Accessor
58  
59 /** \class RGBToLuminanceImageAdaptor
60 LEN  * \brief Presents a color image as being composed of the Luminance of its pixels.
61  *
62  * Additional casting is performed according to the input and output image
63  * types following C++ default casting rules. The input color pixel type must
64  * provide a GetLuminance() method.
65  *
66  * \ingroup ImageAdaptors
67  */
68 template <class TImage, class TOutputPixelType>
69 class ITK_EXPORT RGBToLuminanceImageAdaptor : public
70 IND ******ImageAdaptor<TImage,
71                    Accessor::RGBToLuminancePixelAccessor<
72                                       typename TImage::PixelType,
73                                       TOutputPixelType>   >
74 {
75 public:
76   /** Standard class typedefs. */
77   typedef RGBToLuminanceImageAdaptor  Self;
78   typedef ImageAdaptor<TImage, Accessor::RGBToLuminancePixelAccessor<
79                                typename TImage::PixelType,
80 TDA                                TOutputPixelType> >  Superclass;
81 TDA   typedef SmartPointer<Self>  Pointer;
82 TDA   typedef SmartPointer<const Self>  ConstPointer;
83   
84   /** Method for creation through the object factory. */
85   itkNewMacro(Self);  
86
87   /** Run-time type information (and related methods). */
88   itkTypeMacro( RGBToLuminanceImageAdaptor, ImageAdaptor );
89
90 IND *protected:
91   RGBToLuminanceImageAdaptor() {}
92   virtual ~RGBToLuminanceImageAdaptor() {}
93   
94 IND *private:
95   RGBToLuminanceImageAdaptor(const Self&); //purposely not implemented
96   void operator=(const Self&); //purposely not implemented
97
98 };
99
100 // end namespace itk
101
102 #endif
103

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:41PM
© Kitware Inc.