DGtal 1.3.0
Loading...
Searching...
No Matches
ColorBrightnessColorMap.h
1
17#pragma once
18
30#if defined(ColorBrightnessColorMap_RECURSES)
31#error Recursive header files inclusion detected in ColorBrightnessColorMap.h
32#else // defined(ColorBrightnessColorMap_RECURSES)
34#define ColorBrightnessColorMap_RECURSES
35
36#if !defined ColorBrightnessColorMap_h
38#define ColorBrightnessColorMap_h
39
41// Inclusions
42#include <iostream>
43#include "DGtal/base/Common.h"
44#include "Board/Board.h"
45#include "DGtal/io/Color.h"
47
48#ifndef DGTAL_RGB2INT
49#define DGTAL_RGB2INT(R,G,B) (((R)<<16)|((G)<<8)|(B))
50#define DGTAL_RED_COMPONENT(I) (((I)>>16)&0xFF)
51#define DGTAL_GREEN_COMPONENT(I) (((I)>>8)&0xFF)
52#define DGTAL_BLUE_COMPONENT(I) ((I)&0xFF)
53#endif
54
55namespace DGtal
56{
57
59 // template class ColorBrightnessColorMap
88 template <typename PValue, int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 ) >
90 {
91 public:
92
93 typedef PValue Value;
94
95 // ----------------------- Standard services ------------------------------
96 public:
97
106 const PValue & max,
107 const Color color
108 = Color( DGTAL_RED_COMPONENT( PDefaultColor ),
109 DGTAL_GREEN_COMPONENT( PDefaultColor ),
110 DGTAL_BLUE_COMPONENT( PDefaultColor ) ) );
111
119 Color operator()( const PValue & value ) const;
120
125
131
138
139 // ----------------------- Interface --------------------------------------
140 public:
141
146 void selfDisplay ( std::ostream & out ) const;
147
152 bool isValid() const;
153
159 const PValue & min() const;
160
166 const PValue & max() const;
167
168 // ----------------------- Static methods ---------------------------------
169
170
181 static Color getColor( const Color color,
182 const PValue & min,
183 const PValue & max,
184 const PValue & value );
185
186 // ------------------------- Protected Datas ------------------------------
187 private:
188
189 // ------------------------- Private Datas --------------------------------
190 private:
191
192 // ------------------------- Hidden services ------------------------------
193 protected:
194
195 PValue myMin;
196 PValue myMax;
204
205 // ------------------------- Internals ------------------------------------
206 private:
207
208
209
210 }; // end of class ColorBrightnessColorMap
211
212
219 template <typename PValue, int PDefaultColor>
220 std::ostream&
221 operator<< ( std::ostream & out, const ColorBrightnessColorMap<PValue,PDefaultColor> & object );
222
223} // namespace DGtal
224
225
227// Includes inline functions.
228#include "DGtal/io/colormaps/ColorBrightnessColorMap.ih"
229
230// //
232
233#endif // !defined ColorBrightnessColorMap_h
234
235#undef ColorBrightnessColorMap_RECURSES
236#endif // else defined(ColorBrightnessColorMap_RECURSES)
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
ColorBrightnessColorMap & operator=(const ColorBrightnessColorMap &other)
ColorBrightnessColorMap(const PValue &min, const PValue &max, const Color color=Color(DGTAL_RED_COMPONENT(PDefaultColor), DGTAL_GREEN_COMPONENT(PDefaultColor), DGTAL_BLUE_COMPONENT(PDefaultColor)))
Color operator()(const PValue &value) const
static Color getColor(const Color color, const PValue &min, const PValue &max, const PValue &value)
const PValue & max() const
const PValue & min() const
void selfDisplay(std::ostream &out) const
ColorBrightnessColorMap(const ColorBrightnessColorMap &other)
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)