00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkAddPixelAccessor_h
00018 #define __itkAddPixelAccessor_h
00019
00020
00021
00022 namespace itk
00023 {
00024 namespace Accessor
00025 {
00026
00038 template <class TPixel>
00039 class ITK_EXPORT AddPixelAccessor
00040 {
00041 public:
00043 typedef AddPixelAccessor Self;
00044
00047 typedef TPixel ExternalType;
00048
00051 typedef TPixel InternalType;
00052
00054 inline void Set( InternalType & output, const ExternalType & input ) const
00055 { output = static_cast<InternalType>( input - m_Value ); }
00056
00058 inline ExternalType Get( const InternalType & input ) const
00059 { return static_cast<ExternalType>( input + m_Value ); }
00060
00062 void SetValue( TPixel newvalue )
00063 { m_Value = newvalue; }
00064
00066 TPixel GetValue()
00067 { return m_Value; }
00068
00070 Self & operator=( const Self & apa )
00071 { this->m_Value = apa.m_Value;
00072 return *this; }
00073
00075 AddPixelAccessor():m_Value( NumericTraits<TPixel>::Zero ) {}
00076 AddPixelAccessor( const Self & apa ):m_Value(apa.m_Value) {}
00077
00078 private:
00079
00080 TPixel m_Value;
00081
00082 };
00083
00084
00085
00086 }
00087 }
00088
00089
00090 #endif
00091