KWStyle - itkPixelAccessor.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkPixelAccessor.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:43 $
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 __itkPixelAccessor_h
18 #define __itkPixelAccessor_h
19
20 #include "itkMacro.h"
21 namespace itk
22 {
23
24 /** \class PixelAccessor
25  * \brief Give access to partial aspects of a type
26  *
27  * PixelAccessor is templated over an internal type and an
28  * external type representation. This class encapsulates a
29  * customized convertion between the internal and external
30  * type representations.
31  *
32  * PixelAccessor is designed to be used in conjuntion with
33  * ImageAdaptors. An ImageAdaptor take an image and present it
34  * as another image in which the pixels are a pixel-to-pixel
35  * modification of the original image.
36  *
37  * ImageAdaptors are intended to perform task similar to ImageFilters,
38  * but reducing the overhead in memory allocation, at the price of some
39  * reduction in performance.
40  *
41  * ImageAdaptors are templated over a PixelAccessor class that
42  * will define what kind of transformation is applied to the 
43  * pixel data.  Typical uses of PixelAccessor include basic type
44  * casting, (e.g. make a float image looks like a unsigned int image).
45  *
46  * Every Image has a default PixelAccessor that performs an identity
47  * operation. ImageIterators use the PixelAccessor defined by the image
48  * in order to get and set the values of pixels.
49  *
50  * \ingroup ImageAdaptors
51  */
52 template <class TInternalType, class TExternalType >
53 class ITK_EXPORT PixelAccessor  
54 {
55 public:
56   /** External typedef. It defines the external aspect
57    * that this class will exhibit. */
58   typedef TExternalType ExternalType;
59
60   /** Internal typedef. It defines the internal real
61    * representation of data. */
62   typedef TInternalType InternalType;
63
64   inline void Set(TInternalType & output, const TExternalType & input) const
65     {output = (TInternalType) input;}
66
67   inline TExternalType Get( const TInternalType & input ) const
68     {return (TExternalType)input;}
69 };
70   
71 // end namespace itk
72   
73
74 #endif
75
76 EOF

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