DGtal
0.6.devel
|
#include <HueShadeColorMap.h>
Public Types | |
typedef PValue | Value |
Public Member Functions | |
HueShadeColorMap (const PValue &min, const PValue &max, const unsigned int cycles=DefaultCycles) | |
Color | operator() (const PValue &value) const |
~HueShadeColorMap () | |
HueShadeColorMap (const HueShadeColorMap &other) | |
HueShadeColorMap & | operator= (const HueShadeColorMap &other) |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
const PValue & | min () const |
const PValue & | max () const |
void | setCycles (int cycles) |
Static Public Member Functions | |
static Color | getColor (const unsigned int cycles, const PValue &min, const PValue &max, const PValue &value) |
Protected Member Functions | |
HueShadeColorMap () |
Protected Attributes | |
PValue | myMin |
PValue | 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) |
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. By default, only one hue cycle is used.
Description of template class 'HueShadeColorMap'
The HueShadeColorMap can be used either as a functor object (the value range is given at the object's construction) which converts a value into a Color structure, or it can be used through a static method taking both the range and the value as parameters.
The code below shows a possible use of this class.
PValue | The type of the range values. |
DefaultCycles | The default number of cycles (used as a default parameter by the constructor). |
Definition at line 101 of file HueShadeColorMap.h.
typedef PValue DGtal::HueShadeColorMap< PValue, DefaultCycles >::Value |
Definition at line 106 of file HueShadeColorMap.h.
|
inline |
Constructor.
min | The lower bound of the value range. |
max | The upper bound of the value range. |
cycles | The number of cycles in the colormap. |
Definition at line 45 of file HueShadeColorMap.ih.
|
inline |
|
inline |
Copy constructor.
other | the object to clone. |
Definition at line 55 of file HueShadeColorMap.ih.
|
protected |
Constructor. Forbidden by default (protected to avoid g++ warnings).
|
inlinestatic |
Computes the color associated with a value in a given range.
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. |
Definition at line 148 of file HueShadeColorMap.ih.
|
inlinestaticprivate |
Converts a color from the HSV (Hue,Saturation,Value) space to the RGB space.
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]. |
Definition at line 186 of file HueShadeColorMap.ih.
|
inline |
Checks the validity/consistency of the object.
Definition at line 139 of file HueShadeColorMap.ih.
|
inline |
Returns the upper bound of the value range.
Definition at line 93 of file HueShadeColorMap.ih.
|
inline |
Returns the lower bound of the value range.
Definition at line 85 of file HueShadeColorMap.ih.
|
inline |
Computes the color associated with a value in a given range.
value | A value within the value range. |
Definition at line 111 of file HueShadeColorMap.ih.
HueShadeColorMap< Value, DefaultCycles > & HueShadeColorMap::operator= | ( | const HueShadeColorMap< PValue, DefaultCycles > & | other | ) |
Assignment.
other | the object to copy. |
Definition at line 69 of file HueShadeColorMap.ih.
References DGtal::HueShadeColorMap< PValue, DefaultCycles >::myCycles, DGtal::HueShadeColorMap< PValue, DefaultCycles >::myMax, and DGtal::HueShadeColorMap< PValue, DefaultCycles >::myMin.
|
inline |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Definition at line 123 of file HueShadeColorMap.ih.
|
inline |
Sets the number of cycles of hue shade.
cycles | Number of cycles. |
Definition at line 101 of file HueShadeColorMap.ih.
|
protected |
The number of cycles in the color map.
Definition at line 215 of file HueShadeColorMap.h.
Referenced by DGtal::HueShadeColorMap< PValue, DefaultCycles >::operator=().
|
protected |
The lower bound of the value range.
Definition at line 214 of file HueShadeColorMap.h.
Referenced by DGtal::HueShadeColorMap< PValue, DefaultCycles >::operator=().
|
protected |
The lower bound of the value range.
Definition at line 213 of file HueShadeColorMap.h.
Referenced by DGtal::HueShadeColorMap< PValue, DefaultCycles >::operator=().