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: 2002/09/13 21:21:31 $
00007   Version:   $Revision: 1.6 $
00008 
00009   Copyright (c) 2002 Insight 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     inline TOutput operator()( const TInput & A )
00049       {
00050       typedef typename TOutput::ValueType OutputValueType;
00051 
00052       TOutput value;
00053       for( unsigned int k = 0; k < TOutput::VectorDimension; 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&); //purposely not implemented
00085   void operator=(const Self&); //purposely not implemented
00086 
00087 };
00088 
00089 } // end namespace itk
00090 
00091 
00092 #endif

Generated at Wed Mar 12 01:13:11 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000