DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
DGtal::TickedColorMap< TValue, TColorMap > Class Template Reference

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

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

Public Types

typedef TValue Value
 Value type. More...
 
typedef TColorMap ColorMap
 Adapted colormap type. More...
 

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)
 
 TickedColorMap (const ColorMap &other, 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
 Sorted vector of ticks. More...
 

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

◆ ColorMap

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

Adapted colormap type.

Definition at line 87 of file TickedColorMap.h.

◆ Value

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

◆ TickedColorMap() [1/4]

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.

◆ TickedColorMap() [2/4]

template<typename TValue , typename TColorMap >
DGtal::TickedColorMap< TValue, TColorMap >::TickedColorMap ( const ColorMap other,
const Color color = Color::White 
)

Constructor from colormap

Precondition
aMin < aMax.
Parameters
otherthe background colormap (copied).
colorthe color of the ticks.

◆ ~TickedColorMap()

template<typename TValue , typename TColorMap >
DGtal::TickedColorMap< TValue, TColorMap >::~TickedColorMap ( )

Destructor.

◆ TickedColorMap() [3/4]

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

Copy constructor.

Parameters
otherthe object to clone.

◆ TickedColorMap() [4/4]

template<typename TValue , typename TColorMap >
DGtal::TickedColorMap< TValue, TColorMap >::TickedColorMap ( )
protected

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

Member Function Documentation

◆ addRegularTicks()

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.

Referenced by main(), and testCMAP().

◆ addTick()

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.

Referenced by testCMAP(), and testTickedColorMap().

◆ BOOST_CONCEPT_ASSERT()

template<typename TValue , typename TColorMap >
DGtal::TickedColorMap< TValue, TColorMap >::BOOST_CONCEPT_ASSERT ( (concepts::CColorMap< ColorMap >)  )

◆ BOOST_STATIC_ASSERT()

template<typename TValue , typename TColorMap >
DGtal::TickedColorMap< TValue, TColorMap >::BOOST_STATIC_ASSERT ( (concepts::ConceptUtils::SameType< Value, typename ColorMap::Value >::value)  )

◆ colormap()

template<typename TValue , typename TColorMap >
ColorMap * DGtal::TickedColorMap< TValue, TColorMap >::colormap ( ) const
inline
Returns
a pointer to the underlying colormap

Definition at line 181 of file TickedColorMap.h.

182 {
183 return myColorMap;
184 }

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

Referenced by main(), and testCMAP().

◆ finalize()

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.

Referenced by main(), testCMAP(), and testTickedColorMap().

◆ isValid()

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.

◆ max()

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.

◆ min()

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.

◆ operator()()

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.

◆ operator=()

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'.

◆ selfDisplay()

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

◆ myColorMap

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

Underlying colormap.

Definition at line 218 of file TickedColorMap.h.

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

◆ myMax

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

The lower bound of the value range.

Definition at line 217 of file TickedColorMap.h.

◆ myMin

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

The lower bound of the value range.

Definition at line 216 of file TickedColorMap.h.

◆ myTickColor

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

The tick color.

Definition at line 219 of file TickedColorMap.h.

◆ myTicks

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

Sorted vector of ticks.

Definition at line 222 of file TickedColorMap.h.


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