Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkVectorIndexSelectionCastImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkVectorIndexSelectionCastImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/10/30 21:49:25 $
00007   Version:   $Revision: 1.9 $
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 __itkVectorIndexSelectionCastImageFilter_h
00018 #define __itkVectorIndexSelectionCastImageFilter_h
00019 
00020 #include "itkUnaryFunctorImageFilter.h"
00021 
00022 namespace itk
00023 {
00024   
00025 namespace Functor {  
00026   
00027 template< class TInput, class TOutput>
00028 class VectorIndexSelectionCast
00029 {
00030 public:
00031   VectorIndexSelectionCast() {m_Index = 0;}
00032   ~VectorIndexSelectionCast() {}
00033 
00034   unsigned int GetIndex() const { return m_Index; }
00035   void SetIndex(unsigned int i) { m_Index = i; }
00036 
00037   inline TOutput operator()( const TInput & A )
00038   {
00039     return static_cast<TOutput>( A[m_Index] );
00040   }
00041       
00042 private:
00043   unsigned int m_Index;   
00044 }; 
00045 }
00046 
00047 
00048 
00066 template <class TInputImage, class TOutputImage>
00067 class ITK_EXPORT VectorIndexSelectionCastImageFilter :
00068     public
00069 UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00070                         Functor::VectorIndexSelectionCast< typename TInputImage::PixelType, 
00071                                                            typename TOutputImage::PixelType>   >
00072 {
00073 public:
00075   typedef VectorIndexSelectionCastImageFilter Self;
00076   typedef UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00077                                   Functor::VectorIndexSelectionCast< typename TInputImage::PixelType, 
00078                                                                      typename TOutputImage::PixelType> > Superclass;
00079   typedef SmartPointer<Self> Pointer;
00080   typedef SmartPointer<const Self> ConstPointer;
00081     
00083   itkNewMacro(Self);
00084 
00086   void SetIndex(unsigned int i)
00087     {
00088       if (i != this->GetFunctor().GetIndex())
00089         {
00090         this->GetFunctor().SetIndex(i);
00091         this->Modified();
00092         }
00093     }
00094   unsigned int GetIndex(void) const { return this->GetFunctor().GetIndex(); }
00095 
00096 protected:
00097   VectorIndexSelectionCastImageFilter() {}
00098   virtual ~VectorIndexSelectionCastImageFilter() {}
00099     
00100 private:
00101   VectorIndexSelectionCastImageFilter(const Self&); //purposely not implemented
00102   void operator=(const Self&); //purposely not implemented
00103 };
00104  
00105 } // end namespace itk
00106 
00107 
00108 #endif

Generated at Thu May 25 00:12:59 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000