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

itkCastImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkCastImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/08/20 17:57:01 $
00007   Version:   $Revision: 1.13 $
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 __itkCastImageFilter_h
00018 #define __itkCastImageFilter_h
00019 
00020 #include "itkUnaryFunctorImageFilter.h"
00021 
00022 namespace itk
00023 {
00024   
00044 namespace Functor {  
00045   
00046 template< class TInput, class TOutput>
00047 class Cast
00048 {
00049 public:
00050   Cast() {};
00051   virtual ~Cast() {};
00052   bool operator!=( const Cast & ) const
00053   {
00054     return false;
00055   }
00056   bool operator==( const Cast & other ) const
00057   {
00058     return !(*this != other);
00059   }
00060   inline TOutput operator()( const TInput & A )
00061   {
00062     return static_cast<TOutput>( A );
00063   }
00064 };
00065 }
00066 
00067 template <class TInputImage, class TOutputImage>
00068 class ITK_EXPORT CastImageFilter :
00069     public
00070 UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00071                         Functor::Cast< 
00072   typename TInputImage::PixelType, 
00073   typename TOutputImage::PixelType> >
00074 {
00075 public:
00077   typedef CastImageFilter  Self;
00078   typedef UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00079                                   Functor::Cast< 
00080     typename TInputImage::PixelType, 
00081     typename TOutputImage::PixelType>   
00082   >  Superclass;
00083   typedef SmartPointer<Self>   Pointer;
00084   typedef SmartPointer<const Self>  ConstPointer;
00085 
00087   itkNewMacro(Self);
00088 
00090   itkTypeMacro(CastImageFilter, UnaryFunctorImageFilter);
00091 
00092 #ifdef ITK_USE_CONCEPT_CHECKING
00093 
00094   itkConceptMacro(InputConvertibleToOutputCheck,
00095     (Concept::Convertible<typename TInputImage::PixelType,
00096                           typename TOutputImage::PixelType>));
00097 
00099 #endif
00100 
00101 protected:
00102   CastImageFilter() {}
00103   virtual ~CastImageFilter() {}
00104 
00105   
00106 private:
00107   CastImageFilter(const Self&); //purposely not implemented
00108   void operator=(const Self&); //purposely not implemented
00109 
00110 };
00111 
00112 
00113 } // end namespace itk
00114 
00115 #endif
00116 

Generated at Tue Jul 29 19:26:37 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000