DGtal::CyclicHueColorMap< PValueType > Class Template Reference

Aim: This class template may be used to (linearly) convert scalar values in a given range into a color in a cyclic hue shade colormap, maybe aka rainbow color map. This color map is suitable, for example, to colorize distance functions. More...

#include <CyclicHueColorMap.h>

Public Types

typedef PValueType ValueType

Public Member Functions

 CyclicHueColorMap (const PValueType &min, const PValueType &max, const unsigned int cycles=5)
LibBoard::Color operator() (const PValueType &value) const
 ~CyclicHueColorMap ()
 CyclicHueColorMap (const CyclicHueColorMap &other)
CyclicHueColorMapoperator= (const CyclicHueColorMap &other)
void selfDisplay (std::ostream &out) const
bool isValid () const
const PValueType & min () const
const PValueType & max () const

Static Public Member Functions

static LibBoard::Color getColor (const unsigned int cycles, const PValueType &min, const PValueType &max, const PValueType &value)

Protected Member Functions

 CyclicHueColorMap ()

Protected Attributes

PValueType myMin
PValueType myMax
unsigned int myCycles

Static Private Member Functions

static void HSVtoRGB (double &r, double &g, double &b, double h, const double s, const double v)

Detailed Description

template<typename PValueType>
class DGtal::CyclicHueColorMap< PValueType >

Aim: This class template may be used to (linearly) convert scalar values in a given range into a color in a cyclic hue shade colormap, maybe aka rainbow color map. This color map is suitable, for example, to colorize distance functions.

Description of template class 'CyclicHueColorMap'

The CyclicHueColorMap can be used either as a functor object (the value range is given at the object's construction) which converts a value into a LibBoard::Color structure, or it can be used through a static method taking both the range and the value as parameters.

Template Parameters:
PValueType The type of the range values.

Member Typedef Documentation

template<typename PValueType>
typedef PValueType DGtal::CyclicHueColorMap< PValueType >::ValueType

Constructor & Destructor Documentation

template<typename PValueType>
DGtal::CyclicHueColorMap< PValueType >::CyclicHueColorMap ( const PValueType &  min,
const PValueType &  max,
const unsigned int  cycles = 5 
)

Constructor.

Parameters:
min The lower bound of the value range.
max The upper bound of the value range.
cycles The number of cycles in the colormap.
template<typename PValueType>
DGtal::CyclicHueColorMap< PValueType >::~CyclicHueColorMap (  ) 

Destructor.

template<typename PValueType>
DGtal::CyclicHueColorMap< PValueType >::CyclicHueColorMap ( const CyclicHueColorMap< PValueType > &  other  ) 

Copy constructor.

Parameters:
other the object to clone.
template<typename PValueType>
DGtal::CyclicHueColorMap< PValueType >::CyclicHueColorMap (  )  [protected]

Constructor. Forbidden by default (protected to avoid g++ warnings).


Member Function Documentation

template<typename PValueType>
static LibBoard::Color DGtal::CyclicHueColorMap< PValueType >::getColor ( const unsigned int  cycles,
const PValueType &  min,
const PValueType &  max,
const PValueType &  value 
) [static]

Computes the color associated with a value in a given range.

Parameters:
cycles The number of (rainbow) cycles.
min The lower bound of the value range.
max The upper bound of the value range.
value A value within the value range.
Returns:
A color whose hue linearly depends on the position of [value] within the range [min]..[max].
template<typename PValueType>
static void DGtal::CyclicHueColorMap< PValueType >::HSVtoRGB ( double &  r,
double &  g,
double &  b,
double  h,
const double  s,
const double  v 
) [static, private]

Converts a color from the HSV (Hue,Saturation,Value) space to the RGB space.

Parameters:
r The red component (out).
g The green component (out).
b The blue component (out).
h The hue of the color in [0..360)
s The saturation of the color in [0..1].
v The value of the color in [0..1].
template<typename PValueType>
bool DGtal::CyclicHueColorMap< PValueType >::isValid (  )  const

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.
template<typename PValueType>
const PValueType& DGtal::CyclicHueColorMap< PValueType >::max (  )  const

Returns the upper bound of the value range.

Returns:
The upper bound of the value range.
template<typename PValueType>
const PValueType& DGtal::CyclicHueColorMap< PValueType >::min (  )  const

Returns the lower bound of the value range.

Returns:
The lower bound of the value range.
template<typename PValueType>
LibBoard::Color DGtal::CyclicHueColorMap< PValueType >::operator() ( const PValueType &  value  )  const

Computes the color associated with a value in a given range.

Parameters:
value A value within the value range.
Returns:
A color whose hue linearly depends on the position of [value] within the current range.
template<typename PValueType>
CyclicHueColorMap& DGtal::CyclicHueColorMap< PValueType >::operator= ( const CyclicHueColorMap< PValueType > &  other  ) 

Assignment.

Parameters:
other the object to copy.
Returns:
a reference on 'this'.
template<typename PValueType>
void DGtal::CyclicHueColorMap< PValueType >::selfDisplay ( std::ostream &  out  )  const

Writes/Displays the object on an output stream.

Parameters:
out the output stream where the object is written.

Field Documentation

template<typename PValueType>
unsigned int DGtal::CyclicHueColorMap< PValueType >::myCycles [protected]

The number of cycles in the color map.

template<typename PValueType>
PValueType DGtal::CyclicHueColorMap< PValueType >::myMax [protected]

The lower bound of the value range.

template<typename PValueType>
PValueType DGtal::CyclicHueColorMap< PValueType >::myMin [protected]

The lower bound of the value range.


The documentation for this class was generated from the following file:
Generated on Thu Jul 22 15:04:58 2010 for DGtal by  doxygen 1.6.3