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: 2007-10-27 19:51:42 $
00007   Version:   $Revision: 1.5 $
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   itkTypeMacro( MatrixIndexSelectionImageFilter, UnaryFunctorImageFilter );
00091 
00093   itkNewMacro(Self);
00094 
00096   void SetIndices(unsigned int i, unsigned int j)
00097     {
00098     this->GetFunctor().SetIndices(i,j);
00099     this->Modified();
00100     }
00102 
00103   void GetIndices(unsigned int& i, unsigned int& j) const
00104     { return this->GetFunctor().GetIndices(i,j); }
00105 
00106 #ifdef ITK_USE_CONCEPT_CHECKING
00107 
00108   itkConceptMacro(InputHasNumericTraitsCheck,
00109     (Concept::HasNumericTraits<typename TInputImage::PixelType::ValueType>));
00110 
00112 #endif
00113 
00114 protected:
00115   MatrixIndexSelectionImageFilter() {}
00116   virtual ~MatrixIndexSelectionImageFilter() {}
00117     
00118 private:
00119   MatrixIndexSelectionImageFilter(const Self&); //purposely not implemented
00120   void operator=(const Self&); //purposely not implemented
00121 };
00122  
00123 } // end namespace itk
00124 
00125 
00126 #endif
00127 

Generated at Mon Apr 14 13:27:23 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000