00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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&);
00094 void operator=(const Self&);
00095 };
00096
00097 }
00098
00099
00100 #endif