ddt 1.4.0
 
Loading...
Searching...
No Matches
imageColor.hpp
Go to the documentation of this file.
1
10
11#ifndef IMAGECOLOR_HPP
12#define IMAGECOLOR_HPP
13
14#include <sys/stat.h>
15
16#include <algorithm>
17#include <cctype>
18#include <unordered_map>
19
20#include "boost/filesystem.hpp"
21
22#include <cpl.h>
23#undef I
24#undef arg
25
27#include "ddt/dataFile.hpp"
28#include "ddt/ddtLogger.hpp"
29#include "ddt/imageError.hpp"
30#include "ddt/imageIO.hpp"
31#include "ddt/imageProc.hpp"
32#include "ddt/imageStats.hpp"
33
34namespace ddt {
35
36constexpr size_t MAX_SCALING_LUT_ENTRIES = 65536;
37constexpr uint MAX_SCALING_LUT_VALUE = 65535;
38constexpr size_t MAX_COLOR_MAP_ENTRIES = 256;
39constexpr size_t MAX_COLOR_MAP_VALUE = 255;
40constexpr size_t COLOR_MAP_ENTRY_SIZE = 3;
41
48using colorMap_t = std::array<std::array<float, COLOR_MAP_ENTRY_SIZE>, MAX_COLOR_MAP_ENTRIES>;
49
58using colorMapARGB_t = std::array<unsigned int, MAX_COLOR_MAP_ENTRIES>;
59
68typedef struct scalingLut_t {
72 std::array<uint, MAX_SCALING_LUT_ENTRIES> lut;
77 double offset;
82 double factor;
84
92 public:
96 ImageColor();
97
101 virtual ~ImageColor();
102
107 void set_logger(ddt::DdtLogger* const in_logger);
108
113 void LoadColorMaps(const std::string color_map_folder);
114
123 void AddCustomColorMaps(const std::string color_map_name,
124 ddt::colorMap_t const& colourmap,
125 ddt::colorMap_t const& colourmap_inverted,
126 ddt::colorMapARGB_t const& colourmap_argb,
127 ddt::colorMapARGB_t const& colourmap_argb_inverted);
128
133 std::list<std::string> get_ColorMapsList() const;
134
143 ddt::colorMap_t* get_ColorMap(const std::string color_map_name);
144
153 ddt::colorMapARGB_t* get_ColorMapARGB(const std::string color_map_name);
154
162
170
179 ddt::scalingLut_t* get_LinearScalingLut(const double cut_level_min,
180 const double cut_level_max);
181
190 ddt::scalingLut_t* get_LogarithmicScalingLut(const double cut_level_min,
191 const double cut_level_max);
192
201 ddt::scalingLut_t* get_SqrtScalingLut(const double cut_level_min,
202 const double cut_level_max);
203
208 void set_InvertColourmap(const bool invert);
209
210 protected:
215
216 private:
220 void Initialize();
221
225 void LoadColorMap(std::string color_map_name);
226
230 void LoadGrayScaleColorMap();
231
235 void CalculateScalingParameter(const double cut_level_min,
236 const double cut_level_max,
237 double* const pixval_range,
238 double* const offset, double* const factor,
239 int* const cut_level_min_tmp,
240 int* const cut_level_max_tmp) const;
244 std::unordered_map<std::string, ddt::colorMap_t> color_maps;
245
249 std::unordered_map<std::string, ddt::colorMap_t> color_maps_inverted;
250
254 std::unordered_map<std::string, ddt::colorMapARGB_t> color_maps_argb;
255
259 std::unordered_map<std::string, ddt::colorMapARGB_t> color_maps_argb_inverted;
260
264 scalingLut_t linear_scaling_lut;
265
269 scalingLut_t log_scaling_lut;
270
274 scalingLut_t sqrt_scaling_lut;
275
279 bool invert_colourmap;
280};
281
282} // namespace ddt
283
284#endif /* IMAGECOLOR_HPP */
Definition ddtLogger.hpp:43
void set_logger(ddt::DdtLogger *const in_logger)
Definition imageColor.cpp:27
std::list< std::string > get_ColorMapsList() const
Definition imageColor.cpp:211
virtual ~ImageColor()
ddt::colorMap_t * get_GrayScaleColorMap()
Definition imageColor.cpp:267
void AddCustomColorMaps(const std::string color_map_name, ddt::colorMap_t const &colourmap, ddt::colorMap_t const &colourmap_inverted, ddt::colorMapARGB_t const &colourmap_argb, ddt::colorMapARGB_t const &colourmap_argb_inverted)
Definition imageColor.cpp:199
ddt::colorMapARGB_t * get_ColorMapARGB(const std::string color_map_name)
Definition imageColor.cpp:243
ddt::scalingLut_t * get_LogarithmicScalingLut(const double cut_level_min, const double cut_level_max)
Definition imageColor.cpp:318
void LoadColorMaps(const std::string color_map_folder)
Definition imageColor.cpp:132
ddt::scalingLut_t * get_SqrtScalingLut(const double cut_level_min, const double cut_level_max)
Definition imageColor.cpp:352
ddt::colorMapARGB_t * get_GrayScaleColorMapARGB()
Definition imageColor.cpp:274
ddt::DdtLogger * logger
Definition imageColor.hpp:214
void set_InvertColourmap(const bool invert)
Definition imageColor.cpp:385
ddt::colorMap_t * get_ColorMap(const std::string color_map_name)
Definition imageColor.cpp:223
ImageColor()
Definition imageColor.cpp:22
ddt::scalingLut_t * get_LinearScalingLut(const double cut_level_min, const double cut_level_max)
Definition imageColor.cpp:281
Data acquisition class, offers access to data stream acquisition functions. This file is part of the ...
Data file class, offers access to FITS file functions. This file is part of the DDT Image Handling Li...
Class to wrap the usage of log4cplus as logging utility. This file provides a wrapper class for the u...
Image error handling function declaration. This file is part of the DDT Image Handling Library and pr...
Image IO function declaration. This file is part of the DDT Image Handling Library and provides funct...
Image processing function declaration. This file is part of the DDT Image Handling Library and provid...
Image analysis and statistic function declaration. This file is part of the DDT Image Handling Librar...
Definition ddtClient.hpp:32
std::array< std::array< float, COLOR_MAP_ENTRY_SIZE >, MAX_COLOR_MAP_ENTRIES > colorMap_t
Definition imageColor.hpp:48
constexpr uint MAX_SCALING_LUT_VALUE
Definition imageColor.hpp:37
constexpr size_t MAX_SCALING_LUT_ENTRIES
Definition imageColor.hpp:36
constexpr size_t MAX_COLOR_MAP_ENTRIES
Definition imageColor.hpp:38
struct ddt::scalingLut_t scalingLut_t
std::array< unsigned int, MAX_COLOR_MAP_ENTRIES > colorMapARGB_t
Definition imageColor.hpp:58
constexpr size_t COLOR_MAP_ENTRY_SIZE
Definition imageColor.hpp:40
constexpr size_t MAX_COLOR_MAP_VALUE
Definition imageColor.hpp:39
Definition imageColor.hpp:68
double offset
Definition imageColor.hpp:77
std::array< uint, MAX_SCALING_LUT_ENTRIES > lut
Definition imageColor.hpp:72
double factor
Definition imageColor.hpp:82