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/09/10 14:28:59 $
00007   Version:   $Revision: 1.8 $
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   
00039 namespace Functor {  
00040   
00041 template< class TInput, class TOutput>
00042 class VectorIndexSelectionCast
00043 {
00044 public:
00045   VectorIndexSelectionCast() {m_Index = 0;}
00046   ~VectorIndexSelectionCast() {}
00047 
00048   unsigned int GetIndex() const { return m_Index; }
00049   void SetIndex(unsigned int i) { m_Index = i; }
00050 
00051   inline TOutput operator()( const TInput & A )
00052   {
00053     return static_cast<TOutput>( A[m_Index] );
00054   }
00055       
00056 private:
00057   unsigned int m_Index;   
00058 }; 
00059 }
00060  
00061 template <class TInputImage, class TOutputImage>
00062 class ITK_EXPORT VectorIndexSelectionCastImageFilter :
00063     public
00064 UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00065                         Functor::VectorIndexSelectionCast< typename TInputImage::PixelType, 
00066                                                            typename TOutputImage::PixelType>   >
00067 {
00068 public:
00070   typedef VectorIndexSelectionCastImageFilter Self;
00071   typedef UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00072                                   Functor::VectorIndexSelectionCast< typename TInputImage::PixelType, 
00073                                                                      typename TOutputImage::PixelType> > Superclass;
00074   typedef SmartPointer<Self> Pointer;
00075   typedef SmartPointer<const Self> ConstPointer;
00076     
00078   itkNewMacro(Self);
00079 
00081   void SetIndex(unsigned int i)
00082     {
00083       if (i != this->GetFunctor().GetIndex())
00084         {
00085         this->GetFunctor().SetIndex(i);
00086         this->Modified();
00087         }
00088     }
00089   unsigned int GetIndex(void) const { return this->GetFunctor().GetIndex(); }
00090 
00091 protected:
00092   VectorIndexSelectionCastImageFilter() {}
00093   virtual ~VectorIndexSelectionCastImageFilter() {}
00094     
00095 private:
00096   VectorIndexSelectionCastImageFilter(const Self&); //purposely not implemented
00097   void operator=(const Self&); //purposely not implemented
00098 };
00099  
00100 } // end namespace itk
00101 
00102 
00103 #endif

Generated at Tue Sep 16 11:32:11 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000