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

itkMatrixIndexSelectionImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkMatrixIndexSelectionImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/10/06 19:56:10 $
00007   Version:   $Revision: 1.1 $
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 __itkMatrixIndexSelectionImageFilter_h
00018 #define __itkMatrixIndexSelectionImageFilter_h
00019 
00020 #include "itkUnaryFunctorImageFilter.h"
00021 
00022 namespace itk
00023 {
00024   
00025 namespace Functor {  
00026   
00027 template< class TInput, class TOutput>
00028 class MatrixIndexSelection
00029 {
00030 public:
00031   MatrixIndexSelection() {m_i = m_j = 0;}
00032   ~MatrixIndexSelection() {}
00033 
00034   void GetIndices(unsigned int& i, unsigned int& j) const {i= m_i; j=m_j;}
00035   void SetIndices(unsigned int i,unsigned int j) {m_i= i; m_j =j;}
00036 
00037   inline TOutput operator()( const TInput & A )
00038   {
00039     return static_cast<TOutput>( A[m_i][m_j] );
00040   }
00041       
00042 private:
00043   unsigned int m_i, m_j;;   
00044 }; 
00045 }
00046 
00063 template <class TInputImage, class TOutputImage>
00064 class ITK_EXPORT MatrixIndexSelectionImageFilter :
00065     public
00066 UnaryFunctorImageFilter<TInputImage,TOutputImage,Functor::MatrixIndexSelection< typename TInputImage::PixelType,typename TOutputImage::PixelType> >
00067 {
00068 public:
00070   typedef MatrixIndexSelectionImageFilter Self;
00071   typedef UnaryFunctorImageFilter<TInputImage,TOutputImage,Functor::MatrixIndexSelection<typename TInputImage::PixelType,typename TOutputImage::PixelType> > Superclass;
00072   typedef SmartPointer<Self> Pointer;
00073   typedef SmartPointer<const Self> ConstPointer;
00074     
00076   itkNewMacro(Self);
00077 
00079   void SetIndices(unsigned int i, unsigned int j)
00080     {
00081     this->GetFunctor().SetIndices(i,j);
00082     this->Modified();
00083     }
00084 
00085   void GetIndices(unsigned int& i, unsigned int& j) const
00086     { return this->GetFunctor().GetIndices(i,j); }
00087 
00088 protected:
00089   MatrixIndexSelectionImageFilter() {}
00090   virtual ~MatrixIndexSelectionImageFilter() {}
00091     
00092 private:
00093   MatrixIndexSelectionImageFilter(const Self&); //purposely not implemented
00094   void operator=(const Self&); //purposely not implemented
00095 };
00096  
00097 } // end namespace itk
00098 
00099 
00100 #endif

Generated at Wed May 24 23:37:40 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000