Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkNthElementPixelAccessor_h
00018 #define __itkNthElementPixelAccessor_h
00019
00020 #include "itkMacro.h"
00021
00022 namespace itk
00023 {
00024
00047 template < class T, class TContainer >
00048 class ITK_EXPORT NthElementPixelAccessor
00049 {
00050 public:
00052 typedef NthElementPixelAccessor Self;
00053
00055 typedef T ExternalType;
00056
00059 typedef TContainer InternalType;
00060
00062 inline void Set( InternalType & output, const ExternalType & input ) const
00063 { output[m_ElementNumber] = input; }
00064
00066 inline ExternalType Get( const InternalType & input ) const
00067 { return static_cast<ExternalType>( input[m_ElementNumber] ); }
00068
00070 unsigned int GetElementNumber(void) const
00071 { return m_ElementNumber; }
00072
00074 void SetElementNumber( unsigned int nth )
00075 { m_ElementNumber = nth; }
00076
00079 bool operator!=(const Self& accessor) const
00080 {
00081 return (m_ElementNumber != accessor.m_ElementNumber);
00082 }
00083
00085 NthElementPixelAccessor & operator=( const NthElementPixelAccessor & accessor )
00086 {
00087 m_ElementNumber = accessor.m_ElementNumber;
00088 return *this;
00089 }
00090
00092 NthElementPixelAccessor()
00093 {
00094 m_ElementNumber = 0;
00095 }
00096
00097 private:
00098
00099 unsigned int m_ElementNumber;
00100
00101 };
00102
00103
00104 }
00105
00106 #endif
00107