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: 2009-04-01 14:36:30 $
00007   Version:   $Revision: 1.7 $
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 ) const
00052     {
00053     return static_cast<TOutput>( A[m_I][m_J] );
00054     }
00055       
00056 private:
00057   unsigned int m_I;
00058   unsigned int m_J;
00059 }; 
00060 }
00061 
00078 template <class TInputImage, class TOutputImage>
00079 class ITK_EXPORT MatrixIndexSelectionImageFilter :
00080     public
00081 UnaryFunctorImageFilter<TInputImage,TOutputImage,Functor::MatrixIndexSelection< typename TInputImage::PixelType,typename TOutputImage::PixelType> >
00082 {
00083 public:
00085   typedef MatrixIndexSelectionImageFilter Self;
00086   typedef UnaryFunctorImageFilter<TInputImage,TOutputImage,Functor::MatrixIndexSelection<typename TInputImage::PixelType,typename TOutputImage::PixelType> > Superclass;
00087   typedef SmartPointer<Self>       Pointer;
00088   typedef SmartPointer<const Self> ConstPointer;
00089 
00091   itkTypeMacro( MatrixIndexSelectionImageFilter, UnaryFunctorImageFilter );
00092 
00094   itkNewMacro(Self);
00095 
00097   void SetIndices(unsigned int i, unsigned int j)
00098     {
00099     this->GetFunctor().SetIndices(i,j);
00100     this->Modified();
00101     }
00103 
00104   void GetIndices(unsigned int& i, unsigned int& j) const
00105     { return this->GetFunctor().GetIndices(i,j); }
00106 
00107 #ifdef ITK_USE_CONCEPT_CHECKING
00108 
00109   itkConceptMacro(InputHasNumericTraitsCheck,
00110     (Concept::HasNumericTraits<typename TInputImage::PixelType::ValueType>));
00111 
00113 #endif
00114 
00115 protected:
00116   MatrixIndexSelectionImageFilter() {}
00117   virtual ~MatrixIndexSelectionImageFilter() {}
00118     
00119 private:
00120   MatrixIndexSelectionImageFilter(const Self&); //purposely not implemented
00121   void operator=(const Self&); //purposely not implemented
00122 };
00123  
00124 } // end namespace itk
00125 
00126 
00127 #endif
00128 

Generated at Tue Sep 15 03:54:31 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000