|
Slicer 4.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkVectorImageCastFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:28:51 $ 00007 Version: $Revision: 1.16 $ 00008 00009 =========================================================================*/ 00010 #ifndef __itkVectorImageCastFilter_h 00011 #define __itkVectorImageCastFilter_h 00012 00013 #include "itkUnaryFunctorImageFilter.h" 00014 #include "vnl/vnl_math.h" 00015 00016 namespace itk 00017 { 00018 namespace Function 00019 { 00020 template <class TInput, class TOutput> 00021 class Cast 00022 { 00023 public: 00024 Cast() 00025 { 00026 } 00027 ~Cast() 00028 { 00029 } 00030 inline TOutput operator()( const TInput & a ) 00031 { 00032 TOutput b; 00033 00034 b.SetSize( a.GetSize() ); 00035 for( unsigned int k = 0; k < a.GetSize(); ++k ) 00036 { 00037 b[k] = static_cast<typename TOutput::RealValueType>( a[k] ); 00038 } 00039 return b; 00040 } 00041 00042 }; 00043 } 00044 00045 template <class TInputImage, class TOutputImage> 00046 class ITK_EXPORT VectorImageCastFilter : 00047 public UnaryFunctorImageFilter<TInputImage, TOutputImage, 00048 Function::Cast<typename TInputImage::PixelType, typename TOutputImage::PixelType> > 00049 { 00050 public: 00052 typedef VectorImageCastFilter Self; 00053 typedef UnaryFunctorImageFilter<TInputImage, TOutputImage, 00054 Function::Cast<typename TInputImage::PixelType, typename TOutputImage::PixelType> > 00055 Superclass; 00056 typedef SmartPointer<Self> Pointer; 00057 typedef SmartPointer<const Self> ConstPointer; 00058 00060 itkNewMacro(Self); 00061 protected: 00062 VectorImageCastFilter() 00063 { 00064 } 00065 virtual ~VectorImageCastFilter() 00066 { 00067 } 00068 private: 00069 VectorImageCastFilter(const Self &); // purposely not implemented 00070 void operator=(const Self &); // purposely not implemented 00071 00072 }; 00073 00074 } // end namespace itk 00075 00076 #endif
1.7.4