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: 2006/04/03 15:07:52 $
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 __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 
00087 #ifdef ITK_USE_CONCEPT_CHECKING
00088 
00089   itkConceptMacro(InputHasNumericTraitsCheck,
00090     (Concept::HasNumericTraits<typename TInputImage::PixelType::ValueType>));
00091   itkConceptMacro(OutputHasNumericTraitsCheck,
00092     (Concept::HasNumericTraits<typename TOutputImage::PixelType::ValueType>));
00093   itkConceptMacro(InputConvertibleToOutputCheck,
00094     (Concept::Convertible<typename TInputImage::PixelType::ValueType,
00095                           typename TOutputImage::PixelType::ValueType>));
00096 
00098 #endif
00099 
00100 protected:
00101   VectorCastImageFilter() {}
00102   virtual ~VectorCastImageFilter() {}
00103 
00104 private:
00105   VectorCastImageFilter(const Self&); //purposely not implemented
00106   void operator=(const Self&); //purposely not implemented
00107 
00108 };
00109 
00110 } // end namespace itk
00111 
00112 
00113 #endif
00114 

Generated at Sun Sep 23 14:31:26 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000