itkAddPixelAccessor.h
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 __itkAddPixelAccessor_h
00018 #define __itkAddPixelAccessor_h
00019
00020
00021 namespace itk
00022 {
00023 namespace Accessor
00024 {
00025
00037 template <class TPixel>
00038 class ITK_EXPORT AddPixelAccessor
00039 {
00040 public:
00042 typedef AddPixelAccessor Self;
00043
00046 typedef TPixel ExternalType;
00047
00050 typedef TPixel InternalType;
00051
00053 inline void Set( InternalType & output, const ExternalType & input ) const
00054 { output = static_cast<InternalType>( input - m_Value ); }
00055
00057 inline ExternalType Get( const InternalType & input ) const
00058 { return static_cast<ExternalType>( input + m_Value ); }
00059
00061 void SetValue( TPixel newvalue )
00062 { m_Value = newvalue; }
00063
00065 TPixel GetValue()
00066 { return m_Value; }
00067
00069 Self & operator=( const Self & apa )
00070 {
00071 this->m_Value = apa.m_Value;
00072 return *this;
00073 }
00074
00076 AddPixelAccessor():m_Value( NumericTraits<TPixel>::Zero ) {}
00077 AddPixelAccessor( const Self & apa ):m_Value(apa.m_Value) {}
00079
00080 private:
00081
00082 TPixel m_Value;
00083
00084 };
00085
00086
00087
00088 }
00089 }
00090
00091
00092 #endif
00093