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
|
tool structure that summarizes several static properties of JKQTPlotters palette system, also provides functions to work with palettes and register user-defined palettes. More...
#include <jkqtpbasicimagetools.h>
Classes | |
struct | LUTData |
internal datatype, representing a lookup-table and its metadata inside global_jkqtpimagetools_lutstore More... | |
Public Types | |
typedef QVector< QRgb > | LUTType |
Datatype to store lookup-tables used to map data values (scales to 0..size-1) onto RGB-colors. | |
Static Public Member Functions | |
template<class T > | |
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) | |
template<class T > | |
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) | |
static JKQTCOMMON_LIB_EXPORT QVector< QColor > | getColorsforPalette (JKQTPMathImageColorPalette palette) |
return the list of QColors making up a JKQTPMathImageColorPalette, stored it in lutstore and return it | |
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 (int i) |
generates a QIcon for the i-th color palette (i is based on the list returned by JKQTPImagePlot_getPredefinedPalettes() ) | |
static JKQTCOMMON_LIB_EXPORT QIcon | GetPaletteIcon (JKQTPMathImageColorPalette palette) |
generates a QIcon for a specific JKQTPMathImageColorPalette | |
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 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 returned by JKQTPImagePlot_getPredefinedPalettes() ) | |
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 list returned by JKQTPImagePlot_getPredefinedPalettes() ) | |
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 (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 QStringList JKQTCOMMON_LIB_EXPORT | getPredefinedPalettesMachineReadable () |
return a list of all globally available LUTs, machine-readable form | |
static JKQTCOMMON_LIB_EXPORT QString | JKQTPMathImageColorPalette2String (JKQTPMathImageColorPalette p) |
convert the palette p to a machine-readable string | |
static JKQTCOMMON_LIB_EXPORT QString | JKQTPMathImageColorPalette2StringHumanReadable (JKQTPMathImageColorPalette p) |
convert the palette p to a human-readable (localized) string | |
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, optionally stores also the human-readable and localized name nameT and assigns a new LUT-ID >=JKQTPMathImageFIRST_REGISTERED_USER_PALETTE to the palette and returns it | |
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 and assigns a new LUT-ID >=JKQTPMathImageFIRST_REGISTERED_USER_PALETTE to each palette All new IDs are returned as a list | |
static JKQTCOMMON_LIB_EXPORT JKQTPMathImageColorPalette | String2JKQTPMathImageColorPalette (const QString &p) |
convert the palette name p to JKQTPMathImageColorPalette (compatible with JKQTPImageTools::String2JKQTPMathImageColorPalette() ) | |
Static Public Attributes | |
static JKQTCOMMON_LIB_EXPORT const int | LUTSIZE |
size of the lookup tables used by JKQTFPimagePlot_array2image() | |
static JKQTCOMMON_LIB_EXPORT const int | NDEFAULTSTEPS |
number of entries in an auto-generated steps-palette | |
static JKQTCOMMON_LIB_EXPORT const int | PALETTE_ICON_WIDTH |
Width of the Palette-Icons, generated e.g. by JKQTPImageTools::GetPaletteIcon() | |
static JKQTCOMMON_LIB_EXPORT const int | PALETTE_IMAGEICON_HEIGHT |
Height of the Palette-Icons, generated e.g. by JKQTPImageTools::GetPaletteIcon() | |
Static Private Member Functions | |
static JKQTCOMMON_LIB_EXPORT QMap< int, LUTData > | getDefaultLUTs () |
returns data of the default LUTs, used to initialize global_jkqtpimagetools_lutstore | |
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 Private Attributes | |
static JKQTCOMMON_LIB_EXPORT QStringList | getPredefinedPalettesGlobalList |
storage for the palette names in getPredefinedPalettes() | |
static JKQTCOMMON_LIB_EXPORT QStringList | getPredefinedPalettesMachineReadableGlobalList |
storage for the palette names in etPredefinedPalettesMachineReadable() | |
static JKQTCOMMON_LIB_EXPORT QMap< int, LUTData > | global_jkqtpimagetools_lutstore |
internal global storage object for lookup-tables | |
static JKQTCOMMON_LIB_EXPORT int | global_next_userpalette |
storage for the next ID to assign to a user-defined palette, registered with registerPalette() or registerPalettesFromFile() | |
static JKQTCOMMON_LIB_EXPORT QReadWriteLock | lutMutex |
Mutex to protect global_jkqtpimagetools_lutstore, getPredefinedPalettesGlobalList, getPredefinedPalettesMachineReadableGlobalList and global_next_userpalette. | |
tool structure that summarizes several static properties of JKQTPlotters palette system, also provides functions to work with palettes and register user-defined palettes.
typedef QVector<QRgb> JKQTPImageTools::LUTType |
Datatype to store lookup-tables used to map data values (scales to 0..size-1) onto RGB-colors.
|
inlinestatic |
convert a 2D image (as 1D array) into a QImage with given palette (see JKQTFPColorPalette)
dbl_in | pointer to a 1D array of template type T representing the image to plot. This array has to be of size width * height | |
width | width of the array in dbl | |
height | height of the array in dbl | |
[out] | img | the QImage object to draw to (should be initialized as QImage::Format_ARGB32 ) |
lutUser | user-defined lookup-table | |
minColor | lower boundary of color range in dbl pixels, if minColor == maxColor then this function will extract the image min and image max. | |
maxColor | upper boundary of color range in dbl pixels, if minColor == maxColor then this function will extract the image min and image max. | |
paletteMinFail | specifies what shell happen, when a value in dbl is below minColor | |
paletteMaxFail | specifies what shell happen, when a value in dbl is above maxColor | |
minFailColor | color to use for pixels that are below minColor for some settings of paletteMinFail | |
maxFailColor | color to use for pixels that are below maxColor for some settings of paletteMaxFail | |
nanColor | color to use for pixels that are not-a-number | |
infColor | color to use for pixels that are infinity | |
logScale | create a log-scaled image | |
logBase | base for the logarithm used when logScale==true |
|
inlinestatic |
convert a 2D image (as 1D array) into a QImage with given palette (see JKQTFPColorPalette)
dbl_in | pointer to a 1D array of template type T representing the image to plot. This array has to be of size width * height | |
width | width of the array in dbl | |
height | height of the array in dbl | |
[out] | img | the QImage object to draw to (should be initialized as QImage::Format_ARGB32 ) |
palette | the color palette to use for the display | |
minColor | lower boundary of color range in dbl pixels, if minColor == maxColor then this function will extract the image min and image max. | |
maxColor | upper boundary of color range in dbl pixels, if minColor == maxColor then this function will extract the image min and image max. | |
paletteMinFail | specifies what shell happen, when a value in dbl is below minColor | |
paletteMaxFail | specifies what shell happen, when a value in dbl is above maxColor | |
minFailColor | color to use for pixels that are below minColor for some settings of paletteMinFail | |
maxFailColor | color to use for pixels that are below maxColor for some settings of paletteMaxFail | |
nanColor | color to use for pixels that are not-a-number | |
infColor | color to use for pixels that are infinity | |
logScale | create a log-scaled image | |
logBase | base for the logarithm used when logScale==true | |
lutUser | user define LUT, used if palette ==JKQTPMathImageUSER_PALETTE |
|
static |
return the list of QColors making up a JKQTPMathImageColorPalette, stored it in lutstore and return it
|
staticprivate |
returns data of the default LUTs, used to initialize global_jkqtpimagetools_lutstore
|
staticprivate |
create a LUT for a given JKQTPMathImageColorPalette, store it in lutstore and return it
|
static |
create a LUT for a given JKQTPMathImageColorPalette, stored it in lutstore and return it
|
static |
generates a QIcon for the i-th color palette (i is based on the list returned by JKQTPImagePlot_getPredefinedPalettes() )
|
static |
generates a QIcon for a specific JKQTPMathImageColorPalette
|
static |
generates a QImage with width width and height 1 for a lookup-table lut
|
static |
generates a QImage with width width and height 1 for the i-th color palette (i is based on the list returned by JKQTPImagePlot_getPredefinedPalettes() )
|
static |
generates a QImage with width width and height height for the i-th color palette (i is based on the list returned by JKQTPImagePlot_getPredefinedPalettes() )
|
static |
generates a QImage with width width and height 1 for a specific JKQTPMathImageColorPalette
|
static |
generates a QImage with width width and height height for a specific JKQTPMathImageColorPalette
|
static |
return a list of all globally available LUTs, human-readable/localized form
|
static |
return a list of all globally available LUTs, machine-readable form
|
static |
convert the palette p to a machine-readable string
|
static |
convert the palette p to a human-readable (localized) string
|
static |
registers a new LUT defined by paletteLut and with the given name (computer-readable) for later use, optionally stores also the human-readable and localized name nameT and assigns a new LUT-ID >=JKQTPMathImageFIRST_REGISTERED_USER_PALETTE to the palette and returns it
|
static |
loads all palettes defined in the given palette files filename into global_jkqtpimagetools_userluts and assigns a new LUT-ID >=JKQTPMathImageFIRST_REGISTERED_USER_PALETTE to each palette All new IDs are returned as a list
The file might either be a palette XML-file or a CSV-file:
CSV-files need to have one of the following two formats (RED/GREEN/BLUE: 0..255):
scalar, red, green, blue scalar, red, green, blue ...
or simply
red, green, blue red, green, blue ...
The parser will also allow tabs and whitespaces as column separators.
CML-files need to have one of the following two formats (RED/GREEN/BLUE/OPACITY: 0..1):
<ColorMap name="PALETTENAME" space="RGB"> <Point x="scalar" r="RED" g="GREEN" b="BLUE"/> <Point x="scalar" r="RED" g="GREEN" b="BLUE"/> ... </ColorMap>
optionally several
definitions may be put below an arbitrarily named document node, e.g.:
<ColorMaps> <ColorMap name="PALETTENAME" space="RGB"> <Point x="scalar" r="RED" g="GREEN" b="BLUE"/> <Point x="scalar" r="RED" g="GREEN" b="BLUE"/> ... </ColorMap> <ColorMap name="PALETTENAME" space="RGB"> <Point x="scalar" r="RED" g="GREEN" b="BLUE"/> <Point x="scalar" r="RED" g="GREEN" b="BLUE"/> ... </ColorMap> ... </ColorMaps>
true
, the function JKQTPBuildColorPaletteLUTLinInterpolate() is used instead.
|
static |
convert the palette name p to JKQTPMathImageColorPalette (compatible with JKQTPImageTools::String2JKQTPMathImageColorPalette() )
|
staticprivate |
storage for the palette names in getPredefinedPalettes()
|
staticprivate |
storage for the palette names in etPredefinedPalettesMachineReadable()
|
staticprivate |
internal global storage object for lookup-tables
|
staticprivate |
storage for the next ID to assign to a user-defined palette, registered with registerPalette() or registerPalettesFromFile()
|
staticprivate |
Mutex to protect global_jkqtpimagetools_lutstore, getPredefinedPalettesGlobalList, getPredefinedPalettesMachineReadableGlobalList and global_next_userpalette.
|
static |
size of the lookup tables used by JKQTFPimagePlot_array2image()
|
static |
number of entries in an auto-generated steps-palette
|
static |
Width of the Palette-Icons, generated e.g. by JKQTPImageTools::GetPaletteIcon()
|
static |
Height of the Palette-Icons, generated e.g. by JKQTPImageTools::GetPaletteIcon()