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

itkVectorCastImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkVectorCastImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007-09-27 11:36:41 $
00007   Version:   $Revision: 1.14 $
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 __itkVectorCastImageFilter_h
00018 #define __itkVectorCastImageFilter_h
00019 
00020 #include "itkUnaryFunctorImageFilter.h"
00021 
00022 namespace itk
00023 {
00024   
00040 namespace Functor {  
00041   
00042 template< class TInput, class TOutput>
00043 class VectorCast
00044 {
00045 public:
00046   VectorCast() {}
00047   ~VectorCast() {}
00048   bool operator!=( const VectorCast & ) const
00049   {
00050     return false;
00051   }
00052   bool operator==( const VectorCast & other ) const
00053   {
00054     return !(*this != other);
00055   }
00056   inline TOutput operator()( const TInput & A ) const
00057   {
00058     typedef typename TOutput::ValueType OutputValueType;
00059 
00060     TOutput value;
00061     for( unsigned int k = 0; k < TOutput::Dimension; k++ )
00062       { value[k] = static_cast<OutputValueType>( A[k] ); }
00063     return value;
00064   }
00065 }; 
00066 }
00067 
00068 template <class TInputImage, class TOutputImage>
00069 class ITK_EXPORT VectorCastImageFilter :
00070     public
00071 UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00072                         Functor::VectorCast< typename TInputImage::PixelType, 
00073                                              typename TOutputImage::PixelType>   >
00074 {
00075 public:
00077   typedef VectorCastImageFilter  Self;
00078   typedef UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00079                                   Functor::VectorCast< typename TInputImage::PixelType, 
00080                                                        typename TOutputImage::PixelType> >  Superclass;
00081   typedef SmartPointer<Self>   Pointer;
00082   typedef SmartPointer<const Self>  ConstPointer;
00083 
00085   itkNewMacro(Self);
00086 
00088   itkTypeMacro(VectorCastImageFilter, 
00089                UnaryFunctorImageFilter);
00090 
00091 #ifdef ITK_USE_CONCEPT_CHECKING
00092 
00093   itkConceptMacro(InputHasNumericTraitsCheck,
00094     (Concept::HasNumericTraits<typename TInputImage::PixelType::ValueType>));
00095   itkConceptMacro(OutputHasNumericTraitsCheck,
00096     (Concept::HasNumericTraits<typename TOutputImage::PixelType::ValueType>));
00097   itkConceptMacro(InputConvertibleToOutputCheck,
00098     (Concept::Convertible<typename TInputImage::PixelType::ValueType,
00099                           typename TOutputImage::PixelType::ValueType>));
00100 
00102 #endif
00103 
00104 protected:
00105   VectorCastImageFilter() {}
00106   virtual ~VectorCastImageFilter() {}
00107 
00108 private:
00109   VectorCastImageFilter(const Self&); //purposely not implemented
00110   void operator=(const Self&); //purposely not implemented
00111 
00112 };
00113 
00114 } // end namespace itk
00115 
00116 
00117 #endif
00118 

Generated at Mon Apr 14 14:44:10 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000