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: 2002/08/09 20:04:14 $
00007   Version:   $Revision: 1.4 $
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 __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() {}
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) { this->GetFunctor().SetIndex(i); }
00082     unsigned int GetIndex(void) const { return this->GetFunctor().GetIndex(); }
00083 
00084   protected:
00085     VectorIndexSelectionCastImageFilter() {}
00086     virtual ~VectorIndexSelectionCastImageFilter() {}
00087     
00088   private:
00089     VectorIndexSelectionCastImageFilter(const Self&); //purposely not implemented
00090     void operator=(const Self&); //purposely not implemented
00091   };
00092  
00093 } // end namespace itk
00094 
00095 
00096 #endif

Generated at Fri May 21 01:15:31 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000