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: 2008-05-08 00:36:49 $
00007   Version:   $Revision: 1.15 $
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 #include "itkNumericTraitsFixedArrayPixel.h"
00022 
00023 namespace itk
00024 {
00025   
00041 namespace Functor {  
00042   
00043 template< class TInput, class TOutput>
00044 class VectorCast
00045 {
00046 public:
00047   VectorCast() {}
00048   ~VectorCast() {}
00049   bool operator!=( const VectorCast & ) const
00050   {
00051     return false;
00052   }
00053   bool operator==( const VectorCast & other ) const
00054   {
00055     return !(*this != other);
00056   }
00057   inline TOutput operator()( const TInput & A ) const
00058   {
00059     typedef typename TOutput::ValueType OutputValueType;
00060 
00061     TOutput value;
00062     for( unsigned int k = 0; k < TOutput::Dimension; k++ )
00063       { value[k] = static_cast<OutputValueType>( A[k] ); }
00064     return value;
00065   }
00066 }; 
00067 }
00068 
00069 template <class TInputImage, class TOutputImage>
00070 class ITK_EXPORT VectorCastImageFilter :
00071     public
00072 UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00073                         Functor::VectorCast< typename TInputImage::PixelType, 
00074                                              typename TOutputImage::PixelType>   >
00075 {
00076 public:
00078   typedef VectorCastImageFilter  Self;
00079   typedef UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00080                                   Functor::VectorCast< typename TInputImage::PixelType, 
00081                                                        typename TOutputImage::PixelType> >  Superclass;
00082   typedef SmartPointer<Self>   Pointer;
00083   typedef SmartPointer<const Self>  ConstPointer;
00084 
00086   itkNewMacro(Self);
00087 
00089   itkTypeMacro(VectorCastImageFilter, 
00090                UnaryFunctorImageFilter);
00091 
00092 #ifdef ITK_USE_CONCEPT_CHECKING
00093 
00094   itkConceptMacro(InputHasNumericTraitsCheck,
00095     (Concept::HasNumericTraits<typename TInputImage::PixelType::ValueType>));
00096   itkConceptMacro(OutputHasNumericTraitsCheck,
00097     (Concept::HasNumericTraits<typename TOutputImage::PixelType::ValueType>));
00098   itkConceptMacro(InputConvertibleToOutputCheck,
00099     (Concept::Convertible<typename TInputImage::PixelType::ValueType,
00100                           typename TOutputImage::PixelType::ValueType>));
00101 
00103 #endif
00104 
00105 protected:
00106   VectorCastImageFilter() {}
00107   virtual ~VectorCastImageFilter() {}
00108 
00109 private:
00110   VectorCastImageFilter(const Self&); //purposely not implemented
00111   void operator=(const Self&); //purposely not implemented
00112 
00113 };
00114 
00115 } // end namespace itk
00116 
00117 
00118 #endif
00119 

Generated at Tue Jul 29 23:12:36 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000