JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches
jkqtpbasicimagetools.h
1/*
2 Copyright (c) 2008-2024 Jan W. Krieger (<jan@jkrieger.de>)
3
4
5
6 This software is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License (LGPL) as published by
8 the Free Software Foundation, either version 2.1 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License (LGPL) for more details.
15
16 You should have received a copy of the GNU Lesser General Public License (LGPL)
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20
21#ifndef JKQTPBASICIMAGETOOLS_H
22#define JKQTPBASICIMAGETOOLS_H
23#include <QIcon>
24#include <QDebug>
25#include <QImage>
26#include <QStringList>
27#include <cmath>
28#include <cfloat>
29#include <stdint.h>
30#include <QColor>
31#include <QReadWriteLock>
32#include <vector>
33#include <limits>
34#include "jkqtcommon/jkqtcommon_imexport.h"
35#include "jkqtcommon/jkqtpmathtools.h"
36#include "jkqtcommon/jkqttools.h"
37
38/** \brief possible datatypes of the data array, plotted by this class.
39 \ingroup jkqtplotter_imagelots_tools
40 */
42 FloatArray, /*!< Data is of type \c float */
43 DoubleArray, /*!< Data is of type \c double */
44 UInt8Array, /*!< Data is of type \c uint8_t */
45 UInt16Array, /*!< Data is of type \c uint16_t */
46 UInt32Array, /*!< Data is of type \c uint32_t */
47 UInt64Array, /*!< Data is of type \c uint8_t */
48 Int8Array, /*!< Data is of type \c int8_t */
49 Int16Array, /*!< Data is of type \c int16_t */
50 Int32Array, /*!< Data is of type \c int32_t */
51 Int64Array /*!< Data is of type \c int64_t */
52};
53
54/*! \brief retrieve an R/G/B/Alpha (\a ch == 0/1/2/3) value from the \c QRgb value \a rgb
55 \ingroup jkqtplotter_imagelots_tools
56 */
57inline int JKQTPGetColorChannel(QRgb rgb, int ch)
58{
59 switch(ch) {
60 case 0: return qRed(rgb);
61 case 1: return qGreen(rgb);
62 case 2: return qBlue(rgb);
63 case 3: return qAlpha(rgb);
64 }
65 return qGray(rgb);
66}
67
68/*! \brief set the R/G/B/Alpha (\a ch == 0/1/2/3) value in the \c QRgb value \a rgb to \a val (0..255!)
69 \ingroup jkqtplotter_imagelots_tools
70 */
71inline void JKQTPSetColorChannel(QRgb& rgb, int ch, int val)
72{
73 switch(ch) {
74 case 0: rgb= qRgba(val, qGreen(rgb), qBlue(rgb), qAlpha(rgb)); break;
75 case 1: rgb= qRgba(qRed(rgb), val, qBlue(rgb), qAlpha(rgb)); break;
76 case 2: rgb= qRgba(qRed(rgb), qGreen(rgb), val, qAlpha(rgb)); break;
77 case 3: rgb= qRgba(qRed(rgb), qGreen(rgb), qBlue(rgb), val); break;
78 }
79}
80
81/*! \brief available palettes for coloring an image
82 \ingroup jkqtplotter_imagelots_tools
83 */
85 JKQTPMathImageGRAY=0, /*!< \image{inline} html palettes/palette_gray.png */
86 JKQTPMathImageINVERTEDGRAY, /*!< \image{inline} html palettes/palette_invgray.png */
87 JKQTPMathImageRED, /*!< \image{inline} html palettes/palette_red.png */
88 JKQTPMathImageINVERTEDRED, /*!< \image{inline} html palettes/palette_invred.png */
89 JKQTPMathImageGREEN, /*!< \image{inline} html palettes/palette_green.png */
90 JKQTPMathImageINVERTEDGREEN, /*!< \image{inline} html palettes/palette_invgreen.png */
91 JKQTPMathImageBLUE, /*!< \image{inline} html palettes/palette_blue.png */
92 JKQTPMathImageINVERTEDBLUE, /*!< \image{inline} html palettes/palette_invblue.png */
93 JKQTPMathImageCYAN, /*!< \image{inline} html palettes/palette_cyan.png */
94 JKQTPMathImageINVERTED_CYAN, /*!< \image{inline} html palettes/palette_invcyan.png */
95 JKQTPMathImageYELLOW, /*!< \image{inline} html palettes/palette_yellow.png */
96 JKQTPMathImageINVERTED_YELLOW, /*!< \image{inline} html palettes/palette_invyellow.png */
97 JKQTPMathImageMAGENTA, /*!< \image{inline} html palettes/palette_magenta.png */
98 JKQTPMathImageINVERTED_MAGENTA, /*!< \image{inline} html palettes/palette_invmagenta.png */
99
100
101 JKQTPMathImageMATLAB, /*!< \image{inline} html palettes/palette_Matlab.png */
102 JKQTPMathImageINVERTED_MATLAB, /*!< \image{inline} html palettes/palette_invMatlab.png */
103 JKQTPMathImageRYGB, /*!< \image{inline} html palettes/palette_RYGB.png */
104 JKQTPMathImageINVERTED_RYGB, /*!< \image{inline} html palettes/palette_invRYGB.png */
105 JKQTPMathImageHSV, /*!< \image{inline} html palettes/palette_HSV.png */
106 JKQTPMathImageINVERTED_HSV, /*!< \image{inline} html palettes/palette_invHSV.png */
107 JKQTPMathImageRAINBOW, /*!< \image{inline} html palettes/palette_rainbow.png */
108 JKQTPMathImageINVERTED_RAINBOW, /*!< \image{inline} html palettes/palette_invrainbow.png */
109 JKQTPMathImageHOT, /*!< \image{inline} html palettes/palette_AFMhot.png */
110 JKQTPMathImageINVERTED_HOT, /*!< \image{inline} html palettes/palette_invAFMhot.png */
111 JKQTPMathImageOCEAN, /*!< \image{inline} html palettes/palette_ocean.png */
112 JKQTPMathImageINVERTED_OCEAN, /*!< \image{inline} html palettes/palette_invocean.png */
113 JKQTPMathImageTRAFFICLIGHT, /*!< \image{inline} html palettes/palette_trafficlight.png */
114 JKQTPMathImageINVERTED_TRAFFICLIGHT, /*!< \image{inline} html palettes/palette_invtrafficlight.png */
115
116 JKQTPMathImageBone, /*!< \image{inline} html palettes/palette_bone.png */
117 JKQTPMathImageINVERTED_Bone, /*!< \image{inline} html palettes/palette_invbone.png */
118 JKQTPMathImageCool, /*!< \image{inline} html palettes/palette_cool.png */
119 JKQTPMathImageINVERTED_Cool, /*!< \image{inline} html palettes/palette_invcool.png */
120 JKQTPMathImageCopper, /*!< \image{inline} html palettes/palette_copper.png */
121 JKQTPMathImageINVERTED_Copper, /*!< \image{inline} html palettes/palette_invcopper.png */
122 JKQTPMathImageAutumn, /*!< \image{inline} html palettes/palette_autumn.png */
123 JKQTPMathImageINVERTED_Autumn, /*!< \image{inline} html palettes/palette_invautumn.png */
124 JKQTPMathImageTerrain, /*!< \image{inline} html palettes/palette_terrain.png */
125 JKQTPMathImageTerrain_STEP, /*!< \image{inline} html palettes/palette_stepsterrain.png */
126 JKQTPMathImageINVERTED_Terrain, /*!< \image{inline} html palettes/palette_invterrain.png */
127 JKQTPMathImageINVERTED_Terrain_STEP, /*!< \image{inline} html palettes/palette_stepsterrain.png */
128
129 JKQTPMathImageViridis, /*!< \image{inline} html palettes/palette_viridis.png
130 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
131 JKQTPMathImageINVERTED_Viridis, /*!< \image{inline} html palettes/palette_invviridis.png
132 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
133 JKQTPMathImageViridis_STEP, /*!< \image{inline} html palettes/palette_viridis_step.png
134 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
135 JKQTPMathImageINVERTED_Viridis_STEP, /*!< \image{inline} html palettes/palette_invviridis_step.png
136 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
137
138 JKQTPMathImageMagma, /*!< \image{inline} html palettes/palette_magma.png
139 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
140 JKQTPMathImageINVERTED_Magma, /*!< \image{inline} html palettes/palette_invmagma.png
141 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
142 JKQTPMathImageMagma_STEP, /*!< \image{inline} html palettes/palette_magma_step.png
143 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
144 JKQTPMathImageINVERTED_Magma_STEP, /*!< \image{inline} html palettes/palette_invmagma_step.png
145 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
146 JKQTPMathImageInferno, /*!< \image{inline} html palettes/palette_inferno.png
147 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
148 JKQTPMathImageINVERTED_Inferno, /*!< \image{inline} html palettes/palette_invinferno.png
149 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
150 JKQTPMathImageInferno_STEP, /*!< \image{inline} html palettes/palette_inferno_step.png
151 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
152 JKQTPMathImageINVERTED_Inferno_STEP, /*!< \image{inline} html palettes/palette_invinferno_step.png
153 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
154 JKQTPMathImagePlasma, /*!< \image{inline} html palettes/palette_plasma.png
155 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
156 JKQTPMathImageINVERTED_Plasma, /*!< \image{inline} html palettes/palette_invplasma.png
157 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
158 JKQTPMathImagePlasma_STEP, /*!< \image{inline} html palettes/palette_plasma_step.png
159 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
160 JKQTPMathImageINVERTED_Plasma_STEP, /*!< \image{inline} html palettes/palette_invplasma_step.png
161 Palette was adapted from https://github.com/BIDS/colormap/blob/master/colormaps.py */
162 JKQTPMathImageIBMColorBlindSafe, /*!< \image{inline} html palettes/palette_IBMColorBlindSafe.png
163 This is a color-blind friendly palete!
164 Palette was adapted from https://lospec.com/palette-list/ibm-color-blind-safe */
165 JKQTPMathImageIBMColorBlindSafe_STEP, /*!< \image{inline} html palettes/palette_IBMColorBlindSafe_step.png
166 This is a color-blind friendly palete!
167 Palette was adapted from https://lospec.com/palette-list/ibm-color-blind-safe */
168 JKQTPMathImageOkabeIto_STEP, /*!< \image{inline} html palettes/palette_OkabeIto_step.png
169 This is a color-blind friendly palete!
170 Palette was adapted from https://yoshke.org/blog/colorblind-friendly-diagrams and M. Okabe and K. Ito, How to make figures and presentations that are friendly to color blind people, University of Tokyo, 2002. */
171 JKQTPMathImageTol_STEP, /*!< \image{inline} html palettes/palette_Tol_step.png
172 This is a color-blind friendly palete!
173 Palette was adapted from https://thenode.biologists.com/data-visualization-with-flying-colors/research/ */
174 JKQTPMathImageTolMuted_STEP, /*!< \image{inline} html palettes/palette_TolMuted_step.png
175 This is a color-blind friendly palete!
176 Palette was adapted from https://yoshke.org/blog/colorblind-friendly-diagrams and Tol, B. Points of view: Color blindness. Nat Methods 8, 441 (2011). https://doi.org/10.1038/nmeth.1618 */
177 JKQTPMathImageTolLight_STEP, /*!< \image{inline} html palettes/palette_TolLight_step.png
178 This is a color-blind friendly palete!
179 Palette was adapted from https://davidmathlogic.com/colorblind/#%23000000-%23E69F00-%2356B4E9-%23009E73-%23F0E442-%230072B2-%23D55E00-%23CC79A7 and Tol, B. Points of view: Color blindness. Nat Methods 8, 441 (2011). https://doi.org/10.1038/nmeth.1618 */
180 JKQTPMathImageOkabeItoDarker_STEP, /*!< \image{inline} html palettes/palette_OkabeItoDarker_step.png
181 darker version of JKQTPMathImageOkabeIto_STEP
182 This is a color-blind friendly palete!
183 Palette was adapted from https://yoshke.org/blog/colorblind-friendly-diagrams and M. Okabe and K. Ito, How to make figures and presentations that are friendly to color blind people, University of Tokyo, 2002. */
184 JKQTPMathImageOkabeItoLighter_STEP, /*!< \image{inline} html palettes/palette_OkabeItoLighter_step.png
185 lighter version of JKQTPMathImageOkabeIto_STEP
186 This is a color-blind friendly palete!
187 Palette was adapted from https://davidmathlogic.com/colorblind/#%23000000-%23E69F00-%2356B4E9-%23009E73-%23F0E442-%230072B2-%23D55E00-%23CC79A7 and M. Okabe and K. Ito, How to make figures and presentations that are friendly to color blind people, University of Tokyo, 2002. */
188 JKQTPMathImageDefault_STEP, /*!< \image{inline} html palettes/palette_jkqtplotterdefault_step.png
189 This is the color cycle used to color graphs in JKQTPlotter's default style.
190 Palette was adapted from https://davidmathlogic.com/colorblind/#%23BB0000-%2300C11D-%230039D6-%23FFDD00-%23C05FFF-%23DE7704-%2303039A
191 */
192 JKQTPMathImageCubeHelixClassic, /*!< \image{inline} html palettes/palette_CubeHelixClassic.png
193 This palette was created using Green's CubeHelix method with the parameters shown in the paper: start=0.5, rotation=-1.5, gamma=1.0, saturation=1.2.
194 (see JKQTPCreateGreensCubeHelixLUT() )
195 */
196 JKQTPMathImageCubeHelixClassic_STEP, /*!< \image{inline} html palettes/palette_CubeHelixClassic_step.png
197 This palette was created using Green's CubeHelix method with the parameters shown in the paper: start=0.5, rotation=-1.5, gamma=1.0, saturation=1.2.
198 (see JKQTPCreateGreensCubeHelixLUT() )
199 */
200 JKQTPMathImageCubeHelix1, /*!< \image{inline} html palettes/palette_CubeHelix1.png
201 This palette was created using Green's CubeHelix method with the parameters shown in the paper: start=0.5, rotation=-1.5, gamma=1.0, saturation=1.2.
202 (see JKQTPCreateGreensCubeHelixLUT() )
203 */
204 JKQTPMathImageCubeHelix1_STEP, /*!< \image{inline} html palettes/palette_CubeHelix1_step.png
205 This palette was created using Green's CubeHelix method with the parameters shown in the paper: start=0.5, rotation=-1.5, gamma=1.0, saturation=1.2.
206 (see JKQTPCreateGreensCubeHelixLUT() )
207 */
208 JKQTPMathImageCubeHelix2, /*!< \image{inline} html palettes/palette_CubeHelix2.png
209 This palette was created using Green's CubeHelix method with the parameters shown in the paper: start=0.5, rotation=-1.5, gamma=1.0, saturation=1.2.
210 (see JKQTPCreateGreensCubeHelixLUT() )
211 */
212 JKQTPMathImageCubeHelix2_STEP, /*!< \image{inline} html palettes/palette_CubeHelix2_step.png
213 This palette was created using Green's CubeHelix method with the parameters shown in the paper: start=0.5, rotation=-1.5, gamma=1.0, saturation=1.2.
214 (see JKQTPCreateGreensCubeHelixLUT() )
215 */
216 JKQTPMathImageCubeHelix3, /*!< \image{inline} html palettes/palette_CubeHelix3.png
217 This palette was created using Green's CubeHelix method with the parameters shown in the paper: start=0.5, rotation=-1.5, gamma=1.0, saturation=1.2.
218 (see JKQTPCreateGreensCubeHelixLUT() )
219 */
220 JKQTPMathImageCubeHelix3_STEP, /*!< \image{inline} html palettes/palette_CubeHelix3_step.png
221 This palette was created using Green's CubeHelix method with the parameters shown in the paper: start=0.5, rotation=-1.5, gamma=1.0, saturation=1.2.
222 (see JKQTPCreateGreensCubeHelixLUT() )
223 */
224 JKQTPMathImageMatlab_STEP, /*!< \image{inline} html palettes/palette_Matlab_step.png */
225 JKQTPMathImageMatlabLegacy_STEP, /*!< \image{inline} html palettes/palette_MatlabLegacy_step.png */
226 JKQTPMathImageMatplotlib_STEP, /*!< \image{inline} html palettes/palette_Matplotlib_step.png */
227 JKQTPMathImageSeaborn_STEP, /*!< \image{inline} html palettes/palette_Seaborn_step.png */
228 JKQTPMathImageSeabornPastel_STEP, /*!< \image{inline} html palettes/palette_SeabornPastel_step.png */
229
230
231 JKQTPMathImageBLUEMAGENTAYELLOW, /*!< \image{inline} html palettes/palette_BlMaYe.png */
232 JKQTPMathImageINVERTED_BLUEMAGENTAYELLOW, /*!< \image{inline} html palettes/palette_YeMaBl.png */
233 JKQTPMathImageYELLOWMAGENTABLUE=JKQTPMathImageINVERTED_BLUEMAGENTAYELLOW, /*!< \image{inline} html palettes/palette_YeMaBl.png */
234 JKQTPMathImageBLUEYELLOW, /*!< \image{inline} html palettes/palette_BlYe.png */
235 JKQTPMathImageINVERTED_BLUEYELLOW, /*!< \image{inline} html palettes/palette_YeBl.png */
236 JKQTPMathImageYELLOWBLUE=JKQTPMathImageINVERTED_BLUEYELLOW, /*!< \image{inline} html palettes/palette_YeBl.png */
237
238 JKQTPMathImageBLACKBLUEREDYELLOW, /*!< \image{inline} html palettes/palette_BBlRdYe.png */
239 JKQTPMathImageYELLOWREDBLUEBLACK, /*!< \image{inline} html palettes/palette_YeRdBlB.png */
240 JKQTPMathImageGREENREDVIOLET, /*!< \image{inline} html palettes/palette_GnRdVi.png */
241 JKQTPMathImageVIOLETREDGREEN, /*!< \image{inline} html palettes/palette_ViRdGn.png */
242 JKQTPMathImageBLACKBLUEWHITEYELLOWWHITE, /*!< \image{inline} html palettes/palette_BWprint.png */
243 JKQTPMathImageWHITEYELLOWWHITEBLUEBLACK, /*!< \image{inline} html palettes/palette_invBWprint.png */
244 JKQTPMathImageBR_GR, /*!< \image{inline} html palettes/palette_BrGr.png */
245 JKQTPMathImageBrownGreen=JKQTPMathImageBR_GR, /*!< \image{inline} html palettes/palette_BrGr.png */
246 JKQTPMathImageBR_GR_STEP, /*!< \image{inline} html palettes/palette_stepsBrGr.png */
247 JKQTPMathImageGR_BR, /*!< \image{inline} html palettes/palette_GrBr.png */
248 JKQTPMathImageGreenBrown=JKQTPMathImageGR_BR, /*!< \image{inline} html palettes/palette_GrBr.png */
249 JKQTPMathImageGR_BR_STEP, /*!< \image{inline} html palettes/palette_stepsGrBr.png */
250 JKQTPMathImagePU_OR, /*!< \image{inline} html palettes/palette_PuOr.png */
251 JKQTPMathImagePurpleWhiteOrange=JKQTPMathImagePU_OR, /*!< \image{inline} html palettes/palette_PuOr.png */
252 JKQTPMathImagePU_OR_STEP, /*!< \image{inline} html palettes/palette_stepsPuOr.png */
253 JKQTPMathImageOR_PU, /*!< \image{inline} html palettes/palette_OrPu.png */
254 JKQTPMathImageOR_PU_STEP, /*!< \image{inline} html palettes/palette_stepsOrPu.png */
255 JKQTPMathImageOrangeWhitePurple=JKQTPMathImageOR_PU, /*!< \image{inline} html palettes/palette_OrPu.png */
256 JKQTPMathImageGN_BU, /*!< \image{inline} html palettes/palette_greenblue.png */
257 JKQTPMathImageGreenBlue=JKQTPMathImageGN_BU, /*!< \image{inline} html palettes/palette_greenblue.png */
258 JKQTPMathImageGN_BU_STEP, /*!< \image{inline} html palettes/palette_stepsGnBl.png */
259 JKQTPMathImageBU_GN, /*!< \image{inline} html palettes/palette_bluegreen.png */
260 JKQTPMathImageBlueGreen=JKQTPMathImageBU_GN, /*!< \image{inline} html palettes/palette_bluegreen.png */
261 JKQTPMathImageBU_GN_STEP, /*!< \image{inline} html palettes/palette_stepsBlGn.png */
262 JKQTPMathImageYL_GN_BU, /*!< \image{inline} html palettes/palette_YeGnBu.png */
263 JKQTPMathImageYellowGreenBlue=JKQTPMathImageYL_GN_BU, /*!< \image{inline} html palettes/palette_YeGnBu.png */
264 JKQTPMathImageYL_GN_BU_STEP, /*!< \image{inline} html palettes/palette_stepsYeGnBu.png */
265 JKQTPMathImageBU_GN_YL, /*!< \image{inline} html palettes/palette_BlGnYe.png */
266 JKQTPMathImageBU_GN_YE=JKQTPMathImageBU_GN_YL, /*!< \image{inline} html palettes/palette_BlGnYe.png */
267 JKQTPMathImageBU_GN_YL_STEP, /*!< \image{inline} html palettes/palette_stepsBlGnYe.png */
268 JKQTPMathImageBlueGreenYellow=JKQTPMathImageBU_GN_YE, /*!< \image{inline} html palettes/palette_BlGnYe.png */
269
270 JKQTPMathImagePI_W_GR, /*!< \image{inline} html palettes/palette_PiWGr.png */
271 JKQTPMathImagePinkWhiteGreen=JKQTPMathImagePI_W_GR, /*!< \image{inline} html palettes/palette_PiWGr.png */
272 JKQTPMathImagePI_W_GR_STEP, /*!< \image{inline} html palettes/palette_stepsBrGr.png */
273 JKQTPMathImageGR_W_PI, /*!< \image{inline} html palettes/palette_GrWPi.png */
274 JKQTPMathImageGreenWhitePink=JKQTPMathImageGR_W_PI, /*!< \image{inline} html palettes/palette_GrWPi.png */
275 JKQTPMathImageGR_W_PI_STEP, /*!< \image{inline} html palettes/palette_stepsGrWPi.png */
276
277 JKQTPMathImageBLUEWHITERED, /*!< \image{inline} html palettes/palette_bluewhitered.png */
278 JKQTPMathImageBL_W_RD=JKQTPMathImageBLUEWHITERED, /*!< \image{inline} html palettes/palette_bluewhitered.png */
279 JKQTPMathImageBLUEWHITERED_STEP, /*!< \image{inline} html palettes/palette_stepsbluewhitered.png */
280 JKQTPMathImageBL_W_RD_STEP=JKQTPMathImageBLUEWHITERED_STEP, /*!< \image{inline} html palettes/palette_stepsbluewhitered.png */
281 JKQTPMathImageREDWHITEBLUE, /*!< \image{inline} html palettes/palette_redwhiteblue.png */
282 JKQTPMathImageRD_W_BL=JKQTPMathImageREDWHITEBLUE, /*!< \image{inline} html palettes/palette_redwhiteblue.png */
283 JKQTPMathImageREDWHITEBLUE_STEP, /*!< \image{inline} html palettes/palette_stepsredwhiteblue.png */
284 JKQTPMathImageRD_W_BL_STEP=JKQTPMathImageREDWHITEBLUE_STEP, /*!< \image{inline} html palettes/palette_stepsredwhiteblue.png */
285 JKQTPMathImageBLUEYELLOWRED, /*!< \image{inline} html palettes/palette_blueyellowred.png */
286 JKQTPMathImageBL_Yl_RD=JKQTPMathImageBLUEYELLOWRED, /*!< \image{inline} html palettes/palette_blueyellowred.png */
287 JKQTPMathImageBLUEYELLOWRED_STEP, /*!< \image{inline} html palettes/palette_stepsblueyellowred.png */
288 JKQTPMathImageBL_Yl_RD_STEP=JKQTPMathImageBLUEYELLOWRED_STEP, /*!< \image{inline} html palettes/palette_stepsblueyellowred.png */
289 JKQTPMathImageREDYELLOWBLUE, /*!< \image{inline} html palettes/palette_redyellowblue.png */
290 JKQTPMathImageRd_Yl_Bl=JKQTPMathImageREDYELLOWBLUE, /*!< \image{inline} html palettes/palette_redyellowblue.png */
291 JKQTPMathImageREDYELLOWBLUE_STEP, /*!< \image{inline} html palettes/palette_stepsredyellowblue.png */
292 JKQTPMathImageRd_Yl_Bl_STEP=JKQTPMathImageREDYELLOWBLUE_STEP, /*!< \image{inline} html palettes/palette_stepsredyellowblue.png */
293
294 JKQTPMathImageRD_W_GY, /*!< \image{inline} html palettes/palette_RdWGy.png */
295 JKQTPMathImageRedWhiteGray=JKQTPMathImageRD_W_GY, /*!< \image{inline} html palettes/palette_RdWGy.png */
296 JKQTPMathImageRD_W_GY_STEP, /*!< \image{inline} html palettes/palette_stepsRdWGy.png */
297 JKQTPMathImageGY_W_RD, /*!< \image{inline} html palettes/palette_GyWRd.png */
298 JKQTPMathImageGrayWhiteRed=JKQTPMathImageGY_W_RD, /*!< \image{inline} html palettes/palette_GyWRd.png */
299 JKQTPMathImageGY_W_RD_STEP, /*!< \image{inline} html palettes/palette_stepsGyWRd.png */
300
301 JKQTPMathImageRD_Yn_GN, /*!< \image{inline} html palettes/palette_RdYnGn.png */
302 JKQTPMathImageRedYelloynGreen=JKQTPMathImageRD_Yn_GN, /*!< \image{inline} html palettes/palette_RdYnGn.png */
303 JKQTPMathImageRD_Yn_GN_STEP, /*!< \image{inline} html palettes/palette_stepsRdYnGn.png */
304 JKQTPMathImageGN_Yn_RD, /*!< \image{inline} html palettes/palette_GnYnRd.png */
305 JKQTPMathImageGreenYelloynRed=JKQTPMathImageGN_Yn_RD, /*!< \image{inline} html palettes/palette_GnYnRd.png */
306 JKQTPMathImageGN_Yn_RD_STEP, /*!< \image{inline} html palettes/palette_stepsGnYnRd.png */
307
308 JKQTPMathImageSeismic, /*!< \image{inline} html palettes/palette_seismic.png */
309 JKQTPMathImageSeismic_STEP, /*!< \image{inline} html palettes/palette_stepsseismic.png */
310 JKQTPMathImageINVERTED_Seismic, /*!< \image{inline} html palettes/palette_invseismic.png */
311 JKQTPMathImageINVERTED_Seismic_STEP, /*!< \image{inline} html palettes/palette_stepsinvseismic.png */
312
313 JKQTPMathImageCoolwarm, /*!< \image{inline} html palettes/palette_coolwarm.png */
314 JKQTPMathImageCoolwarm_STEP, /*!< \image{inline} html palettes/palette_stepscoolwarm.png */
315 JKQTPMathImageINVERTED_Coolwarm, /*!< \image{inline} html palettes/palette_invcoolwarm.png */
316 JKQTPMathImageINVERTED_Coolwarm_STEP, /*!< \image{inline} html palettes/palette_stepsinvcoolwarm.png */
317
318 JKQTPMathImageCYANWHITE, /*!< \image{inline} html palettes/palette_cyanwhite.png */
319 JKQTPMathImageINVERTED_CYANWHITE, /*!< \image{inline} html palettes/palette_whitecyan.png */
320 JKQTPMathImageWHITECYAN=JKQTPMathImageINVERTED_CYANWHITE, /*!< \image{inline} html palettes/palette_whitecyan.png */
321 JKQTPMathImageYELLOWWHITE, /*!< \image{inline} html palettes/palette_yellowwhite.png */
322 JKQTPMathImageINVERTED_YELLOWWHITE, /*!< \image{inline} html palettes/palette_whiteyellow.png */
323 JKQTPMathImageWHITEYELLOW=JKQTPMathImageINVERTED_YELLOWWHITE, /*!< \image{inline} html palettes/palette_whiteyellow.png */
324 JKQTPMathImageMAGENTAWHITE, /*!< \image{inline} html palettes/palette_magentawhite.png */
325 JKQTPMathImageINVERTED_MAGENTAWHITE, /*!< \image{inline} html palettes/palette_whitemagenta.png */
326 JKQTPMathImageWHITEMAGENTA=JKQTPMathImageINVERTED_MAGENTAWHITE, /*!< \image{inline} html palettes/palette_whitemagenta.png */
327 JKQTPMathImageBlueGreenRed, /*!< \image{inline} html palettes/palette_bluegreenred.png */
328 JKQTPMathImageRedGreenBlue, /*!< \image{inline} html palettes/palette_redgreenblue.png */
329 JKQTPMathImageMagentaYellow, /*!< \image{inline} html palettes/palette_magentayellow.png */
330 JKQTPMathImageYellowMagenta, /*!< \image{inline} html palettes/palette_yellowmagenta.png */
331 JKQTPMathImageRedBlue, /*!< \image{inline} html palettes/palette_redblue.png */
332 JKQTPMathImageBlueRed, /*!< \image{inline} html palettes/palette_bluered.png */
333 JKQTPMathImagePrism16, /*!< \image{inline} html palettes/palette_prism16.png */
334 JKQTPMathImagePrism8, /*!< \image{inline} html palettes/palette_prism8.png */
335 JKQTPMathImageFlag16, /*!< \image{inline} html palettes/palette_flag16.png */
336 JKQTPMathImageFlag8, /*!< \image{inline} html palettes/palette_flag8.png */
337 JKQTPMathImagePaired12_STEP, /*!< \image{inline} html palettes/palette_paired12_step.png */
338 JKQTPMathImagePaired10_STEP, /*!< \image{inline} html palettes/palette_paired10_step.png */
339 JKQTPMathImageSet3_STEP, /*!< \image{inline} html palettes/palette_set3_step.png */
340 JKQTPMathImageAccent_STEP, /*!< \image{inline} html palettes/palette_accent_step.png */
341 JKQTPMathImageDark2_STEP, /*!< \image{inline} html palettes/palette_dark2_step.png */
342 JKQTPMathImagePastel1_STEP, /*!< \image{inline} html palettes/palette_pastel1_step.png */
343 JKQTPMathImagePastel2_STEP, /*!< \image{inline} html palettes/palette_pastel2_step.png */
344 JKQTPMathImageSet1_STEP, /*!< \image{inline} html palettes/palette_set1_step.png */
345 JKQTPMathImageSet2_STEP, /*!< \image{inline} html palettes/palette_set2_step.png */
346 JKQTPMathImageALPHA, /*!< \brief special palette with increasing alpha values */
347 JKQTPMathImageINVERTED_ALPHA, /*!< \brief special palette with decreasing alpha values */
348
349 JKQTPMathImagePREDEFINED_PALETTES_COUNT, /*!< \brief the number of predefined palettes */
350
351 JKQTPMathImageUSER_PALETTE=65000, /*!< \brief special value for JKQTPImageTools::array2image(), which signals the usage of a provided user-defined palette */
352
353
354 JKQTPMathImageFIRST_REGISTERED_USER_PALETTE=JKQTPMathImagePREDEFINED_PALETTES_COUNT, /*!< \brief the ID of the first user-defined paletted, registered with JKQTPImageTools::registerPalette() or JKQTPImageTools::registerPalettesFromFile() */
355 JKQTPMathImageLAST_POSSIBLE_REGISTERED_USER_PALETTE=JKQTPMathImageUSER_PALETTE-10, /*!< \brief the ID of the last user-defined paletted, registered with JKQTPImageTools::registerPalette() or JKQTPImageTools::registerPalettesFromFile() */
356};
357
358
359
360/*! \brief modes available for image pixels that are above/below the pixel value range
361 \ingroup jkqtplotter_imagelots_tools
362 */
364 JKQTPMathImageLastPaletteColor=0, /*!< set to last color in the palette */
365 JKQTPMathImageGivenColor=1, /*!< set to the provided min/max color */
366 JKQTPMathImageTransparent=2 /*!< set transparent */
368
369/*! \brief tool structure that summarizes several static properties of JKQTPlotters palette system,
370 also provides functions to work with palettes and register user-defined palettes.
371 \ingroup jkqtplotter_imagelots_tools
372
373 \see \ref JKQTPlotterImagePlot
374*/
376
377 /*! \brief Datatype to store lookup-tables used to map data values (scales to 0..size-1) onto RGB-colors */
378 typedef QVector<QRgb> LUTType;
379
380 /*! \brief Width of the Palette-Icons, generated e.g. by JKQTPImageTools::GetPaletteIcon() */
382 /*! \brief Height of the Palette-Icons, generated e.g. by JKQTPImageTools::GetPaletteIcon() */
384
385 /*! \brief size of the lookup tables used by JKQTFPimagePlot_array2image() */
387
388 /*! \brief number of entries in an auto-generated steps-palette */
390
391 /*! \brief loads all palettes defined in the given palette files \a filename into global_jkqtpimagetools_userluts
392 and assigns a new LUT-ID >=JKQTPMathImageFIRST_REGISTERED_USER_PALETTE to each palette
393 All new IDs are returned as a list
394
395
396 The file might either be a palette XML-file or a CSV-file:
397
398 \b CSV-files need to have one of the following two formats (RED/GREEN/BLUE: 0..255):
399 \verbatim
400 scalar, red, green, blue
401 scalar, red, green, blue
402 ...
403 \endverbatim
404 or simply
405 \verbatim
406 red, green, blue
407 red, green, blue
408 ...
409 \endverbatim
410 The parser will also allow tabs and whitespaces as column separators.
411
412
413 \b CML-files need to have one of the following two formats (RED/GREEN/BLUE/OPACITY: 0..1):
414 \verbatim
415 <ColorMap name="PALETTENAME" space="RGB">
416 <Point x="scalar" r="RED" g="GREEN" b="BLUE"/>
417 <Point x="scalar" r="RED" g="GREEN" b="BLUE"/>
418 ...
419 </ColorMap>
420 \endverbatim
421 optionally several \code <ColorMap>...</ColorMap> \endcode definitions may be put below an arbitrarily named
422 document node, e.g.:
423 \verbatim
424 <ColorMaps>
425 <ColorMap name="PALETTENAME" space="RGB">
426 <Point x="scalar" r="RED" g="GREEN" b="BLUE"/>
427 <Point x="scalar" r="RED" g="GREEN" b="BLUE"/>
428 ...
429 </ColorMap>
430 <ColorMap name="PALETTENAME" space="RGB">
431 <Point x="scalar" r="RED" g="GREEN" b="BLUE"/>
432 <Point x="scalar" r="RED" g="GREEN" b="BLUE"/>
433 ...
434 </ColorMap>
435 ...
436 </ColorMaps>
437 \endverbatim
438
439 \note In both cases, the palette will be formed without interpolation, i.e. using JKQTPBuildColorPaletteLUT() .
440 If in addition \a interpolatePalette is set to \c true, the function JKQTPBuildColorPaletteLUTLinInterpolate()
441 is used instead.
442
443 \see \ref JKQTPlotterImagePlot , JKQTPBuildColorPaletteLUT()
444 */
445 static JKQTCOMMON_LIB_EXPORT QVector<int> registerPalettesFromFile(const QString& filename, bool interpolatePalette=false);
446
447 /*! \brief registers a new LUT defined by \a paletteLut and with the given \a name (computer-readable) for later use, optionally stores also the human-readable and localized name \a nameT
448 and assigns a new LUT-ID >=JKQTPMathImageFIRST_REGISTERED_USER_PALETTE to the palette and returns it
449
450 \see \ref JKQTPlotterImagePlot, JKQTPBuildColorPaletteLUTLinInterpolate(), JKQTPBuildColorPaletteLUT(), JKQTPBuildColorPaletteLUTLinInterpolateSorted(), JKQTPBuildColorPaletteLUTSorted(), JKQTPBuildColorPaletteLUTLinInterpolate(), JKQTPBuildColorPaletteLUT()
451 */
452 static JKQTCOMMON_LIB_EXPORT int registerPalette(const QString& name, const LUTType &paletteLut, const QString &nameT=QString());
453
454
455
456
457
458
459
460
461 /*! \brief convert a 2D image (as 1D array) into a QImage with given palette (see JKQTFPColorPalette)
462
463 \param dbl_in pointer to a 1D array of template type \c T representing the image to plot. This array has to be of size \a width * \a height
464 \param width width of the array in \a dbl
465 \param height height of the array in \a dbl
466 \param[out] img the QImage object to draw to (should be initialized as \c QImage::Format_ARGB32 )
467 \param palette the color palette to use for the display
468 \param minColor lower boundary of color range in \a dbl pixels, if \a minColor == \a maxColor then this function will extract the image min and image max.
469 \param maxColor upper boundary of color range in \a dbl pixels, if \a minColor == \a maxColor then this function will extract the image min and image max.
470 \param paletteMinFail specifies what shell happen, when a value in \a dbl is below \a minColor
471 \param paletteMaxFail specifies what shell happen, when a value in \a dbl is above \a maxColor
472 \param minFailColor color to use for pixels that are below \a minColor for some settings of \a paletteMinFail
473 \param maxFailColor color to use for pixels that are below \a maxColor for some settings of \a paletteMaxFail
474 \param nanColor color to use for pixels that are not-a-number
475 \param infColor color to use for pixels that are infinity
476 \param logScale create a log-scaled image
477 \param logBase base for the logarithm used when \c logScale==true
478 \param lutUser user define LUT, used if \a palette \c ==JKQTPMathImageUSER_PALETTE
479 \note There is a variant of this function that is called with a userLUT directly, instead of \a palette
480 */
481 template <class T>
482 static inline void array2image(const T* dbl_in, int width, int height, QImage &img, JKQTPMathImageColorPalette palette, double minColor, double maxColor, JKQTPMathImageColorRangeFailAction paletteMinFail=JKQTPMathImageLastPaletteColor, JKQTPMathImageColorRangeFailAction paletteMaxFail=JKQTPMathImageLastPaletteColor, QColor minFailColor=QColor("black"), QColor maxFailColor=QColor("black"), QColor nanColor=QColor("black"), QColor infColor=QColor("black"), bool logScale=false, double logBase=10.0, const LUTType& lutUser=LUTType())
483 {
484 if (!dbl_in || width<=0 || height<=0)
485 return;
486
487 const int NPixels= jkqtp_bounded<int>(width*height);
488 double min = *dbl_in;
489 double max = *dbl_in;
490 if (jkqtp_approximatelyEqual(minColor, maxColor, JKQTP_DOUBLE_EPSILON)) {
491 bool first=true;
492 for (int i=1; i<NPixels; ++i)
493 {
494 T v=dbl_in[i];
495 if (!(std::isnan(static_cast<long double>(v)) || std::isinf(static_cast<long double>(v)))) {
496 if (first) {
497 min=max=v;
498 first=false;
499 } else {
500 if (v < min)
501 min = v;
502 else if (v > max)
503 max = v;
504 }
505 }
506 }
507
508 } else {
509 min = minColor;
510 max = maxColor;
511 }
512
513 const T* dbl=dbl_in;
514 QVector<T> dbl1;
515 if (logScale) {
516 double logB=log10(logBase);
517 dbl1=QVector<T>(jkqtp_bounded<int>(NPixels), 0);
518 for (int i=0; i<NPixels; i++) {
519 dbl1[i]=log10(dbl_in[i])/logB;
520 }
521 dbl=dbl1.data();
522 min=log10(min)/logB;
523 max=log10(max)/logB;
524 }
525 double delta=max-min;
526
527
528 // either use lutUser (if palette==JKQTPMathImageUSER_PALETTE) or else read the LUT from the internal storage
530
531 img = QImage(width, height, QImage::Format_ARGB32);
533 img.fill(lut_used[0]);
534 } else {
535 const int lutSize=lut_used.size();
536 if (lutSize>0) {
537 // LUT found: collor the image accordingly
538 for (int j=0; j<height; ++j) {
539 QRgb* line=reinterpret_cast<QRgb*>(img.scanLine(height-1-j));
540 for (int i=0; i<width; ++i) {
541 double val=dbl[j*width+i];
542 if (std::isnan(val)) {
543 line[i]=nanColor.rgba();
544 } else if (std::isinf(val)) {
545 line[i]=infColor.rgba();
546 } else {
547 const int v = static_cast<int>((val-min)/delta*static_cast<double>(lutSize));
548 const int vv = qBound<int>(0, v, lutSize-1);
549 line[i]=lut_used[vv];
550 if ((v<0)&&(paletteMinFail==JKQTPMathImageGivenColor)) {
551 line[i]=minFailColor.rgba();
552 } else if ((v>=lutSize)&&(paletteMaxFail==JKQTPMathImageGivenColor)) {
553 line[i]=maxFailColor.rgba();
554 } else if ((v<0)&&(paletteMinFail==JKQTPMathImageTransparent)) {
555 line[i]=QColor(Qt::transparent).rgba();
556 } else if ((v>=lutSize)&&(paletteMaxFail==JKQTPMathImageTransparent)) {
557 line[i]=QColor(Qt::transparent).rgba();
558 }
559 }
560 }
561 }
562 } else {
563 // no LUT found: paint a black image!
564 img.fill(0);
565 }
566 }
567
568 }
569
570 /*! \brief convert a 2D image (as 1D array) into a QImage with given palette (see JKQTFPColorPalette)
571
572 \param dbl_in pointer to a 1D array of template type \c T representing the image to plot. This array has to be of size \a width * \a height
573 \param width width of the array in \a dbl
574 \param height height of the array in \a dbl
575 \param[out] img the QImage object to draw to (should be initialized as \c QImage::Format_ARGB32 )
576 \param lutUser user-defined lookup-table
577 \param minColor lower boundary of color range in \a dbl pixels, if \a minColor == \a maxColor then this function will extract the image min and image max.
578 \param maxColor upper boundary of color range in \a dbl pixels, if \a minColor == \a maxColor then this function will extract the image min and image max.
579 \param paletteMinFail specifies what shell happen, when a value in \a dbl is below \a minColor
580 \param paletteMaxFail specifies what shell happen, when a value in \a dbl is above \a maxColor
581 \param minFailColor color to use for pixels that are below \a minColor for some settings of \a paletteMinFail
582 \param maxFailColor color to use for pixels that are below \a maxColor for some settings of \a paletteMaxFail
583 \param nanColor color to use for pixels that are not-a-number
584 \param infColor color to use for pixels that are infinity
585 \param logScale create a log-scaled image
586 \param logBase base for the logarithm used when \c logScale==true
587 */
588 template <class T>
589 static inline void array2image(const T* dbl_in, int width, int height, QImage &img, const LUTType& lutUser, double minColor, double maxColor, JKQTPMathImageColorRangeFailAction paletteMinFail=JKQTPMathImageLastPaletteColor, JKQTPMathImageColorRangeFailAction paletteMaxFail=JKQTPMathImageLastPaletteColor, QColor minFailColor=QColor("black"), QColor maxFailColor=QColor("black"), QColor nanColor=QColor("black"), QColor infColor=QColor("black"), bool logScale=false, double logBase=10.0)
590 {
591 array2image(dbl_in, width, height, img, JKQTPMathImageUSER_PALETTE, minColor, maxColor, paletteMinFail, paletteMaxFail, minFailColor, maxFailColor, nanColor, infColor, logScale, logBase, lutUser);
592 }
593
594
595
596 /** \brief return a list of all globally available LUTs, human-readable/localized form */
598
599 /** \brief return a list of all globally available LUTs, machine-readable form */
601
602 /*! \brief convert the palette \a p to a machine-readable string
603 \see JKQTPImageTools::String2JKQTPMathImageColorPalette()
604 */
606 /*! \brief convert the palette \a p to a human-readable (localized) string
607 \see JKQTPImageTools::String2JKQTPMathImageColorPalette()
608 */
610
611 /*! \brief convert the palette name \a p to JKQTPMathImageColorPalette (compatible with JKQTPImageTools::String2JKQTPMathImageColorPalette() )
612 \see JKQTPImageTools::JKQTPMathImageColorPalette2String()
613 */
615
616
617 /** \brief generates a QImage with width \a width and height 1 for the i-th color palette (\a i is based on the list returned by JKQTPImagePlot_getPredefinedPalettes() ) */
618 static JKQTCOMMON_LIB_EXPORT QImage GetPaletteImage(int i, int width);
619 /** \brief generates a QImage with width \a width and height \a height for the i-th color palette (\a i is based on the list returned by JKQTPImagePlot_getPredefinedPalettes() ) */
620 static JKQTCOMMON_LIB_EXPORT QImage GetPaletteImage(int i, int width, int height);
621 /** \brief generates a QImage with width \a width and height 1 for a specific JKQTPMathImageColorPalette */
623 /** \brief generates a QImage with width \a width and height \a height for a specific JKQTPMathImageColorPalette */
624 static JKQTCOMMON_LIB_EXPORT QImage GetPaletteImage(JKQTPMathImageColorPalette palette, int width, int height);
625 /** \brief generates a QImage with width \a width and height 1 for a lookup-table \a lut */
626 static JKQTCOMMON_LIB_EXPORT QImage GetPaletteImage(const LUTType& lut, int width);
627
628 /** \brief generates a QIcon for the i-th color palette (\a i is based on the list returned by JKQTPImagePlot_getPredefinedPalettes() ) */
630
631
632 /** \brief generates a QIcon for a specific JKQTPMathImageColorPalette */
634 /*! \brief create a LUT for a given JKQTPMathImageColorPalette, stored it in \a lutstore and return it */
636 /*! \brief return the list of QColors making up a JKQTPMathImageColorPalette, stored it in \a lutstore and return it */
638
639 private:
640
641 /*! \brief internal datatype, representing a lookup-table and its metadata inside global_jkqtpimagetools_lutstore
642 \internal
643 */
646 LUTData(const LUTType& _lut, const QString& _name, const QString& _nameT);
647 LUTData(const QString& _lut, const QString& _name, const QString& _nameT);
648 LUTData(const QString& _name, const QString& _nameT);
649 /** \brief the LUT itself */
651 /** \brief name for the LUT (machine-readable) */
652 QString name;
653 /** \brief name for the LUT (localized, human-readable) */
654 QString nameT;
655 /** \brief legacy (formerly used, but deprecated) name(s) for the LUT (machine-readable) */
656 QList<QString> legacyNames;
657 };
658
659 /*! \brief internal global storage object for lookup-tables
660 \internal
661 */
663
664 /*! \brief storage for the next ID to assign to a user-defined palette, registered with registerPalette() or registerPalettesFromFile()
665 \internal
666
667 \see registerPalette() registerPalettesFromFile()
668 */
670 /** \brief storage for the palette names in getPredefinedPalettes() \internal */
672 /** \brief storage for the palette names in etPredefinedPalettesMachineReadable() \internal */
674 /** \brief Mutex to protect global_jkqtpimagetools_lutstore, getPredefinedPalettesGlobalList, getPredefinedPalettesMachineReadableGlobalList and global_next_userpalette */
675 static JKQTCOMMON_LIB_EXPORT QReadWriteLock lutMutex;
676
677
678 /*! \brief returns data of the default LUTs, used to initialize global_jkqtpimagetools_lutstore
679 \internal
680 */
681 static JKQTCOMMON_LIB_EXPORT QMap<int, LUTData > getDefaultLUTs();
682
683
684 /*! \brief create a LUT for a given JKQTPMathImageColorPalette, store it in \a lutstore and return it
685 \internal
686 */
687 static JKQTCOMMON_LIB_EXPORT const LUTType& getLUTforPalette(const QMap<int, LUTData > &lutcache, JKQTPMathImageColorPalette palette);
688
689};
690
691
692
693
694
695
696
697
698/*! \brief modes available for RGB images
699 \ingroup jkqtplotter_imagelots_tools
700
701
702 \see Examples: \ref JKQTPlotterRGBImagePlot
703
704 */
706 JKQTPRGBMathImageModeRGBMode=0, /*!< image channels are mapped to the R, G and B channel (red-green-blue) */
707 JKQTPRGBMathImageModeHSVMode=1, /*!< image channels are mapped to the H, S and V channel (hue-saturation-value) */
708 JKQTPRGBMathImageModeHSLMode=2, /*!< image channels are mapped to the H, S and L channel (bue-saturation-luminance) */
709 JKQTPRGBMathImageModeCMYMode=3 /*!< image channels are mapped to the C, M and Y channel (subtractive color model!!!) */
711
712
713/*! \brief returns a vector containing all elements of the given array as doubles
714 \ingroup jkqtplotter_imagelots_tools
715
716*/
717template <class T>
718inline QVector<double> JKQTPImagePlot_arrayToDVector(const T* input, int N) {
719 if (!input || N<=0) return QVector<double>();
720 QVector<double> out(N, 0.0);
721 for (int i=0; i<N; i++) {
722 out[i]=input[i];
723 }
724 return out;
725}
726
727/*! \brief returns a vector containing all elements of the given boolean array as doubles (true=1, false=0)
728 \ingroup jkqtplotter_imagelots_tools
729
730*/
731inline QVector<double> JKQTPImagePlot_BarrayToDVector(const bool* input, int N) {
732 if (!input || N<=0) return QVector<double>();
733 QVector<double> out(N, 0.0);
734 for (int i=0; i<N; i++) {
735 if (input[i]) out[i]=1.0;
736 }
737 return out;
738}
739
740/*! \brief fin the minimum pixel value in the given image \a dbl with width \a width and height \a height
741 \ingroup jkqtplotter_imagelots_tools
742
743 */
744template <class T>
745inline double JKQTPImagePlot_getImageMin(const T* dbl, int width, int height)
746{
747 if (!dbl || width<=0 || height<=0)
748 return 0;
749
750 double min = 0;
751 double max = 0;
752 bool first=true;
753 for (int i=1; i<width*height; ++i)
754 {
755 T v=dbl[i];
756 if (!(std::isnan(static_cast<long double>(v)) || std::isinf(static_cast<long double>(v)))) {
757 if (first) {
758 min=max=v;
759 first=false;
760 } else {
761 if (v < min)
762 min = v;
763 else if (v > max)
764 max = v;
765 }
766 }
767 }
768 return min;
769};
770
771/*! \brief fin the maximum pixel value in the given image \a dbl with width \a width and height \a height
772 \ingroup jkqtplotter_imagelots_tools
773
774 */
775template <class T>
776inline double JKQTPImagePlot_getImageMax(const T* dbl, int width, int height)
777{
778 if (!dbl || width<=0 || height<=0)
779 return 0;
780
781 double min = 0;
782 double max = 0;
783 bool first=true;
784 for (int i=1; i<width*height; ++i)
785 {
786 T v=dbl[i];
787 if (!(std::isnan(static_cast<long double>(v)) || std::isinf(static_cast<long double>(v)))) {
788 if (first) {
789 min=max=v;
790 first=false;
791 } else {
792 if (v < min)
793 min = v;
794 else if (v > max)
795 max = v;
796 }
797 }
798 }
799 return max;
800};
801
802
803
804
805
806
807
808
809
810/*! \brief convert a 2D image (as 1D array) into a QImage and puts the image values into one color channel (set by \a channel).The other color channels are not changed! So a repeated call to this function for the SAME QImage will
811 result in a step-by-step buildup of an image.
812 \ingroup jkqtplotter_imagelots_tools
813
814 \note All calls (except channel>=3, i.e. alpha) set alpha to 255. Only the call
815 with channel==3 (alpha) sets alpha to the desired value. Calls with channel==4 (saturation), channel==5 (value)
816 leave alpha as it is.
817*/
818template <class T>
819inline void JKQTPImagePlot_array2RGBimage(const T* dbl_in, int width, int height, QImage &img, int channel, double minColor, double maxColor, JKQTPRGBMathImageRGBMode rgbMode=JKQTPRGBMathImageModeRGBMode, bool logScale=false, double logBase=10.0)
820{
821 if (!dbl_in || width<=0 || height<=0)
822 return;
823
824 double min = *dbl_in;
825 double max = *dbl_in;
826 bool first=true;
827 if (jkqtp_approximatelyEqual(minColor, maxColor, JKQTP_DOUBLE_EPSILON)) {
828 for (int i=1; i<width*height; ++i)
829 {
830 T v=dbl_in[i];
831 if (std::isfinite(static_cast<long double>(v))) {
832 if (first) {
833 min=max=v;
834 first=false;
835 } else {
836 if (v < min)
837 min = v;
838 else if (v > max)
839 max = v;
840 }
841 }
842 }
843 } else {
844 min = minColor;
845 max = maxColor;
846 }
847
848
849 const T* dbl=dbl_in;
850 QVector<T> dbllog;
851 if (logScale) {
852 double logB=log10(logBase);
853 dbllog.resize(static_cast<size_t>(width)*static_cast<size_t>(height));
854 //memcpy(dbl, dbl_in, width*height*sizeof(T));
855 for (int i=0; i<width*height; i++) {
856 dbllog[i]=log10(dbl_in[i])/logB;
857 }
858 min=log10(min)/logB;
859 max=log10(max)/logB;
860 dbl=dbllog.data();
861 }
862 double delta=max-min;
863
864 if (jkqtp_approximatelyUnequal(minColor, maxColor, JKQTP_DOUBLE_EPSILON)) {
865 if (rgbMode==JKQTPRGBMathImageModeRGBMode) {
866 //qDebug()<<"RGBMode";
867 if (channel==0) {
868 for (int j=0; j<height; ++j) {
869 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
870 for (int i=0; i<width; ++i) {
871 int v = trunc(double(dbl[j*width+i]-min)*255.0/delta);
872 v = (v < 0) ? 0 : ( (v > 255) ? 255 : v);
873 const QRgb l=line[i];
874 //if (j==5) qDebug()<<"r: "<<v<<qGreen(l)<<qBlue(l)<<qAlpha(255);
875 line[i]=qRgb(v,qGreen(l),qBlue(l));
876 }
877 }
878 } else if (channel==1) {
879 for (int j=0; j<height; ++j) {
880 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
881 for (int i=0; i<width; ++i) {
882 int v = (dbl[j*width+i]-min)*255/delta;
883 v = (v < 0) ? 0 : ( (v > 255) ? 255 : v);
884 const QRgb l=line[i];
885 //if (j==5) qDebug()<<"g: "<<qRed(l)<<v<<qBlue(l)<<qAlpha(255);
886 line[i]=qRgb(qRed(l),v,qBlue(l));
887 }
888 }
889 } else if (channel==2) {
890 for (int j=0; j<height; ++j) {
891 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
892 for (int i=0; i<width; ++i) {
893 int v = (dbl[j*width+i]-min)*255/delta;
894 v = (v < 0) ? 0 : ( (v > 255) ? 255 : v);
895 const QRgb l=line[i];
896 //if (j==5) qDebug()<<"b: "<<qRed(l)<<qGreen(l)<<v<<qAlpha(255);
897 line[i]=qRgb(qRed(l),qGreen(l),v);
898 }
899 }
900 } else if (channel==3) {
901 for (int j=0; j<height; ++j) {
902 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
903 for (int i=0; i<width; ++i) {
904 int v = (dbl[j*width+i]-min)*255/delta;
905 v = (v < 0) ? 0 : ( (v > 255) ? 255 : v);
906 const QRgb l=line[i];
907 //if (j==5) qDebug()<<"b: "<<qRed(l)<<qGreen(l)<<v<<qAlpha(255);
908 line[i]=qRgba(qRed(l),qGreen(l),qBlue(l), v);
909 }
910 }
911 }
912 } else if (rgbMode==JKQTPRGBMathImageModeCMYMode) {
913 //qDebug()<<"RGBMode";
914 if (channel==0) {
915 for (int j=0; j<height; ++j) {
916 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
917 for (int i=0; i<width; ++i) {
918 int v = trunc(double(dbl[j*width+i]-min)*255.0/delta);
919 v = (v < 0) ? 0 : ( (v > 255) ? 255 : v);
920 const QRgb l=line[i];
921 //if (j==5) qDebug()<<"r: "<<v<<qGreen(l)<<qBlue(l)<<qAlpha(255);
922 line[i]=QColor::fromCmyk(v,QColor(l).magenta(),QColor(l).yellow(),QColor(l).black()).rgba();
923 }
924 }
925 } else if (channel==1) {
926 for (int j=0; j<height; ++j) {
927 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
928 for (int i=0; i<width; ++i) {
929 int v = (dbl[j*width+i]-min)*255/delta;
930 v = (v < 0) ? 0 : ( (v > 255) ? 255 : v);
931 const QRgb l=line[i];
932 //if (j==5) qDebug()<<"g: "<<qRed(l)<<v<<qBlue(l)<<qAlpha(255);
933 line[i]=QColor::fromCmyk(QColor(l).cyan(),v,QColor(l).yellow(),QColor(l).black()).rgba();
934 }
935 }
936 } else if (channel==2) {
937 for (int j=0; j<height; ++j) {
938 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
939 for (int i=0; i<width; ++i) {
940 int v = (dbl[j*width+i]-min)*255/delta;
941 v = (v < 0) ? 0 : ( (v > 255) ? 255 : v);
942 const QRgb l=line[i];
943 //if (j==5) qDebug()<<"b: "<<qRed(l)<<qGreen(l)<<v<<qAlpha(255);
944 line[i]=QColor::fromCmyk(QColor(l).cyan(),QColor(l).magenta(),v,QColor(l).black()).rgba();
945 }
946 }
947 }
948 } else if (rgbMode==JKQTPRGBMathImageModeHSVMode) {
949 if (channel==0) {
950 for (int j=0; j<height; ++j) {
951 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
952 for (int i=0; i<width; ++i) {
953 int v = trunc(double(dbl[j*width+i]-min)*220.0/delta);
954 v = (v < 0) ? 0 : ( (v > 360) ? 360 : v);
955 QColor l=QColor::fromRgb(line[i]);
956 //if (i<10 && j==5) qDebug()<<"hi: "<<l.name()<<dbl[j*width+i]<<min<<max;
957 l.setHsv(v, l.saturation(), l.value());
958 //if (i<10 && j==5) qDebug()<<"ho: "<<l.name();
959 line[i]=l.rgb();
960 }
961 }
962 } else if (channel==1) {
963 for (int j=0; j<height; ++j) {
964 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
965 for (int i=0; i<width; ++i) {
966 int v = (dbl[j*width+i]-min)*255/delta;
967 v = (v < 0) ? 0 : ( (v > 255) ? 255 : v);
968 QColor l=QColor::fromRgb(line[i]);
969 //if (i<10 && j==5) qDebug()<<"si: "<<l.name()<<dbl[j*width+i]<<min<<max;
970 l.setHsv(l.hue(), v, l.value());
971 //if (i<10 && j==5) qDebug()<<"so: "<<l.name();
972 line[i]=l.rgb();
973 }
974 }
975 } else if (channel==2) {
976 for (int j=0; j<height; ++j) {
977 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
978 for (int i=0; i<width; ++i) {
979 int v = (dbl[j*width+i]-min)*255/delta;
980 v = (v < 0) ? 0 : ( (v > 255) ? 255 : v);
981 QColor l=QColor::fromRgb(line[i]);
982 //if (i<10 && j==5) qDebug()<<"vi: "<<l.name()<<dbl[j*width+i]<<min<<max;
983 l.setHsv(l.hue(), l.saturation(), v);
984 //if (i<10 && j==5) qDebug()<<"vo: "<<l.name();
985 line[i]=l.rgb();
986 }
987 }
988
989 }
990 } else if (rgbMode==JKQTPRGBMathImageModeHSLMode) {
991 if (channel==0) {
992 for (int j=0; j<height; ++j) {
993 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
994 for (int i=0; i<width; ++i) {
995 int v = trunc(double(dbl[j*width+i]-min)*255.0/delta);
996 v = (v < 0) ? 0 : ( (v > 360) ? 360 : v);
997 QColor l=line[i];
998 l.setHsl(v, l.saturation(), l.lightness());
999 line[i]=l.rgb();
1000 }
1001 }
1002 } else if (channel==1) {
1003 for (int j=0; j<height; ++j) {
1004 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
1005 for (int i=0; i<width; ++i) {
1006 int v = (dbl[j*width+i]-min)*255/delta;
1007 v = (v < 0) ? 0 : ( (v > 255) ? 255 : v);
1008 QColor l=line[i];
1009 l.setHsl(l.hue(), v, l.lightness());
1010 line[i]=l.rgb();
1011 }
1012 }
1013 } else if (channel==2) {
1014 for (int j=0; j<height; ++j) {
1015 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
1016 for (int i=0; i<width; ++i) {
1017 int v = (dbl[j*width+i]-min)*255/delta;
1018 v = (v < 0) ? 0 : ( (v > 255) ? 255 : v);
1019 QColor l=line[i];
1020 l.setHsl(l.hue(), l.saturation(), v);
1021 line[i]=l.rgb();
1022 }
1023 }
1024
1025 }
1026 }
1027 if (channel==3) {
1028 for (int j=0; j<height; ++j) {
1029 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
1030 for (int i=0; i<width; ++i) {
1031 int v = (dbl[j*width+i]-min)*255/delta;
1032 v = (v < 0) ? 0 : ( (v > 255) ? 255 : v);
1033 const QRgb l=line[i];
1034 line[i]=qRgba(qRed(l),qGreen(l),qBlue(l),v);
1035 }
1036 }
1037 } else if (channel==4) {
1038 for (int j=0; j<height; ++j) {
1039 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
1040 for (int i=0; i<width; ++i) {
1041 int v = (dbl[j*width+i]-min)*255/delta;
1042 v = (v < 0) ? 0 : ( (v > 255) ? 255 : v);
1043 QColor c=QColor::fromRgba(line[i]);
1044 c.setHsv(c.hue(), v, c.value(), c.alpha());
1045 line[i]=c.rgba();
1046 }
1047 }
1048 } else if (channel==5) {
1049 for (int j=0; j<height; ++j) {
1050 QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
1051 for (int i=0; i<width; ++i) {
1052 int v = (dbl[j*width+i]-min)*255/delta;
1053 v = (v < 0) ? 0 : ( (v > 255) ? 255 : v);
1054 QColor c=QColor::fromRgba(line[i]);
1055 c.setHsv(c.hue(), c.saturation(), v, c.alpha());
1056 line[i]=c.rgba();
1057 }
1058 }
1059 }
1060 }
1061}
1062
1063
1064
1065
1066
1067
1068/*! \brief for building palettes from linear segments of single colors using JKQTPBuildColorPaletteLUTLinSegmentsSorted() and JKQTPBuildColorPaletteLUTLinSegments()
1069 \ingroup jkqtplotter_imagelots_tools_LUTS
1070
1071 \see JKQTPBuildColorPaletteLUTLinSegmentsSorted() and JKQTPBuildColorPaletteLUTLinSegments(), \ref JKQTPlotterImagePlotUserPalette
1072
1073*/
1075 JKQTPColorPaletteSingleColorLinSegment(double p, uint8_t y1, uint8_t y2);
1076 static JKQTPColorPaletteSingleColorLinSegment makeDbl_0_1(double p, double y1, double y2);
1078 /** \brief scalar position of the element on the value axis */
1079 double position;
1080 /** \brief color-channel-value that ends the prevoius segment (ignored for the first entry in a table) */
1082 /** \brief color-channel-value that starts the next segment (ignored for the last entry in a table) */
1084};
1085
1086/*! \brief build an interpolated palette with \a lut_size entries from the linear segments defined for the color channels R, G and B in \a itemsR, \a itemG and \a itemB respectively
1087 \b NOTE: The entries in \a itemsR, \a itemsG, \a itemsB are assumed to be sorted by the position entry.
1088 \ingroup jkqtplotter_imagelots_tools_LUTS
1089
1090
1091
1092
1093 This is used to build a table of linear segments as a \c QList<JKQTPColorPaletteSingleColorLinSegment> :
1094 \verbatim
1095 i position colval1 colval2
1096 ~~~ ~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
1097 0 0.0 0 (IGNORED) 0
1098 1 0.5 100 100
1099 2 0.8 255 255
1100 3 1.0 255 255 (IGNORED)
1101 \endverbatim
1102
1103 This will build a graph:
1104 \verbatim
1105 colval
1106 ^
1107 |
1108 250 - #**********#
1109 | ***
1110 200 - ***
1111 | ***
1112 150 - **
1113 | **
1114 100 - *****#
1115 | ****
1116 50 - *****
1117 | *****
1118 0 - #*****
1119 |
1120 ---|----|----|----|----|----|----|----|----|----|----|--> position
1121 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
1122 \endverbatim
1123
1124 You can also build graphs with a jump at a certain position
1125 \verbatim
1126 i position colval1 colval2
1127 ~~~ ~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
1128 0 0.0 0 (IGNORED) 0
1129 1 0.5 100 0
1130 2 1.0 255 255 (IGNORED)
1131 \endverbatim
1132
1133 This results in:
1134
1135 \verbatim
1136 colval
1137 ^
1138 |
1139 250 - **#
1140 | **
1141 200 - **
1142 | **
1143 150 - ***
1144 | **
1145 100 - # **
1146 | ****** **
1147 50 - ****** **
1148 | ****** **
1149 0 - #****** #**
1150 |
1151 ---|----|----|----|----|----|----|----|----|----|----|--> position
1152 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
1153 \endverbatim
1154
1155 \see JKQTPBuildColorPaletteLUTLinSegments(), \ref JKQTPlotterImagePlotUserPalette , https://matplotlib.org/api/_as_gen/matplotlib.colors.LinearSegmentedColormap.html#matplotlib.colors.LinearSegmentedColormap
1156*/
1157JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTLinSegmentsSorted(const QList<JKQTPColorPaletteSingleColorLinSegment>& itemsR, const QList<JKQTPColorPaletteSingleColorLinSegment>& itemsG, const QList<JKQTPColorPaletteSingleColorLinSegment>& itemsB, int lut_size=JKQTPImageTools::LUTSIZE);
1158
1159
1160/*! \brief version of qRgb() that does not require to add the alpha part
1161 \ingroup jkqtplotter_imagelots_tools_LUTS
1162*/
1163
1164inline QRgb jkqtp_qRgbOpaque(QRgb col) {
1165 return col | 0xFF000000;
1166}
1167
1168/*! \brief for building palettes from list of colors and position values, using JKQTPBuildColorPaletteLUTLinInterpolateSorted(), ...
1169 \ingroup jkqtplotter_imagelots_tools_LUTS
1170
1171 \see JKQTPBuildColorPaletteLUTLinInterpolateSorted(), JKQTPBuildColorPaletteLUTSorted(), JKQTPBuildColorPaletteLUTColorsOnlySteps(), JKQTPBuildColorPaletteLUT(), JKQTPBuildColorPaletteLUTLinInterpolate()
1172
1173*/
1174class JKQTCOMMON_LIB_EXPORT JKQTPPaletteList: public QList<QPair<double, QRgb> >
1175{
1176public:
1177 typedef QPair<double, QRgb> parameter_type;
1178 typedef QList<parameter_type> ListType;
1180#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
1181 inline JKQTPPaletteList(qsizetype size): ListType(size) {};
1182 inline JKQTPPaletteList(qsizetype size, parameter_type value): ListType(size, value) {}
1183#endif
1184 template <class T>
1185 inline JKQTPPaletteList(std::initializer_list<QPair<double, QRgb>> args): ListType(args) {}
1186 inline JKQTPPaletteList(std::initializer_list<QRgb> args):
1187 ListType()
1188 {
1189 for(const auto& v: args) {
1190 push_back(v);
1191 }
1192 }
1193 inline JKQTPPaletteList(std::initializer_list<QColor> args):
1194 ListType()
1195 {
1196 for(const auto& v: args) {
1197 push_back(v);
1198 }
1199 }
1200 inline JKQTPPaletteList(std::initializer_list<QPair<double, QColor>> args):
1201 ListType()
1202 {
1203 for(const auto& v: args) {
1204 push_back(v.first, v.second);
1205 }
1206 }
1207 template <typename InputIterator, JKQTPIsInputIteratorTrait<InputIterator> = true>
1208 inline JKQTPPaletteList(InputIterator first, InputIterator last): ListType(first, last) {}
1209 inline JKQTPPaletteList(ListType &&other):ListType(std::forward<ListType>(other)) {}
1210 inline JKQTPPaletteList(const ListType &other):ListType(other) {}
1211
1212 using ListType::push_back;
1213 inline void push_back(QRgb rgb) {
1214 if (size()==0) push_back(ListType::value_type(0.0, rgb));
1215 else if (size()==1) push_back(ListType::value_type(at(0).first+1.0, rgb));
1216 else {
1217 double mi=0,ma=0, delta=0;
1218 getMinMaxPosition(mi,ma,&delta);
1219 push_back(ListType::value_type(ma+delta, rgb));
1220 }
1221 }
1222 inline void push_back(double pos, QRgb rgb) {
1223 push_back(ListType::value_type(pos, rgb));
1224 }
1225 using ListType::operator<<;
1226 inline JKQTPPaletteList& operator<<(QRgb rgb) {
1227 push_back(rgb);
1228 return *this;
1229 }
1230 inline void push_back(QColor color) {
1231 push_back(color.rgb());
1232 }
1233 inline void push_back(double pos, QColor color) {
1234 push_back(ListType::value_type(pos, color.rgb()));
1235 }
1236 inline JKQTPPaletteList& operator<<(QColor color) {
1237 push_back(color);
1238 return *this;
1239 }
1240 /** \brief reverse colors */
1241 inline void reverse() {
1242 const auto ma=getMaxPosition();
1243 for (auto& c: *this) {
1244 c.first=ma-c.first;
1245 }
1246 sort();
1247 }
1248 /** \brief sorty by position */
1249 inline void sort() {
1250 std::sort(begin(), end(), [](const parameter_type& a, const parameter_type& b) { return a.first<b.first;});
1251 }
1252
1253 /** \brief returns the minimum value of the double-component */
1254 inline double getMinPosition() const {
1255 double mi=0;
1256 bool first=true;
1257 for (const auto& c: *this) {
1258 if (first) {
1259 mi=c.first;
1260 first=false;
1261 } else {
1262 mi=qMin<int>(mi, c.first);
1263 }
1264 }
1265 return mi;
1266 }
1267 /** \brief returns the maximum value of the double-component */
1268 inline double getMaxPosition() const {
1269 double ma=0;
1270 bool first=true;
1271 for (const auto& c: *this) {
1272 if (first) {
1273 ma=c.first;
1274 first=false;
1275 } else {
1276 ma=qMax<int>(ma, c.first);
1277 }
1278 }
1279 return ma;
1280 }
1281 /** \brief returns the minimum and maximum value of the double-component, as well as the avg. increment between two such values */
1282 inline void getMinMaxPosition(double& mi, double& ma, double* avgDelta=nullptr) const {
1283 mi=ma=0;
1284 bool first=true;
1285 for (const auto& c: *this) {
1286 if (first) {
1287 mi=ma=c.first;
1288 first=false;
1289 } else {
1290 ma=qMax<int>(ma, c.first);
1291 mi=qMin<int>(mi, c.first);
1292 }
1293 }
1294 if (avgDelta) {
1295 if (size()<=1) *avgDelta=1;
1296 else *avgDelta=(ma-mi)/static_cast<double>(size()-1);
1297 }
1298 }
1299
1300};
1301
1302/*! \brief build a linearly interpolated palette (as a look-up table) with \a lut_size entries by linearly interpolating between the nodes in \a items .
1303 \b NOTE: \a items is assumed to be sorted by the first component of the \c QPair<double,QRgb> entries!
1304 \ingroup jkqtplotter_imagelots_tools_LUTS
1305
1306 The LUT is built following these rules:
1307 - the final LUT has \a lut_size entries
1308 - the first color in the lut is given by \c items.first().second
1309 - the last color in the lut is given by \c items.last().second
1310 - in between the colors are interpolated between the nodes in \a items and the color-nodes are
1311 distributed according to the first component of the \c QPair<double,QRgb> entries:<br>
1312 \image html JKQTPBuildColorPaletteLUTLinInterpolateSorted.png
1313 .
1314
1315 \see JKQTPBuildColorPaletteLUTLinInterpolate(), \ref JKQTPlotterImagePlotUserPalette
1316
1317*/
1319
1320
1321/*! \brief build a palette (as a look-up table) with \a lut_size entries that step between the nodes provided in \a items.
1322 \b NOTE: \a items is assumed to be sorted by the first component of the \c QPair<double,QRgb> entries!
1323 \ingroup jkqtplotter_imagelots_tools_LUTS
1324
1325 The LUT is built following these rules:
1326 - the final LUT has \a lut_size entries
1327 - the first color in the lut is given by \c items.first().second
1328 - the last color in the lut is given by \c items.last().second
1329 - in between the colors are stepped between the nodes in \a items and the color-nodes are
1330 distributed according to the first component of the \c QPair<double,QRgb> entries:<br>
1331 \image html JKQTPBuildColorPaletteLUTSorted.png
1332 .
1333
1334 \see JKQTPBuildColorPaletteLUT(), \ref JKQTPlotterImagePlotUserPalette
1335
1336*/
1338
1339/*! \brief like JKQTPBuildColorPaletteLUTLinInterpolateSorted(), but sorts \a items before processing it!
1340 \ingroup jkqtplotter_imagelots_tools_LUTS
1341
1342 \copydetails JKQTPBuildColorPaletteLUTLinInterpolateSorted()
1343*/
1345
1346
1347/*! \brief like JKQTPBuildColorPaletteLUTSorted(), but sorts \a items before processing it!
1348 \ingroup jkqtplotter_imagelots_tools_LUTS
1349
1350 \copydetails JKQTPBuildColorPaletteLUTSorted()
1351*/
1353
1354/*! \brief takes the QRgb-values in \a items and builds a stepped palette from them, ignoring the double-values. the palette will have items.size() entries.
1355 \ingroup jkqtplotter_imagelots_tools_LUTS
1356
1357 \note \a items wird zunächst nach dem \c double sortiert
1358*/
1360
1361/*! \brief like JKQTPBuildColorPaletteLUTLinSegmentsSorted(), but sorts \a itemsR, \a itemB, \a itemsG before processing them!
1362 \ingroup jkqtplotter_imagelots_tools_LUTS
1363
1364 \copydetails JKQTPBuildColorPaletteLUTLinSegmentsSorted()
1365
1366*/
1367JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTLinSegments(QList<JKQTPColorPaletteSingleColorLinSegment> itemsR, QList<JKQTPColorPaletteSingleColorLinSegment> itemsG, QList<JKQTPColorPaletteSingleColorLinSegment> itemsB, int lut_size=JKQTPImageTools::LUTSIZE);
1368
1369
1370/*! \brief like JKQTPBuildColorPaletteLUTLinInterpolateSorted(), but accepts a \c QMap<double,QRgb> as parameter instead of \c QList<QPair<double,QRgb>>
1371 \ingroup jkqtplotter_imagelots_tools_LUTS
1372
1373 \copydetails JKQTPBuildColorPaletteLUTLinInterpolateSorted()
1374
1375*/
1377
1378
1379/*! \brief like JKQTPBuildColorPaletteLUTSorted(), but accepts a \c QMap<double,QRgb> as parameter instead of \c QList<QPair<double,QRgb>>
1380 \ingroup jkqtplotter_imagelots_tools_LUTS
1381
1382 \copydetails JKQTPBuildColorPaletteLUTSorted()
1383*/
1385
1386/*! \brief Builds a LUT by evaluating \a palFunc(v) for \c v in the range \a vMin ... \a vMax at \a lut_size equally distributed locations
1387 \ingroup jkqtplotter_imagelots_tools_LUTS
1388*/
1389JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUT(const std::function<QRgb(float)>& palFunc, int lut_size=JKQTPImageTools::LUTSIZE, float vMin=0.0, float vMax=1.0);
1390
1391/*! \brief Builds a LUT by evaluating the triple RGB = ( \a rFunc(v) , \a gFunc(v) , \a bFunc(v) ) for \c v in the range \a vMin ... \a vMax at \a lut_size equally distributed locations
1392 \ingroup jkqtplotter_imagelots_tools_LUTS
1393
1394 \note Each function should return a value between 0 and 1. If the values are larger, the are clipped to this range!
1395*/
1396JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUT(const std::function<float(float)>& rFunc, const std::function<float(float)>& gFunc, const std::function<float(float)>& bFunc, int lut_size=JKQTPImageTools::LUTSIZE, float vMin=0.0, float vMax=1.0);
1397
1398/*! \brief Builds a LUT by evaluating the quadruple RGBA = ( \a rFunc(v) , \a gFunc(v) , \a bFunc(v) ) for \c v in the range \a vMin ... \a vMax at \a lut_size equally distributed locations.
1399 \ingroup jkqtplotter_imagelots_tools_LUTS
1400
1401 \note Each function should return a value between 0 and 1. If the values are larger, the are clipped to this range!
1402*/
1403JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUT(const std::function<float(float)>& rFunc, const std::function<float(float)>& gFunc, const std::function<float(float)>& bFunc, const std::function<float(float)>& aFunc, int lut_size=JKQTPImageTools::LUTSIZE, float vMin=0.0, float vMax=1.0);
1404
1405
1406/*! \brief takes an existing JKQTPImageTools::LUTType and subsamples \a lut_size elements from it
1407 \ingroup jkqtplotter_imagelots_tools_LUTS
1408
1409*/
1411
1412/*! \brief modify each element of a given lut with a given functor that receives the color and an index
1413 \ingroup jkqtplotter_imagelots_tools_LUTS
1414
1415*/
1417/*! \brief modify each element of a given lut with a given functor that receives the color
1418 \ingroup jkqtplotter_imagelots_tools_LUTS
1419
1420*/
1422/*! \brief create color palettes/LUTs by using Green's CubeHelix method
1423 \ingroup jkqtplotter_imagelots_tools_LUTS
1424
1425 \see see Green, D. A. 2011. A colour scheme for the display of astronomical intensity images. Bull. Astr. Soc. India 39, 289-295.
1426 and <a href="https://articles.adsabs.harvard.edu/pdf/2011BASI...39..289G">https://articles.adsabs.harvard.edu/pdf/2011BASI...39..289G</a>
1427 and <a href="https://jiffyclub.github.io/palettable/cubehelix/">https://jiffyclub.github.io/palettable/cubehelix/</a>
1428
1429 \param start start-hue for the palette
1430 \param rotation rotation paremeter for the palette
1431 \param gamma optional gamma parameter
1432 \param lutsize number of entries in LUT
1433 \param lambda_min start value for the \f$ \lambda \f$ in Green's formula
1434 \param lambda_max end value for the \f$ \lambda \f$ in Green's formula
1435 \param saturation_min start value for the saturation in Green's formula, usually the saturation is a single value, then \a saturation_min == \a saturation_max!
1436 \param saturation_max end value for the saturation in Green's formula, usually the saturation is a single value, then \a saturation_min == \a saturation_max!
1437 \return the lut generated from the provided parameters with \a lutsize entries
1438
1439*/
1440JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPCreateGreensCubeHelixLUT(float start, float rotation, float gamma=1.0, int lutsize=JKQTPImageTools::LUTSIZE, float lambda_min=0.0, float lambda_max=1.0, float saturation_min=1.2, float saturation_max=1.2);
1441
1442
1443/** \brief describes how to modify a rendered image with a second data array \see ModifierModeToString(), StringToModifierMode(), JKQTPImageModifierModeComboBox
1444 \ingroup jkqtplotter_imagelots_tools*/
1446 ModifyNone=0, /*!< no modification \image html JKQTPMathImageBaseModifyNone.png */
1447 ModifyValue=1, /*!< modify the VALUE-channel from the HSV color space \image html JKQTPMathImageBaseModifyValue.png */
1448 ModifySaturation=2,/*!< modify the SATURATION-channel from the HSV color space \image html JKQTPMathImageBaseModifySaturation.png */
1449 ModifyAlpha=3,/*!< modify the ALPHA/TRANSPARENCY-channel from the RGBA color space \image html JKQTPMathImageBaseModifyAlpha.png */
1450 ModifyTransparency=ModifyAlpha,/*!< \see ModifyAlpha */
1451 ModifyLuminance=4,/*!< modify the LUMINANCE-channel from the HSL color space \image html JKQTPMathImageBaseModifyLuminance.png */
1452 ModifyHue=5,/*!< modify the HUE-channel from the HSV color space \image html JKQTPMathImageBaseModifyHue.png */
1453};
1454
1455/** \brief convert a ModifierMode to a string
1456 \ingroup jkqtplotter_imagelots_tools
1457 \see ModifierModeToString(), ModifierMode */
1459
1460/** \brief convert a string to a ModifierMode
1461 \ingroup jkqtplotter_imagelots_tools
1462 \see StringToModifierMode(), ModifierMode */
1464
1465/** \brief modify the given image \a img, using modifier image \a dataModifier (of type \a datatypeModifier and size \a Nx * \a Ny), using values in the range \a internalModifierMin ... \a internalModifierMax )
1466 \ingroup jkqtplotter_imagelots_tools
1467 */
1468void JKQTCOMMON_LIB_EXPORT JKQTPModifyImage(QImage& img, JKQTPMathImageModifierMode modifierMode, const void* dataModifier, JKQTPMathImageDataType datatypeModifier, int Nx, int Ny, double internalModifierMin, double internalModifierMax);
1469
1470
1471
1472
1473
1474#endif // JKQTPBASICIMAGETOOLS_H
for building palettes from list of colors and position values, using JKQTPBuildColorPaletteLUTLinInte...
Definition jkqtpbasicimagetools.h:1175
JKQTPPaletteList & operator<<(QColor color)
Definition jkqtpbasicimagetools.h:1236
QList< parameter_type > ListType
Definition jkqtpbasicimagetools.h:1178
JKQTPPaletteList & operator<<(QRgb rgb)
Definition jkqtpbasicimagetools.h:1226
void sort()
sorty by position
Definition jkqtpbasicimagetools.h:1249
double getMinPosition() const
returns the minimum value of the double-component
Definition jkqtpbasicimagetools.h:1254
void push_back(QRgb rgb)
Definition jkqtpbasicimagetools.h:1213
void getMinMaxPosition(double &mi, double &ma, double *avgDelta=nullptr) const
returns the minimum and maximum value of the double-component, as well as the avg....
Definition jkqtpbasicimagetools.h:1282
JKQTPPaletteList(qsizetype size)
Definition jkqtpbasicimagetools.h:1181
double getMaxPosition() const
returns the maximum value of the double-component
Definition jkqtpbasicimagetools.h:1268
JKQTPPaletteList(std::initializer_list< QPair< double, QColor > > args)
Definition jkqtpbasicimagetools.h:1200
JKQTPPaletteList(std::initializer_list< QColor > args)
Definition jkqtpbasicimagetools.h:1193
JKQTPPaletteList(ListType &&other)
Definition jkqtpbasicimagetools.h:1209
JKQTPPaletteList(const ListType &other)
Definition jkqtpbasicimagetools.h:1210
JKQTPPaletteList()
Definition jkqtpbasicimagetools.h:1179
void reverse()
reverse colors
Definition jkqtpbasicimagetools.h:1241
JKQTPPaletteList(std::initializer_list< QPair< double, QRgb > > args)
Definition jkqtpbasicimagetools.h:1185
JKQTPPaletteList(std::initializer_list< QRgb > args)
Definition jkqtpbasicimagetools.h:1186
JKQTPPaletteList(qsizetype size, parameter_type value)
Definition jkqtpbasicimagetools.h:1182
QPair< double, QRgb > parameter_type
Definition jkqtpbasicimagetools.h:1177
void push_back(QColor color)
Definition jkqtpbasicimagetools.h:1230
void push_back(double pos, QRgb rgb)
Definition jkqtpbasicimagetools.h:1222
void push_back(double pos, QColor color)
Definition jkqtpbasicimagetools.h:1233
JKQTPPaletteList(InputIterator first, InputIterator last)
Definition jkqtpbasicimagetools.h:1208
JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTBySubsampling(const JKQTPImageTools::LUTType &items, int lut_size=JKQTPImageTools::NDEFAULTSTEPS)
takes an existing JKQTPImageTools::LUTType and subsamples lut_size elements from it
JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTLinInterpolateSorted(const JKQTPPaletteList &items, int lut_size=JKQTPImageTools::LUTSIZE)
build a linearly interpolated palette (as a look-up table) with lut_size entries by linearly interpol...
JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUT(JKQTPPaletteList items, int lut_size=JKQTPImageTools::LUTSIZE)
like JKQTPBuildColorPaletteLUTSorted(), but sorts items before processing it!
JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTLinInterpolate(JKQTPPaletteList items, int lut_size=JKQTPImageTools::LUTSIZE)
like JKQTPBuildColorPaletteLUTLinInterpolateSorted(), but sorts items before processing it!
QRgb jkqtp_qRgbOpaque(QRgb col)
version of qRgb() that does not require to add the alpha part
Definition jkqtpbasicimagetools.h:1164
JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTLinSegmentsSorted(const QList< JKQTPColorPaletteSingleColorLinSegment > &itemsR, const QList< JKQTPColorPaletteSingleColorLinSegment > &itemsG, const QList< JKQTPColorPaletteSingleColorLinSegment > &itemsB, int lut_size=JKQTPImageTools::LUTSIZE)
build an interpolated palette with lut_size entries from the linear segments defined for the color ch...
JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTLinSegments(QList< JKQTPColorPaletteSingleColorLinSegment > itemsR, QList< JKQTPColorPaletteSingleColorLinSegment > itemsG, QList< JKQTPColorPaletteSingleColorLinSegment > itemsB, int lut_size=JKQTPImageTools::LUTSIZE)
like JKQTPBuildColorPaletteLUTLinSegmentsSorted(), but sorts itemsR, itemB, itemsG before processing ...
JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTColorsOnlySteps(JKQTPPaletteList items)
takes the QRgb-values in items and builds a stepped palette from them, ignoring the double-values....
JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTSorted(const JKQTPPaletteList &items, int lut_size=JKQTPImageTools::LUTSIZE)
build a palette (as a look-up table) with lut_size entries that step between the nodes provided in it...
JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPCreateGreensCubeHelixLUT(float start, float rotation, float gamma=1.0, int lutsize=JKQTPImageTools::LUTSIZE, float lambda_min=0.0, float lambda_max=1.0, float saturation_min=1.2, float saturation_max=1.2)
create color palettes/LUTs by using Green's CubeHelix method
JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPModifyLUT(JKQTPImageTools::LUTType lut, std::function< QRgb(int, QRgb)> f)
modify each element of a given lut with a given functor that receives the color and an index
double JKQTPImagePlot_getImageMax(const T *dbl, int width, int height)
fin the maximum pixel value in the given image dbl with width width and height height
Definition jkqtpbasicimagetools.h:776
QVector< double > JKQTPImagePlot_BarrayToDVector(const bool *input, int N)
returns a vector containing all elements of the given boolean array as doubles (true=1,...
Definition jkqtpbasicimagetools.h:731
JKQTPRGBMathImageRGBMode
modes available for RGB images
Definition jkqtpbasicimagetools.h:705
QString JKQTCOMMON_LIB_EXPORT ModifierModeToString(const JKQTPMathImageModifierMode &mode)
convert a string to a ModifierMode
JKQTPMathImageDataType
possible datatypes of the data array, plotted by this class.
Definition jkqtpbasicimagetools.h:41
double JKQTPImagePlot_getImageMin(const T *dbl, int width, int height)
fin the minimum pixel value in the given image dbl with width width and height height
Definition jkqtpbasicimagetools.h:745
void JKQTPImagePlot_array2RGBimage(const T *dbl_in, int width, int height, QImage &img, int channel, double minColor, double maxColor, JKQTPRGBMathImageRGBMode rgbMode=JKQTPRGBMathImageModeRGBMode, bool logScale=false, double logBase=10.0)
convert a 2D image (as 1D array) into a QImage and puts the image values into one color channel (set ...
Definition jkqtpbasicimagetools.h:819
JKQTPMathImageModifierMode JKQTCOMMON_LIB_EXPORT StringToModifierMode(const QString &mode)
convert a ModifierMode to a string
void JKQTPSetColorChannel(QRgb &rgb, int ch, int val)
set the R/G/B/Alpha (ch == 0/1/2/3) value in the QRgb value rgb to val (0..255!)
Definition jkqtpbasicimagetools.h:71
QVector< double > JKQTPImagePlot_arrayToDVector(const T *input, int N)
returns a vector containing all elements of the given array as doubles
Definition jkqtpbasicimagetools.h:718
JKQTPMathImageColorPalette
available palettes for coloring an image
Definition jkqtpbasicimagetools.h:84
JKQTPMathImageModifierMode
describes how to modify a rendered image with a second data array
Definition jkqtpbasicimagetools.h:1445
int JKQTPGetColorChannel(QRgb rgb, int ch)
retrieve an R/G/B/Alpha (ch == 0/1/2/3) value from the QRgb value rgb
Definition jkqtpbasicimagetools.h:57
void JKQTCOMMON_LIB_EXPORT JKQTPModifyImage(QImage &img, JKQTPMathImageModifierMode modifierMode, const void *dataModifier, JKQTPMathImageDataType datatypeModifier, int Nx, int Ny, double internalModifierMin, double internalModifierMax)
modify the given image img, using modifier image dataModifier (of type datatypeModifier and size Nx *...
JKQTPMathImageColorRangeFailAction
modes available for image pixels that are above/below the pixel value range
Definition jkqtpbasicimagetools.h:363
@ JKQTPRGBMathImageModeRGBMode
Definition jkqtpbasicimagetools.h:706
@ JKQTPRGBMathImageModeHSLMode
Definition jkqtpbasicimagetools.h:708
@ JKQTPRGBMathImageModeHSVMode
Definition jkqtpbasicimagetools.h:707
@ JKQTPRGBMathImageModeCMYMode
Definition jkqtpbasicimagetools.h:709
@ JKQTPMathImageGY_W_RD_STEP
Definition jkqtpbasicimagetools.h:299
@ JKQTPMathImageTerrain_STEP
Definition jkqtpbasicimagetools.h:125
@ JKQTPMathImageINVERTED_Plasma_STEP
Definition jkqtpbasicimagetools.h:160
@ JKQTPMathImageIBMColorBlindSafe
Definition jkqtpbasicimagetools.h:162
@ JKQTPMathImageGY_W_RD
Definition jkqtpbasicimagetools.h:297
@ JKQTPMathImageGR_BR
Definition jkqtpbasicimagetools.h:247
@ JKQTPMathImageSeismic
Definition jkqtpbasicimagetools.h:308
@ JKQTPMathImageYELLOW
Definition jkqtpbasicimagetools.h:95
@ JKQTPMathImageRedWhiteGray
Definition jkqtpbasicimagetools.h:295
@ JKQTPMathImageCubeHelix3_STEP
Definition jkqtpbasicimagetools.h:220
@ JKQTPMathImageINVERTED_RAINBOW
Definition jkqtpbasicimagetools.h:108
@ JKQTPMathImageDark2_STEP
Definition jkqtpbasicimagetools.h:341
@ JKQTPMathImageSeaborn_STEP
Definition jkqtpbasicimagetools.h:227
@ JKQTPMathImageSeabornPastel_STEP
Definition jkqtpbasicimagetools.h:228
@ JKQTPMathImageINVERTED_Copper
Definition jkqtpbasicimagetools.h:121
@ JKQTPMathImageTolMuted_STEP
Definition jkqtpbasicimagetools.h:174
@ JKQTPMathImageINVERTEDGREEN
Definition jkqtpbasicimagetools.h:90
@ JKQTPMathImageBU_GN_YL_STEP
Definition jkqtpbasicimagetools.h:267
@ JKQTPMathImageGR_W_PI
Definition jkqtpbasicimagetools.h:273
@ JKQTPMathImageINVERTED_ALPHA
special palette with decreasing alpha values
Definition jkqtpbasicimagetools.h:347
@ JKQTPMathImageHOT
Definition jkqtpbasicimagetools.h:109
@ JKQTPMathImageMATLAB
Definition jkqtpbasicimagetools.h:101
@ JKQTPMathImageWHITEYELLOW
Definition jkqtpbasicimagetools.h:323
@ JKQTPMathImageGRAY
Definition jkqtpbasicimagetools.h:85
@ JKQTPMathImageBU_GN_YL
Definition jkqtpbasicimagetools.h:265
@ JKQTPMathImageWHITEYELLOWWHITEBLUEBLACK
Definition jkqtpbasicimagetools.h:243
@ JKQTPMathImageINVERTED_CYAN
Definition jkqtpbasicimagetools.h:94
@ JKQTPMathImageLAST_POSSIBLE_REGISTERED_USER_PALETTE
the ID of the last user-defined paletted, registered with JKQTPImageTools::registerPalette() or JKQTP...
Definition jkqtpbasicimagetools.h:355
@ JKQTPMathImageMagma_STEP
Definition jkqtpbasicimagetools.h:142
@ JKQTPMathImageGR_W_PI_STEP
Definition jkqtpbasicimagetools.h:275
@ JKQTPMathImagePaired10_STEP
Definition jkqtpbasicimagetools.h:338
@ JKQTPMathImageGN_Yn_RD_STEP
Definition jkqtpbasicimagetools.h:306
@ JKQTPMathImageINVERTED_Viridis
Definition jkqtpbasicimagetools.h:131
@ JKQTPMathImageGN_BU_STEP
Definition jkqtpbasicimagetools.h:258
@ JKQTPMathImageSeismic_STEP
Definition jkqtpbasicimagetools.h:309
@ JKQTPMathImageRD_Yn_GN_STEP
Definition jkqtpbasicimagetools.h:303
@ JKQTPMathImageBLACKBLUEWHITEYELLOWWHITE
Definition jkqtpbasicimagetools.h:242
@ JKQTPMathImageRED
Definition jkqtpbasicimagetools.h:87
@ JKQTPMathImagePastel2_STEP
Definition jkqtpbasicimagetools.h:343
@ JKQTPMathImageYELLOWREDBLUEBLACK
Definition jkqtpbasicimagetools.h:239
@ JKQTPMathImageINVERTED_BLUEYELLOW
Definition jkqtpbasicimagetools.h:235
@ JKQTPMathImageCubeHelix1_STEP
Definition jkqtpbasicimagetools.h:204
@ JKQTPMathImageINVERTED_Coolwarm_STEP
Definition jkqtpbasicimagetools.h:316
@ JKQTPMathImageINVERTED_Seismic_STEP
Definition jkqtpbasicimagetools.h:311
@ JKQTPMathImageSet3_STEP
Definition jkqtpbasicimagetools.h:339
@ JKQTPMathImageINVERTED_YELLOW
Definition jkqtpbasicimagetools.h:96
@ JKQTPMathImageINVERTEDGRAY
Definition jkqtpbasicimagetools.h:86
@ JKQTPMathImageOR_PU_STEP
Definition jkqtpbasicimagetools.h:254
@ JKQTPMathImageRYGB
Definition jkqtpbasicimagetools.h:103
@ JKQTPMathImageCubeHelix3
Definition jkqtpbasicimagetools.h:216
@ JKQTPMathImageRedBlue
Definition jkqtpbasicimagetools.h:331
@ JKQTPMathImageBlueGreenRed
Definition jkqtpbasicimagetools.h:327
@ JKQTPMathImagePrism8
Definition jkqtpbasicimagetools.h:334
@ JKQTPMathImageYellowGreenBlue
Definition jkqtpbasicimagetools.h:263
@ JKQTPMathImageINVERTED_Magma
Definition jkqtpbasicimagetools.h:140
@ JKQTPMathImageMatlabLegacy_STEP
Definition jkqtpbasicimagetools.h:225
@ JKQTPMathImageRedGreenBlue
Definition jkqtpbasicimagetools.h:328
@ JKQTPMathImagePI_W_GR
Definition jkqtpbasicimagetools.h:270
@ JKQTPMathImageIBMColorBlindSafe_STEP
Definition jkqtpbasicimagetools.h:165
@ JKQTPMathImageFIRST_REGISTERED_USER_PALETTE
the ID of the first user-defined paletted, registered with JKQTPImageTools::registerPalette() or JKQT...
Definition jkqtpbasicimagetools.h:354
@ JKQTPMathImagePaired12_STEP
Definition jkqtpbasicimagetools.h:337
@ JKQTPMathImageINVERTED_Seismic
Definition jkqtpbasicimagetools.h:310
@ JKQTPMathImageRd_Yl_Bl
Definition jkqtpbasicimagetools.h:290
@ JKQTPMathImageRAINBOW
Definition jkqtpbasicimagetools.h:107
@ JKQTPMathImageREDYELLOWBLUE_STEP
Definition jkqtpbasicimagetools.h:291
@ JKQTPMathImageINVERTED_Inferno
Definition jkqtpbasicimagetools.h:148
@ JKQTPMathImageREDWHITEBLUE
Definition jkqtpbasicimagetools.h:281
@ JKQTPMathImageTol_STEP
Definition jkqtpbasicimagetools.h:171
@ JKQTPMathImageCool
Definition jkqtpbasicimagetools.h:118
@ JKQTPMathImageGREENREDVIOLET
Definition jkqtpbasicimagetools.h:240
@ JKQTPMathImageBone
Definition jkqtpbasicimagetools.h:116
@ JKQTPMathImageGN_BU
Definition jkqtpbasicimagetools.h:256
@ JKQTPMathImageRD_W_BL_STEP
Definition jkqtpbasicimagetools.h:284
@ JKQTPMathImageOkabeItoLighter_STEP
Definition jkqtpbasicimagetools.h:184
@ JKQTPMathImageINVERTED_MAGENTA
Definition jkqtpbasicimagetools.h:98
@ JKQTPMathImageGreenWhitePink
Definition jkqtpbasicimagetools.h:274
@ JKQTPMathImagePREDEFINED_PALETTES_COUNT
the number of predefined palettes
Definition jkqtpbasicimagetools.h:349
@ JKQTPMathImageOCEAN
Definition jkqtpbasicimagetools.h:111
@ JKQTPMathImageUSER_PALETTE
special value for JKQTPImageTools::array2image(), which signals the usage of a provided user-defined ...
Definition jkqtpbasicimagetools.h:351
@ JKQTPMathImageCoolwarm
Definition jkqtpbasicimagetools.h:313
@ JKQTPMathImageOkabeItoDarker_STEP
Definition jkqtpbasicimagetools.h:180
@ JKQTPMathImagePlasma
Definition jkqtpbasicimagetools.h:154
@ JKQTPMathImageTRAFFICLIGHT
Definition jkqtpbasicimagetools.h:113
@ JKQTPMathImageInferno_STEP
Definition jkqtpbasicimagetools.h:150
@ JKQTPMathImageBL_Yl_RD
Definition jkqtpbasicimagetools.h:286
@ JKQTPMathImageYellowMagenta
Definition jkqtpbasicimagetools.h:330
@ JKQTPMathImageBL_W_RD_STEP
Definition jkqtpbasicimagetools.h:280
@ JKQTPMathImageMagentaYellow
Definition jkqtpbasicimagetools.h:329
@ JKQTPMathImageMatplotlib_STEP
Definition jkqtpbasicimagetools.h:226
@ JKQTPMathImageCubeHelix2
Definition jkqtpbasicimagetools.h:208
@ JKQTPMathImageGreenBlue
Definition jkqtpbasicimagetools.h:257
@ JKQTPMathImageBLUEWHITERED
Definition jkqtpbasicimagetools.h:277
@ JKQTPMathImageOR_PU
Definition jkqtpbasicimagetools.h:253
@ JKQTPMathImageCopper
Definition jkqtpbasicimagetools.h:120
@ JKQTPMathImageBrownGreen
Definition jkqtpbasicimagetools.h:245
@ JKQTPMathImageINVERTED_RYGB
Definition jkqtpbasicimagetools.h:104
@ JKQTPMathImageBlueRed
Definition jkqtpbasicimagetools.h:332
@ JKQTPMathImageSet2_STEP
Definition jkqtpbasicimagetools.h:345
@ JKQTPMathImageWHITECYAN
Definition jkqtpbasicimagetools.h:320
@ JKQTPMathImageCYANWHITE
Definition jkqtpbasicimagetools.h:318
@ JKQTPMathImageINVERTEDRED
Definition jkqtpbasicimagetools.h:88
@ JKQTPMathImageGrayWhiteRed
Definition jkqtpbasicimagetools.h:298
@ JKQTPMathImagePastel1_STEP
Definition jkqtpbasicimagetools.h:342
@ JKQTPMathImageINVERTED_MATLAB
Definition jkqtpbasicimagetools.h:102
@ JKQTPMathImageREDWHITEBLUE_STEP
Definition jkqtpbasicimagetools.h:283
@ JKQTPMathImageINVERTED_BLUEMAGENTAYELLOW
Definition jkqtpbasicimagetools.h:232
@ JKQTPMathImageINVERTED_MAGENTAWHITE
Definition jkqtpbasicimagetools.h:325
@ JKQTPMathImageMagma
Definition jkqtpbasicimagetools.h:138
@ JKQTPMathImageRd_Yl_Bl_STEP
Definition jkqtpbasicimagetools.h:292
@ JKQTPMathImageAutumn
Definition jkqtpbasicimagetools.h:122
@ JKQTPMathImageSet1_STEP
Definition jkqtpbasicimagetools.h:344
@ JKQTPMathImageFlag16
Definition jkqtpbasicimagetools.h:335
@ JKQTPMathImageAccent_STEP
Definition jkqtpbasicimagetools.h:340
@ JKQTPMathImageBlueGreen
Definition jkqtpbasicimagetools.h:260
@ JKQTPMathImageBU_GN_STEP
Definition jkqtpbasicimagetools.h:261
@ JKQTPMathImageCoolwarm_STEP
Definition jkqtpbasicimagetools.h:314
@ JKQTPMathImageINVERTED_Cool
Definition jkqtpbasicimagetools.h:119
@ JKQTPMathImageINVERTED_Plasma
Definition jkqtpbasicimagetools.h:156
@ JKQTPMathImageINVERTED_HOT
Definition jkqtpbasicimagetools.h:110
@ JKQTPMathImageWHITEMAGENTA
Definition jkqtpbasicimagetools.h:326
@ JKQTPMathImageRD_Yn_GN
Definition jkqtpbasicimagetools.h:301
@ JKQTPMathImageYELLOWWHITE
Definition jkqtpbasicimagetools.h:321
@ JKQTPMathImagePlasma_STEP
Definition jkqtpbasicimagetools.h:158
@ JKQTPMathImageYELLOWBLUE
Definition jkqtpbasicimagetools.h:236
@ JKQTPMathImagePinkWhiteGreen
Definition jkqtpbasicimagetools.h:271
@ JKQTPMathImageTerrain
Definition jkqtpbasicimagetools.h:124
@ JKQTPMathImageBLUEWHITERED_STEP
Definition jkqtpbasicimagetools.h:279
@ JKQTPMathImageTolLight_STEP
Definition jkqtpbasicimagetools.h:177
@ JKQTPMathImageINVERTED_CYANWHITE
Definition jkqtpbasicimagetools.h:319
@ JKQTPMathImageMatlab_STEP
Definition jkqtpbasicimagetools.h:224
@ JKQTPMathImageInferno
Definition jkqtpbasicimagetools.h:146
@ JKQTPMathImageBLUEYELLOW
Definition jkqtpbasicimagetools.h:234
@ JKQTPMathImageRedYelloynGreen
Definition jkqtpbasicimagetools.h:302
@ JKQTPMathImageINVERTED_Terrain_STEP
Definition jkqtpbasicimagetools.h:127
@ JKQTPMathImageGR_BR_STEP
Definition jkqtpbasicimagetools.h:249
@ JKQTPMathImageALPHA
special palette with increasing alpha values
Definition jkqtpbasicimagetools.h:346
@ JKQTPMathImageINVERTED_Inferno_STEP
Definition jkqtpbasicimagetools.h:152
@ JKQTPMathImageINVERTED_OCEAN
Definition jkqtpbasicimagetools.h:112
@ JKQTPMathImageBLUEYELLOWRED
Definition jkqtpbasicimagetools.h:285
@ JKQTPMathImageYELLOWMAGENTABLUE
Definition jkqtpbasicimagetools.h:233
@ JKQTPMathImageINVERTED_Bone
Definition jkqtpbasicimagetools.h:117
@ JKQTPMathImageOkabeIto_STEP
Definition jkqtpbasicimagetools.h:168
@ JKQTPMathImageBLUE
Definition jkqtpbasicimagetools.h:91
@ JKQTPMathImageREDYELLOWBLUE
Definition jkqtpbasicimagetools.h:289
@ JKQTPMathImageViridis
Definition jkqtpbasicimagetools.h:129
@ JKQTPMathImageYL_GN_BU_STEP
Definition jkqtpbasicimagetools.h:264
@ JKQTPMathImageCYAN
Definition jkqtpbasicimagetools.h:93
@ JKQTPMathImageCubeHelixClassic
Definition jkqtpbasicimagetools.h:192
@ JKQTPMathImageBU_GN_YE
Definition jkqtpbasicimagetools.h:266
@ JKQTPMathImageINVERTED_Terrain
Definition jkqtpbasicimagetools.h:126
@ JKQTPMathImageCubeHelix2_STEP
Definition jkqtpbasicimagetools.h:212
@ JKQTPMathImageGreenBrown
Definition jkqtpbasicimagetools.h:248
@ JKQTPMathImageINVERTED_TRAFFICLIGHT
Definition jkqtpbasicimagetools.h:114
@ JKQTPMathImageOrangeWhitePurple
Definition jkqtpbasicimagetools.h:255
@ JKQTPMathImageINVERTED_YELLOWWHITE
Definition jkqtpbasicimagetools.h:322
@ JKQTPMathImageINVERTED_HSV
Definition jkqtpbasicimagetools.h:106
@ JKQTPMathImageHSV
Definition jkqtpbasicimagetools.h:105
@ JKQTPMathImageYL_GN_BU
Definition jkqtpbasicimagetools.h:262
@ JKQTPMathImageBLUEMAGENTAYELLOW
Definition jkqtpbasicimagetools.h:231
@ JKQTPMathImageFlag8
Definition jkqtpbasicimagetools.h:336
@ JKQTPMathImageGN_Yn_RD
Definition jkqtpbasicimagetools.h:304
@ JKQTPMathImagePI_W_GR_STEP
Definition jkqtpbasicimagetools.h:272
@ JKQTPMathImageINVERTED_Autumn
Definition jkqtpbasicimagetools.h:123
@ JKQTPMathImageViridis_STEP
Definition jkqtpbasicimagetools.h:133
@ JKQTPMathImageINVERTEDBLUE
Definition jkqtpbasicimagetools.h:92
@ JKQTPMathImageBL_Yl_RD_STEP
Definition jkqtpbasicimagetools.h:288
@ JKQTPMathImageCubeHelixClassic_STEP
Definition jkqtpbasicimagetools.h:196
@ JKQTPMathImageBlueGreenYellow
Definition jkqtpbasicimagetools.h:268
@ JKQTPMathImageGREEN
Definition jkqtpbasicimagetools.h:89
@ JKQTPMathImageMAGENTA
Definition jkqtpbasicimagetools.h:97
@ JKQTPMathImageVIOLETREDGREEN
Definition jkqtpbasicimagetools.h:241
@ JKQTPMathImagePU_OR_STEP
Definition jkqtpbasicimagetools.h:252
@ JKQTPMathImageBU_GN
Definition jkqtpbasicimagetools.h:259
@ JKQTPMathImageGreenYelloynRed
Definition jkqtpbasicimagetools.h:305
@ JKQTPMathImageBLACKBLUEREDYELLOW
Definition jkqtpbasicimagetools.h:238
@ JKQTPMathImageBR_GR_STEP
Definition jkqtpbasicimagetools.h:246
@ JKQTPMathImagePU_OR
Definition jkqtpbasicimagetools.h:250
@ JKQTPMathImagePurpleWhiteOrange
Definition jkqtpbasicimagetools.h:251
@ JKQTPMathImageBR_GR
Definition jkqtpbasicimagetools.h:244
@ JKQTPMathImageMAGENTAWHITE
Definition jkqtpbasicimagetools.h:324
@ JKQTPMathImageRD_W_BL
Definition jkqtpbasicimagetools.h:282
@ JKQTPMathImageINVERTED_Viridis_STEP
Definition jkqtpbasicimagetools.h:135
@ JKQTPMathImageRD_W_GY
Definition jkqtpbasicimagetools.h:294
@ JKQTPMathImageCubeHelix1
Definition jkqtpbasicimagetools.h:200
@ JKQTPMathImageDefault_STEP
Definition jkqtpbasicimagetools.h:188
@ JKQTPMathImageINVERTED_Coolwarm
Definition jkqtpbasicimagetools.h:315
@ JKQTPMathImageBLUEYELLOWRED_STEP
Definition jkqtpbasicimagetools.h:287
@ JKQTPMathImageBL_W_RD
Definition jkqtpbasicimagetools.h:278
@ JKQTPMathImagePrism16
Definition jkqtpbasicimagetools.h:333
@ JKQTPMathImageINVERTED_Magma_STEP
Definition jkqtpbasicimagetools.h:144
@ JKQTPMathImageRD_W_GY_STEP
Definition jkqtpbasicimagetools.h:296
@ JKQTPMathImageTransparent
Definition jkqtpbasicimagetools.h:366
@ JKQTPMathImageLastPaletteColor
Definition jkqtpbasicimagetools.h:364
@ JKQTPMathImageGivenColor
Definition jkqtpbasicimagetools.h:365
#define JKQTCOMMON_LIB_EXPORT
Definition jkqtcommon_imexport.h:87
#define JKQTP_DOUBLE_EPSILON
double-value epsilon
Definition jkqtpmathtools.h:92
bool jkqtp_approximatelyUnequal(float a, float b, float epsilon=2.0f *JKQTP_FLOAT_EPSILON)
compare two floats a and b for uneuqality, where any difference smaller than epsilon is seen as equal...
Definition jkqtpmathtools.h:305
bool jkqtp_approximatelyEqual(float a, float b, float epsilon=2.0f *JKQTP_FLOAT_EPSILON)
compare two floats a and b for euqality, where any difference smaller than epsilon is seen as equalit...
Definition jkqtpmathtools.h:291
for building palettes from linear segments of single colors using JKQTPBuildColorPaletteLUTLinSegment...
Definition jkqtpbasicimagetools.h:1074
uint8_t colval_startnext
color-channel-value that starts the next segment (ignored for the last entry in a table)
Definition jkqtpbasicimagetools.h:1083
uint8_t colval_endprevious
color-channel-value that ends the prevoius segment (ignored for the first entry in a table)
Definition jkqtpbasicimagetools.h:1081
double position
scalar position of the element on the value axis
Definition jkqtpbasicimagetools.h:1079
static JKQTPColorPaletteSingleColorLinSegment makeDbl_0_1(double p, double y1, double y2)
JKQTPColorPaletteSingleColorLinSegment(double p, uint8_t y1, uint8_t y2)
internal datatype, representing a lookup-table and its metadata inside global_jkqtpimagetools_lutstor...
Definition jkqtpbasicimagetools.h:644
QString nameT
name for the LUT (localized, human-readable)
Definition jkqtpbasicimagetools.h:654
LUTData(const LUTType &_lut, const QString &_name, const QString &_nameT)
QString name
name for the LUT (machine-readable)
Definition jkqtpbasicimagetools.h:652
LUTType lut
the LUT itself
Definition jkqtpbasicimagetools.h:650
QList< QString > legacyNames
legacy (formerly used, but deprecated) name(s) for the LUT (machine-readable)
Definition jkqtpbasicimagetools.h:656
LUTData(const QString &_name, const QString &_nameT)
LUTData(const QString &_lut, const QString &_name, const QString &_nameT)
tool structure that summarizes several static properties of JKQTPlotters palette system,...
Definition jkqtpbasicimagetools.h:375
static QStringList JKQTCOMMON_LIB_EXPORT getPredefinedPalettesMachineReadable()
return a list of all globally available LUTs, machine-readable form
static JKQTCOMMON_LIB_EXPORT QIcon GetPaletteIcon(int i)
generates a QIcon for the i-th color palette (i is based on the list returned by JKQTPImagePlot_getPr...
static JKQTCOMMON_LIB_EXPORT const LUTType & getLUTforPalette(JKQTPMathImageColorPalette palette)
create a LUT for a given JKQTPMathImageColorPalette, stored it in lutstore and return it
static JKQTCOMMON_LIB_EXPORT QIcon GetPaletteIcon(JKQTPMathImageColorPalette palette)
generates a QIcon for a specific JKQTPMathImageColorPalette
static JKQTCOMMON_LIB_EXPORT QVector< QColor > getColorsforPalette(JKQTPMathImageColorPalette palette)
return the list of QColors making up a JKQTPMathImageColorPalette, stored it in lutstore and return i...
static JKQTCOMMON_LIB_EXPORT QMap< int, LUTData > getDefaultLUTs()
returns data of the default LUTs, used to initialize global_jkqtpimagetools_lutstore
static JKQTCOMMON_LIB_EXPORT QReadWriteLock lutMutex
Mutex to protect global_jkqtpimagetools_lutstore, getPredefinedPalettesGlobalList,...
Definition jkqtpbasicimagetools.h:675
static JKQTCOMMON_LIB_EXPORT QString JKQTPMathImageColorPalette2String(JKQTPMathImageColorPalette p)
convert the palette p to a machine-readable string
static void array2image(const T *dbl_in, int width, int height, QImage &img, JKQTPMathImageColorPalette palette, double minColor, double maxColor, JKQTPMathImageColorRangeFailAction paletteMinFail=JKQTPMathImageLastPaletteColor, JKQTPMathImageColorRangeFailAction paletteMaxFail=JKQTPMathImageLastPaletteColor, QColor minFailColor=QColor("black"), QColor maxFailColor=QColor("black"), QColor nanColor=QColor("black"), QColor infColor=QColor("black"), bool logScale=false, double logBase=10.0, const LUTType &lutUser=LUTType())
convert a 2D image (as 1D array) into a QImage with given palette (see JKQTFPColorPalette)
Definition jkqtpbasicimagetools.h:482
static JKQTCOMMON_LIB_EXPORT const LUTType & getLUTforPalette(const QMap< int, LUTData > &lutcache, JKQTPMathImageColorPalette palette)
create a LUT for a given JKQTPMathImageColorPalette, store it in lutstore and return it
static JKQTCOMMON_LIB_EXPORT QString JKQTPMathImageColorPalette2StringHumanReadable(JKQTPMathImageColorPalette p)
convert the palette p to a human-readable (localized) string
static JKQTCOMMON_LIB_EXPORT QStringList getPredefinedPalettesGlobalList
storage for the palette names in getPredefinedPalettes()
Definition jkqtpbasicimagetools.h:671
static JKQTCOMMON_LIB_EXPORT const int PALETTE_IMAGEICON_HEIGHT
Height of the Palette-Icons, generated e.g. by JKQTPImageTools::GetPaletteIcon()
Definition jkqtpbasicimagetools.h:383
static JKQTCOMMON_LIB_EXPORT QStringList getPredefinedPalettesMachineReadableGlobalList
storage for the palette names in etPredefinedPalettesMachineReadable()
Definition jkqtpbasicimagetools.h:673
static JKQTCOMMON_LIB_EXPORT JKQTPMathImageColorPalette String2JKQTPMathImageColorPalette(const QString &p)
convert the palette name p to JKQTPMathImageColorPalette (compatible with JKQTPImageTools::String2JKQ...
static JKQTCOMMON_LIB_EXPORT int registerPalette(const QString &name, const LUTType &paletteLut, const QString &nameT=QString())
registers a new LUT defined by paletteLut and with the given name (computer-readable) for later use,...
static JKQTCOMMON_LIB_EXPORT QImage GetPaletteImage(const LUTType &lut, int width)
generates a QImage with width width and height 1 for a lookup-table lut
static JKQTCOMMON_LIB_EXPORT const int NDEFAULTSTEPS
number of entries in an auto-generated steps-palette
Definition jkqtpbasicimagetools.h:389
static JKQTCOMMON_LIB_EXPORT QImage GetPaletteImage(JKQTPMathImageColorPalette palette, int width)
generates a QImage with width width and height 1 for a specific JKQTPMathImageColorPalette
static JKQTCOMMON_LIB_EXPORT QImage GetPaletteImage(int i, int width)
generates a QImage with width width and height 1 for the i-th color palette (i is based on the list r...
static JKQTCOMMON_LIB_EXPORT int global_next_userpalette
storage for the next ID to assign to a user-defined palette, registered with registerPalette() or reg...
Definition jkqtpbasicimagetools.h:669
static JKQTCOMMON_LIB_EXPORT const int PALETTE_ICON_WIDTH
Width of the Palette-Icons, generated e.g. by JKQTPImageTools::GetPaletteIcon()
Definition jkqtpbasicimagetools.h:381
static JKQTCOMMON_LIB_EXPORT QImage GetPaletteImage(int i, int width, int height)
generates a QImage with width width and height height for the i-th color palette (i is based on the l...
static JKQTCOMMON_LIB_EXPORT const int LUTSIZE
size of the lookup tables used by JKQTFPimagePlot_array2image()
Definition jkqtpbasicimagetools.h:386
static JKQTCOMMON_LIB_EXPORT QMap< int, LUTData > global_jkqtpimagetools_lutstore
internal global storage object for lookup-tables
Definition jkqtpbasicimagetools.h:662
static JKQTCOMMON_LIB_EXPORT QImage GetPaletteImage(JKQTPMathImageColorPalette palette, int width, int height)
generates a QImage with width width and height height for a specific JKQTPMathImageColorPalette
static QStringList JKQTCOMMON_LIB_EXPORT getPredefinedPalettes()
return a list of all globally available LUTs, human-readable/localized form
static void array2image(const T *dbl_in, int width, int height, QImage &img, const LUTType &lutUser, double minColor, double maxColor, JKQTPMathImageColorRangeFailAction paletteMinFail=JKQTPMathImageLastPaletteColor, JKQTPMathImageColorRangeFailAction paletteMaxFail=JKQTPMathImageLastPaletteColor, QColor minFailColor=QColor("black"), QColor maxFailColor=QColor("black"), QColor nanColor=QColor("black"), QColor infColor=QColor("black"), bool logScale=false, double logBase=10.0)
convert a 2D image (as 1D array) into a QImage with given palette (see JKQTFPColorPalette)
Definition jkqtpbasicimagetools.h:589
QVector< QRgb > LUTType
Datatype to store lookup-tables used to map data values (scales to 0..size-1) onto RGB-colors.
Definition jkqtpbasicimagetools.h:378
static JKQTCOMMON_LIB_EXPORT QVector< int > registerPalettesFromFile(const QString &filename, bool interpolatePalette=false)
loads all palettes defined in the given palette files filename into global_jkqtpimagetools_userluts a...