| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkVectorToRGBPixelAccessor.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:49 $ |
| 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 __itkVectorToRGBPixelAccessor_h |
| 18 |
|
#define __itkVectorToRGBPixelAccessor_h |
| 19 |
|
|
| 20 |
|
|
| 21 |
|
#include "itkRGBPixel.h" |
| 22 |
|
#include "itkVector.h" |
| 23 |
|
|
| 24 |
|
|
| 25 |
|
namespace itk |
| 26 |
|
{ |
| 27 |
|
namespace Accessor |
| 28 |
|
{ |
| 29 |
|
/** |
| 30 |
|
* \class VectorToRGBPixelAccessor |
| 31 |
|
* \brief Give access to a Vector pixel type as if it were a RGBPixel type. |
| 32 |
|
* |
| 33 |
|
* This class is intended to be used as parameter of |
| 34 |
|
* an ImageAdaptor to make an Vector image appear as being |
| 35 |
|
* an image of RGB pixel type. |
| 36 |
|
* |
| 37 |
|
* \sa ImageAdaptor |
| 38 |
|
* \ingroup ImageAdaptors |
| 39 |
|
* |
| 40 |
|
*/ |
| 41 |
|
|
| 42 |
|
template <class T> |
| 43 |
|
class ITK_EXPORT VectorToRGBPixelAccessor |
| 44 |
|
{ |
| 45 |
|
public: |
| 46 |
|
/** Standard class typedefs. */ |
| 47 |
|
typedef VectorToRGBPixelAccessor Self; |
| 48 |
|
|
| 49 |
IND |
*/** External typedef. It defines the external aspect |
| 50 |
|
* that this class will exhibit */ |
| 51 |
|
typedef RGBPixel<T> ExternalType; |
| 52 |
|
|
| 53 |
|
/** Internal typedef. It defines the internal real |
| 54 |
|
* representation of data */ |
| 55 |
|
typedef Vector<T,3> InternalType; |
| 56 |
|
|
| 57 |
|
/** Write access to the VectorToRGB component */ |
| 58 |
|
inline void Set( InternalType & output, const ExternalType & input ) const |
| 59 |
|
{ |
| 60 |
|
output[0] = input[0]; |
| 61 |
|
output[1] = input[1]; |
| 62 |
|
output[2] = input[2]; |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
/** Read access to the VectorToRGB component */ |
| 66 |
|
inline ExternalType Get( const InternalType & input ) const |
| 67 |
|
{ |
| 68 |
|
ExternalType rgb(input.GetDataPointer()); |
| 69 |
|
return rgb; |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
private: |
| 73 |
|
}; |
| 74 |
|
|
| 75 |
|
} // end namespace Accessor |
| 76 |
|
} // end namespace itk |
| 77 |
|
|
| 78 |
|
#endif |
| 79 |
|
|
| 80 |
EOF |
|