00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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 inline TOutput operator()( const TInput & A ) const
00049 {
00050 typedef typename TOutput::ValueType OutputValueType;
00051
00052 TOutput value;
00053 for( unsigned int k = 0; k < TOutput::Dimension; k++ )
00054 { value[k] = static_cast<OutputValueType>( A[k] ); }
00055 return value;
00056 }
00057 };
00058 }
00059
00060 template <class TInputImage, class TOutputImage>
00061 class ITK_EXPORT VectorCastImageFilter :
00062 public
00063 UnaryFunctorImageFilter<TInputImage,TOutputImage,
00064 Functor::VectorCast< typename TInputImage::PixelType,
00065 typename TOutputImage::PixelType> >
00066 {
00067 public:
00069 typedef VectorCastImageFilter Self;
00070 typedef UnaryFunctorImageFilter<TInputImage,TOutputImage,
00071 Functor::VectorCast< typename TInputImage::PixelType,
00072 typename TOutputImage::PixelType> > Superclass;
00073 typedef SmartPointer<Self> Pointer;
00074 typedef SmartPointer<const Self> ConstPointer;
00075
00077 itkNewMacro(Self);
00078
00079 protected:
00080 VectorCastImageFilter() {}
00081 virtual ~VectorCastImageFilter() {}
00082
00083 private:
00084 VectorCastImageFilter(const Self&);
00085 void operator=(const Self&);
00086
00087 };
00088
00089 }
00090
00091
00092 #endif