Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkRGBToLuminanceImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkRGBToLuminanceImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-01 14:36:31 $
00007   Version:   $Revision: 1.7 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkRGBToLuminanceImageFilter_h
00018 #define __itkRGBToLuminanceImageFilter_h
00019 
00020 #include "itkUnaryFunctorImageFilter.h"
00021 
00022 namespace itk
00023 {
00024   
00035 namespace Function {  
00036   
00037 template< class TInput, class TOutput>
00038 class RGBToLuminance
00039 {
00040 public:
00041   typedef typename TInput::ComponentType                         ComponentType;
00042   typedef typename itk::NumericTraits< ComponentType >::RealType RealType;
00043 
00044   RGBToLuminance() {}
00045   ~RGBToLuminance() {}
00046   bool operator!=( const RGBToLuminance & ) const
00047     {
00048     return false;
00049     }
00050   bool operator==( const RGBToLuminance & other ) const
00051     {
00052     return !(*this != other);
00053     }
00054   inline TOutput operator()( const TInput & A ) const
00055     { return static_cast<TOutput>( A.GetLuminance() ); }
00056 }; 
00057 }
00058 
00059 template <class TInputImage, class TOutputImage>
00060 class ITK_EXPORT RGBToLuminanceImageFilter :
00061     public
00062 UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00063                         Function::RGBToLuminance< 
00064   typename TInputImage::PixelType, 
00065   typename TOutputImage::PixelType>   >
00066 {
00067 public:
00069   typedef RGBToLuminanceImageFilter                               Self;
00070   typedef UnaryFunctorImageFilter<
00071     TInputImage,TOutputImage, 
00072     Function::RGBToLuminance<typename TInputImage::PixelType, 
00073                              typename TOutputImage::PixelType> >  Superclass;
00074   typedef SmartPointer<Self>                                      Pointer;
00075   typedef SmartPointer<const Self>                                ConstPointer;
00076 
00078   itkNewMacro(Self);
00079 
00081   itkTypeMacro(RGBToLuminanceImageFilter, 
00082                UnaryFunctorImageFilter);
00083 
00084 #ifdef ITK_USE_CONCEPT_CHECKING
00085 
00086   itkConceptMacro(InputHasNumericTraitsCheck,
00087     (Concept::HasNumericTraits<typename TInputImage::PixelType::ComponentType>));
00088 
00090 #endif
00091 
00092 protected:
00093   RGBToLuminanceImageFilter() {}
00094   virtual ~RGBToLuminanceImageFilter() {}
00095 
00096 private:
00097   RGBToLuminanceImageFilter(const Self&); //purposely not implemented
00098   void operator=(const Self&); //purposely not implemented
00099 
00100 };
00101 
00102 } // end namespace itk
00103 
00104 
00105 #endif
00106 

Generated at Mon Jul 12 2010 19:41:03 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000