KWStyle - itkAddPixelAccessor.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkAddPixelAccessor.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:32 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 #ifndef __itkAddPixelAccessor_h
18 #define __itkAddPixelAccessor_h
19
20
21 EML
22 namespace itk
23 {
24 namespace Accessor
25 {
26
27 /** \class AddPixelAccessor
28  * \brief Simulates the effect of adding a constant value to all pixels
29  *
30  * This class is intended to be used as parameter of 
31  * an ImageAdaptor to make an image appear as having 
32  * pixels with intensity values increased by a constant amount.
33  *
34  * \sa ImageAdaptor
35  * \ingroup ImageAdaptors
36  */
37
38 template <class TPixel>
39 class ITK_EXPORT AddPixelAccessor
40 {
41 public:
42   /** Standard class typedefs. */
43   typedef   AddPixelAccessor        Self;
44
45 IND */** External typedef. It defines the external aspect
46    * that this class will exhibit */
47   typedef     TPixel      ExternalType;
48
49   /** Internal typedef. It defines the internal real
50    * representation of data */
51   typedef     TPixel      InternalType;
52
53   /** Write access to the pixel */
54   inline void Set( InternalType & output, const ExternalType & input ) const
55     { output = static_cast<InternalType>( input - m_Value ); }
56
57   /** Read access to the pixel */
58   inline ExternalType Get( const InternalType & input ) const
59     { return static_cast<ExternalType>( input + m_Value ); }
60
61   /** Set the value to be added to pixels */
62   void SetValue( TPixel newvalue )
63     { m_Value = newvalue; }
64
65   /** Get the value to be added to pixels */
66   TPixel GetValue() 
67     { return m_Value; }
68
69   /** Assignment Operator */
70   Self & operator=( const Self & apa )
71     { this->m_Value = apa.m_Value;
72 IND ******return *this; }
73
74   /** Constructors */
75   AddPixelAccessor():m_Value( NumericTraits<TPixel>::Zero ) {}
76   AddPixelAccessor( const Self & apa ):m_Value(apa.m_Value) {}
77   
78 private:
79
80   TPixel m_Value;
81
82 };
83
84   
85   
86 }  // end namespace Accessor
87 }  // end namespace itk
88
89
90 #endif
91
92 EOF

Generated by KWStyle 1.0b on Tuesday January,17 at 02:13:58PM
© Kitware Inc.