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-10-17 16:30:53 $
00007   Version:   $Revision: 1.16 $
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       {
00064       value[k] = static_cast<OutputValueType>( A[k] );
00065       }
00066     return value;
00067     }
00068 }; 
00069 }
00070 
00071 template <class TInputImage, class TOutputImage>
00072 class ITK_EXPORT VectorCastImageFilter :
00073     public
00074 UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00075                         Functor::VectorCast< typename TInputImage::PixelType, 
00076                                              typename TOutputImage::PixelType>   >
00077 {
00078 public:
00080   typedef VectorCastImageFilter                               Self;
00081   typedef UnaryFunctorImageFilter<
00082     TInputImage,TOutputImage, 
00083     Functor::VectorCast< typename TInputImage::PixelType, 
00084                          typename TOutputImage::PixelType> >  Superclass;
00085   typedef SmartPointer<Self>                                  Pointer;
00086   typedef SmartPointer<const Self>                            ConstPointer;
00087 
00089   itkNewMacro(Self);
00090 
00092   itkTypeMacro(VectorCastImageFilter, 
00093                UnaryFunctorImageFilter);
00094 
00095 #ifdef ITK_USE_CONCEPT_CHECKING
00096 
00097   itkConceptMacro(InputHasNumericTraitsCheck,
00098     (Concept::HasNumericTraits<typename TInputImage::PixelType::ValueType>));
00099   itkConceptMacro(OutputHasNumericTraitsCheck,
00100     (Concept::HasNumericTraits<typename TOutputImage::PixelType::ValueType>));
00101   itkConceptMacro(InputConvertibleToOutputCheck,
00102     (Concept::Convertible<typename TInputImage::PixelType::ValueType,
00103                           typename TOutputImage::PixelType::ValueType>));
00104 
00106 #endif
00107 
00108 protected:
00109   VectorCastImageFilter() {}
00110   virtual ~VectorCastImageFilter() {}
00111 
00112 private:
00113   VectorCastImageFilter(const Self&); //purposely not implemented
00114   void operator=(const Self&); //purposely not implemented
00115 
00116 };
00117 
00118 } // end namespace itk
00119 
00120 
00121 #endif
00122 

Generated at Tue Sep 15 05:15:42 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000