DGtal::ColorMapInverter< PColorMap > Class Template Reference

Aim: This class template may be used to reverse an existing color map. More...

#include <ColorMapInverter.h>

Public Types

typedef PColorMap::ValueType ValueType

Public Member Functions

 ColorMapInverter (const PColorMap &aColorMap)
LibBoard::Color operator() (const ValueType &value) const
 ~ColorMapInverter ()
 ColorMapInverter (const ColorMapInverter &other)
ColorMapInverteroperator= (const ColorMapInverter &other)
void selfDisplay (std::ostream &out) const
bool isValid () const
const ValueTypemin () const
const ValueTypemax () const

Static Public Member Functions

static LibBoard::Color getColor (const PColorMap &aColorMap, const ValueType &aValue)

Protected Member Functions

 ColorMapInverter ()

Protected Attributes

ValueType myMin
ValueType myMax

Private Attributes

PColorMap myColorMap

Detailed Description

template<typename PColorMap>
class DGtal::ColorMapInverter< PColorMap >

Aim: This class template may be used to reverse an existing color map.

Description of template class 'ColorMapInverter'

A ColorMapInverter can be used either as a functor object 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. In both cases, an existing color map is used, whose range is simply considered from max to min.

The code below shows a possible use of this class.

 #include "Board/Color.h"
 #include "GrayScaleColorMap.h"
 #include "ColorMapInverter.h"
 // ...
 {
   typedef GrayScaleColorMap<float> GrayMap;
   GrayMap grayShade(0.0f,1000.0f)
   ColorMapInverter<GrayMap> iGrayShade(grayShade);
   LibBoard::Color white = grayShade(1.0f);
   LibBoard::Color black = iGrayShade(1.0f);
 }
Template Parameters:
PValueType The type of the range values.

Member Typedef Documentation

template<typename PColorMap>
typedef PColorMap::ValueType DGtal::ColorMapInverter< PColorMap >::ValueType

Constructor & Destructor Documentation

template<typename PColorMap>
DGtal::ColorMapInverter< PColorMap >::ColorMapInverter ( const PColorMap &  aColorMap  ) 

Constructor.

Parameters:
aColorMap A color map to be inverted.
template<typename PColorMap>
DGtal::ColorMapInverter< PColorMap >::~ColorMapInverter (  ) 

Destructor.

template<typename PColorMap>
DGtal::ColorMapInverter< PColorMap >::ColorMapInverter ( const ColorMapInverter< PColorMap > &  other  ) 

Copy constructor.

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

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


Member Function Documentation

template<typename PColorMap>
static LibBoard::Color DGtal::ColorMapInverter< PColorMap >::getColor ( const PColorMap &  aColorMap,
const ValueType aValue 
) [static]

Computes the color associated with a value in a given range. The range is the one of the associated color map, but considered from max to min.

Parameters:
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 which linearly depends on the position of [value] within the range [min]..[max].
template<typename PColorMap>
bool DGtal::ColorMapInverter< PColorMap >::isValid (  )  const

Checks the validity/consistency of the object.

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

Returns the upper bound of the value range.

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

Returns the lower bound of the value range.

Returns:
The lower bound of the value range.
template<typename PColorMap>
LibBoard::Color DGtal::ColorMapInverter< PColorMap >::operator() ( const ValueType value  )  const

Computes the colorassociated with a value in a given range.

Parameters:
value A value within the value range.
Returns:
A color which linearly and reversely depends on the position of [value] within the range of the color map used.
template<typename PColorMap>
ColorMapInverter& DGtal::ColorMapInverter< PColorMap >::operator= ( const ColorMapInverter< PColorMap > &  other  ) 

Assignment.

Parameters:
other the object to copy.
Returns:
a reference on 'this'.
template<typename PColorMap>
void DGtal::ColorMapInverter< PColorMap >::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 PColorMap>
PColorMap DGtal::ColorMapInverter< PColorMap >::myColorMap [private]
template<typename PColorMap>
ValueType DGtal::ColorMapInverter< PColorMap >::myMax [protected]

The lower bound of the value range.

template<typename PColorMap>
ValueType DGtal::ColorMapInverter< PColorMap >::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