DGtal  0.9.4beta
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
DGtal::TickedColorMap< TValue, TColorMap > Class Template Reference

#include <DGtal/io/colormaps/TickedColorMap.h>

Collaboration diagram for DGtal::TickedColorMap< TValue, TColorMap >:
[legend]

Public Types

typedef TValue Value
 
typedef TColorMap ColorMap
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CColorMap< ColorMap >))
 
 BOOST_STATIC_ASSERT ((concepts::ConceptUtils::SameType< Value, typename ColorMap::Value >::value))
 
 TickedColorMap (const Value &aMin, const Value &aMax, const Color &color=Color::White)
 
Color operator() (const Value &value) const
 
 ~TickedColorMap ()
 
 TickedColorMap (const TickedColorMap &other)
 
TickedColorMapoperator= (const TickedColorMap &other)
 
void addTick (const Value position, const Value thickness)
 
void addRegularTicks (const unsigned int nbTicks, const Value thickness)
 
void finalize ()
 
ColorMapcolormap () const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
const Valuemin () const
 
const Valuemax () const
 

Protected Member Functions

 TickedColorMap ()
 

Protected Attributes

Value myMin
 
Value myMax
 
ColorMapmyColorMap
 
Color myTickColor
 
std::vector< std::pair< Value, Value > > myTicks
 

Detailed Description

template<typename TValue, typename TColorMap>
class DGtal::TickedColorMap< TValue, TColorMap >

Aim: This class adapts any colormap to add "ticks" in the colormap colors.

Description of template class 'TickedColorMap'

Ticks are characterized by a position and a width in the adapted colormap range. When the value falls in a tick, the colormap color is replaced by the color provided in the constructor.

For example, on a colormap, this class can be used to create white ticks with regular spacing, or locate zero-crossing of a curvature map for instance (i.e. with a single tick at zero).

This class is a model of concepts::CColorMap.

Template Parameters
TValueThe type of the range values.
TColorMapThe type of colormap to Adapt (the value type of TColorMap must be TValue).
Examples:
geometry/volumes/distance/distancetransform2D.cpp, and geometry/volumes/distance/toricdomainvolumetric.cpp.

Definition at line 78 of file TickedColorMap.h.

Member Typedef Documentation

template<typename TValue, typename TColorMap>
typedef TColorMap DGtal::TickedColorMap< TValue, TColorMap >::ColorMap

Adapted colormap type.

Definition at line 87 of file TickedColorMap.h.

template<typename TValue, typename TColorMap>
typedef TValue DGtal::TickedColorMap< TValue, TColorMap >::Value

Value type.

Definition at line 84 of file TickedColorMap.h.

Constructor & Destructor Documentation

template<typename TValue, typename TColorMap>
DGtal::TickedColorMap< TValue, TColorMap >::TickedColorMap ( const Value aMin,
const Value aMax,
const Color color = Color::White 
)

Constructor.

Precondition
aMin < aMax.
Parameters
aMinThe lower bound of the value range.
aMaxThe upper bound of the value range.
colorthe color of the ticks.
template<typename TValue, typename TColorMap>
DGtal::TickedColorMap< TValue, TColorMap >::~TickedColorMap ( )

Destructor.

template<typename TValue, typename TColorMap>
DGtal::TickedColorMap< TValue, TColorMap >::TickedColorMap ( const TickedColorMap< TValue, TColorMap > &  other)

Copy constructor.

Parameters
otherthe object to clone.
template<typename TValue, typename TColorMap>
DGtal::TickedColorMap< TValue, TColorMap >::TickedColorMap ( )
protected

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

Member Function Documentation

template<typename TValue, typename TColorMap>
void DGtal::TickedColorMap< TValue, TColorMap >::addRegularTicks ( const unsigned int  nbTicks,
const Value  thickness 
)

Add regularly spaced ticks in the range [myMin,myMax].

Parameters
nbTicksthe number of regular ticks.
thicknessticks thickness.
template<typename TValue, typename TColorMap>
void DGtal::TickedColorMap< TValue, TColorMap >::addTick ( const Value  position,
const Value  thickness 
)

Add a tick at a given position of the range [myMin, myMax].

Parameters
positiontick position.
thicknesstick thickness.
template<typename TValue, typename TColorMap>
DGtal::TickedColorMap< TValue, TColorMap >::BOOST_CONCEPT_ASSERT ( (concepts::CColorMap< ColorMap >)  )
template<typename TValue, typename TColorMap>
DGtal::TickedColorMap< TValue, TColorMap >::BOOST_STATIC_ASSERT ( (concepts::ConceptUtils::SameType< Value, typename ColorMap::Value >::value)  )
template<typename TValue, typename TColorMap>
ColorMap* DGtal::TickedColorMap< TValue, TColorMap >::colormap ( ) const
inline
Returns
a pointer to the underlying colormap

Definition at line 170 of file TickedColorMap.h.

References DGtal::TickedColorMap< TValue, TColorMap >::myColorMap.

171  {
172  return myColorMap;
173  }
template<typename TValue, typename TColorMap>
void DGtal::TickedColorMap< TValue, TColorMap >::finalize ( )

Finalize the insert ticks (this will sort the tick vector). This method must be called before any color access if you change the tick set.

template<typename TValue, typename TColorMap>
bool DGtal::TickedColorMap< TValue, TColorMap >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.
template<typename TValue, typename TColorMap>
const Value& DGtal::TickedColorMap< TValue, TColorMap >::max ( ) const

Returns the upper bound of the value range.

Returns
The upper bound of the value range.
template<typename TValue, typename TColorMap>
const Value& DGtal::TickedColorMap< TValue, TColorMap >::min ( ) const

Returns the lower bound of the value range.

Returns
The lower bound of the value range.
template<typename TValue, typename TColorMap>
Color DGtal::TickedColorMap< TValue, TColorMap >::operator() ( const Value value) const

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

Note
This operation has a complexity in \( log(N)\) where \( N\) is the number of ticks.
Parameters
valueA value within the value range.
Returns
A color.
template<typename TValue, typename TColorMap>
TickedColorMap& DGtal::TickedColorMap< TValue, TColorMap >::operator= ( const TickedColorMap< TValue, TColorMap > &  other)

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.
template<typename TValue, typename TColorMap>
void DGtal::TickedColorMap< TValue, TColorMap >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

Field Documentation

template<typename TValue, typename TColorMap>
ColorMap* DGtal::TickedColorMap< TValue, TColorMap >::myColorMap
protected

Underlying colormap.

Definition at line 207 of file TickedColorMap.h.

Referenced by DGtal::TickedColorMap< TValue, TColorMap >::colormap().

template<typename TValue, typename TColorMap>
Value DGtal::TickedColorMap< TValue, TColorMap >::myMax
protected

The lower bound of the value range.

Definition at line 206 of file TickedColorMap.h.

template<typename TValue, typename TColorMap>
Value DGtal::TickedColorMap< TValue, TColorMap >::myMin
protected

The lower bound of the value range.

Definition at line 205 of file TickedColorMap.h.

template<typename TValue, typename TColorMap>
Color DGtal::TickedColorMap< TValue, TColorMap >::myTickColor
protected

The tick color.

Definition at line 208 of file TickedColorMap.h.

template<typename TValue, typename TColorMap>
std::vector< std::pair<Value,Value> > DGtal::TickedColorMap< TValue, TColorMap >::myTicks
protected

Sorted vector of ticks.

Definition at line 211 of file TickedColorMap.h.


The documentation for this class was generated from the following file: