| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkScalarToRGBPixelFunctor.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:47 $ |
| 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 |
DEF |
#ifndef _itkScalarToRGBPixelFunctor_h |
| 18 |
DEF |
#define _itkScalarToRGBPixelFunctor_h |
| 19 |
|
|
| 20 |
|
#include "itkRGBPixel.h" |
| 21 |
|
|
| 22 |
|
namespace itk { |
| 23 |
|
|
| 24 |
|
namespace Functor { |
| 25 |
|
|
| 26 |
|
/** |
| 27 |
|
* \class ScalarToRGBPixelFunctor |
| 28 |
|
* \brief Function object which maps a scalar value into an RGB pixel value. |
| 29 |
|
* |
| 30 |
|
* This class is useful for visualizing labeled images which cannot be mapped |
| 31 |
|
* succefully into grayscale images. Images of unsigned long integers, for |
| 32 |
|
* example may have too many graylevels to visualize effectively. |
| 33 |
|
* |
| 34 |
|
* The hashing scheme used is designed to spread close scalar values very |
| 35 |
|
* different colors by using the least significant bits (fastest changing) of |
| 36 |
|
* the scalar type to determine the color. Because labeled images may |
| 37 |
|
* typically use sequential values, it is desirable that those values result |
| 38 |
|
* in easily discernable colors. |
| 39 |
|
* |
| 40 |
|
*/ |
| 41 |
|
template< class TScalar > |
| 42 |
|
class ITK_EXPORT ScalarToRGBPixelFunctor |
| 43 |
|
{ |
| 44 |
|
public: |
| 45 |
|
ScalarToRGBPixelFunctor(); |
| 46 |
|
~ScalarToRGBPixelFunctor() {}; |
| 47 |
|
|
| 48 |
|
typedef unsigned char RGBComponentType; |
| 49 |
|
typedef RGBPixel<RGBComponentType> RGBPixelType; |
| 50 |
|
typedef TScalar ScalarType; |
| 51 |
|
|
| 52 |
|
RGBPixelType operator()( const TScalar &) const; |
| 53 |
|
|
| 54 |
|
void SetLittleEndian() |
| 55 |
IND |
**{ |
| 56 |
|
m_IsBigEndian = false; |
| 57 |
IND |
**} |
| 58 |
|
void SetBigEndian() |
| 59 |
IND |
**{ |
| 60 |
|
m_IsBigEndian = true; |
| 61 |
IND |
**} |
| 62 |
|
|
| 63 |
|
private: |
| 64 |
|
bool m_IsBigEndian; |
| 65 |
|
::size_t m_Index[3]; |
| 66 |
|
|
| 67 |
|
}; |
| 68 |
|
|
| 69 |
|
} // end namespace functor |
| 70 |
|
|
| 71 |
|
} // end namespace itk |
| 72 |
|
|
| 73 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 74 |
|
#include "itkScalarToRGBPixelFunctor.txx" |
| 75 |
|
#endif |
| 76 |
|
|
| 77 |
|
#endif |
| 78 |
|
|