ddt 1.2.1
Loading...
Searching...
No Matches
imageColor.hpp
Go to the documentation of this file.
1
20#ifndef IMAGECOLOR_HPP
21#define IMAGECOLOR_HPP
22
23#include <sys/stat.h>
24
25#include <algorithm>
26#include <cctype>
27#include <unordered_map>
28
29#include "boost/filesystem.hpp"
30
31#include <cpl.h>
32#undef I
33#undef arg
34
36#include "ddt/dataFile.hpp"
37#include "ddt/ddtLogger.hpp"
38#include "ddt/imageError.hpp"
39#include "ddt/imageIO.hpp"
40#include "ddt/imageProc.hpp"
41#include "ddt/imageStats.hpp"
42
43namespace ddt {
44
45constexpr size_t MAX_SCALING_LUT_ENTRIES = 65536;
46constexpr uint MAX_SCALING_LUT_VALUE = 65535;
47constexpr size_t MAX_COLOR_MAP_ENTRIES = 256;
48constexpr size_t MAX_COLOR_MAP_VALUE = 255;
49constexpr size_t COLOR_MAP_ENTRY_SIZE = 3;
50
57using colorMap_t = std::array<std::array<float, COLOR_MAP_ENTRY_SIZE>, MAX_COLOR_MAP_ENTRIES>;
58
67using colorMapARGB_t = std::array<unsigned int, MAX_COLOR_MAP_ENTRIES>;
68
77typedef struct scalingLut_t {
81 std::array<uint, MAX_SCALING_LUT_ENTRIES> lut;
86 double offset;
91 double factor;
93
101 public:
105 ImageColor();
106
110 virtual ~ImageColor();
111
116 void set_logger(ddt::DdtLogger* const in_logger);
117
122 void LoadColorMaps(const std::string color_map_folder);
123
132 void AddCustomColorMaps(const std::string color_map_name,
133 ddt::colorMap_t const& colourmap,
134 ddt::colorMap_t const& colourmap_inverted,
135 ddt::colorMapARGB_t const& colourmap_argb,
136 ddt::colorMapARGB_t const& colourmap_argb_inverted);
137
142 std::list<std::string> get_ColorMapsList() const;
143
152 ddt::colorMap_t* get_ColorMap(const std::string color_map_name);
153
162 ddt::colorMapARGB_t* get_ColorMapARGB(const std::string color_map_name);
163
171
179
188 ddt::scalingLut_t* get_LinearScalingLut(const double cut_level_min,
189 const double cut_level_max);
190
199 ddt::scalingLut_t* get_LogarithmicScalingLut(const double cut_level_min,
200 const double cut_level_max);
201
210 ddt::scalingLut_t* get_SqrtScalingLut(const double cut_level_min,
211 const double cut_level_max);
212
217 void set_InvertColourmap(const bool invert);
218
219 protected:
224
225 private:
229 void Initialize();
230
234 void LoadColorMap(std::string color_map_name);
235
239 void LoadGrayScaleColorMap();
240
244 void CalculateScalingParameter(const double cut_level_min,
245 const double cut_level_max,
246 double* const pixval_range,
247 double* const offset, double* const factor,
248 int* const cut_level_min_tmp,
249 int* const cut_level_max_tmp) const;
253 std::unordered_map<std::string, ddt::colorMap_t> color_maps;
254
258 std::unordered_map<std::string, ddt::colorMap_t> color_maps_inverted;
259
263 std::unordered_map<std::string, ddt::colorMapARGB_t> color_maps_argb;
264
268 std::unordered_map<std::string, ddt::colorMapARGB_t> color_maps_argb_inverted;
269
273 scalingLut_t linear_scaling_lut;
274
278 scalingLut_t log_scaling_lut;
279
283 scalingLut_t sqrt_scaling_lut;
284
288 bool invert_colourmap;
289};
290
291} // namespace ddt
292
293#endif /* IMAGECOLOR_HPP */
294
Definition ddtLogger.hpp:51
Definition imageColor.hpp:100
void set_logger(ddt::DdtLogger *const in_logger)
Definition imageColor.cpp:36
std::list< std::string > get_ColorMapsList() const
Definition imageColor.cpp:220
virtual ~ImageColor()
ddt::colorMap_t * get_GrayScaleColorMap()
Definition imageColor.cpp:276
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:208
ddt::colorMapARGB_t * get_ColorMapARGB(const std::string color_map_name)
Definition imageColor.cpp:252
ddt::scalingLut_t * get_LogarithmicScalingLut(const double cut_level_min, const double cut_level_max)
Definition imageColor.cpp:329
void LoadColorMaps(const std::string color_map_folder)
Definition imageColor.cpp:141
ddt::scalingLut_t * get_SqrtScalingLut(const double cut_level_min, const double cut_level_max)
Definition imageColor.cpp:364
ddt::colorMapARGB_t * get_GrayScaleColorMapARGB()
Definition imageColor.cpp:283
ddt::DdtLogger * logger
Definition imageColor.hpp:223
void set_InvertColourmap(const bool invert)
Definition imageColor.cpp:398
ddt::colorMap_t * get_ColorMap(const std::string color_map_name)
Definition imageColor.cpp:232
ImageColor()
Definition imageColor.cpp:31
ddt::scalingLut_t * get_LinearScalingLut(const double cut_level_min, const double cut_level_max)
Definition imageColor.cpp:290
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:39
std::array< std::array< float, COLOR_MAP_ENTRY_SIZE >, MAX_COLOR_MAP_ENTRIES > colorMap_t
Definition imageColor.hpp:57
constexpr uint MAX_SCALING_LUT_VALUE
Definition imageColor.hpp:46
constexpr size_t MAX_SCALING_LUT_ENTRIES
Definition imageColor.hpp:45
constexpr size_t MAX_COLOR_MAP_ENTRIES
Definition imageColor.hpp:47
struct ddt::scalingLut_t scalingLut_t
std::array< unsigned int, MAX_COLOR_MAP_ENTRIES > colorMapARGB_t
Definition imageColor.hpp:67
constexpr size_t COLOR_MAP_ENTRY_SIZE
Definition imageColor.hpp:49
constexpr size_t MAX_COLOR_MAP_VALUE
Definition imageColor.hpp:48
Definition imageColor.hpp:77
double offset
Definition imageColor.hpp:86
std::array< uint, MAX_SCALING_LUT_ENTRIES > lut
Definition imageColor.hpp:81
double factor
Definition imageColor.hpp:91