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: 2006/03/29 14:53:40 $
00007   Version:   $Revision: 1.4 $
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   bool operator!=( const MatrixIndexSelection & other ) const
00038   {
00039     if( m_I != other.m_I ||
00040         m_J != other.m_J  )
00041         {
00042         return true;
00043         }
00044     return false;
00045    }
00046   bool operator==( const MatrixIndexSelection & other ) const
00047   {
00048     return !(*this != other);
00049   }
00050 
00051   inline TOutput operator()( const TInput & A )
00052   {
00053     return static_cast<TOutput>( A[m_I][m_J] );
00054   }
00055       
00056 private:
00057   unsigned int m_I, m_J;   
00058 }; 
00059 }
00060 
00077 template <class TInputImage, class TOutputImage>
00078 class ITK_EXPORT MatrixIndexSelectionImageFilter :
00079     public
00080 UnaryFunctorImageFilter<TInputImage,TOutputImage,Functor::MatrixIndexSelection< typename TInputImage::PixelType,typename TOutputImage::PixelType> >
00081 {
00082 public:
00084   typedef MatrixIndexSelectionImageFilter Self;
00085   typedef UnaryFunctorImageFilter<TInputImage,TOutputImage,Functor::MatrixIndexSelection<typename TInputImage::PixelType,typename TOutputImage::PixelType> > Superclass;
00086   typedef SmartPointer<Self> Pointer;
00087   typedef SmartPointer<const Self> ConstPointer;
00088 
00090   itkNewMacro(Self);
00091 
00093   void SetIndices(unsigned int i, unsigned int j)
00094     {
00095     this->GetFunctor().SetIndices(i,j);
00096     this->Modified();
00097     }
00099 
00100   void GetIndices(unsigned int& i, unsigned int& j) const
00101     { return this->GetFunctor().GetIndices(i,j); }
00102 
00103 #ifdef ITK_USE_CONCEPT_CHECKING
00104 
00105   itkConceptMacro(InputHasNumericTraitsCheck,
00106     (Concept::HasNumericTraits<typename TInputImage::PixelType::ValueType>));
00107 
00109 #endif
00110 
00111 protected:
00112   MatrixIndexSelectionImageFilter() {}
00113   virtual ~MatrixIndexSelectionImageFilter() {}
00114     
00115 private:
00116   MatrixIndexSelectionImageFilter(const Self&); //purposely not implemented
00117   void operator=(const Self&); //purposely not implemented
00118 };
00119  
00120 } // end namespace itk
00121 
00122 
00123 #endif
00124 

Generated at Sun Sep 23 13:27:27 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000