31 #ifndef DRAIN_PALETTEOP_H
32 #define DRAIN_PALETTEOP_H
35 #include "drain/util/Bank.h"
36 #include "drain/image/Palette.h"
58 PaletteOp() :
ImageOp(__FUNCTION__,
"Applies colour palette to an image"), palettePtr(&myPalette) {
59 this->parameters.link(
"scale",
scale = 1.0);
60 this->parameters.link(
"offset",
offset = 0.0);
64 PaletteOp(
const Palette & palette) :
ImageOp(__FUNCTION__,
"Applies colour palette to an image"), palettePtr(&myPalette) {
65 this->parameters.link(
"scale",
scale = 1.0);
66 this->parameters.link(
"offset",
offset = 0.0);
72 PaletteOp(
const std::string & filename =
"") :
ImageOp(__FUNCTION__,
"Applies colour palette to an image"), palettePtr(&myPalette) {
73 this->parameters.link(
"scale",
scale = 1.0);
74 this->parameters.link(
"offset",
offset = 0.0);
76 myPalette.load(filename);
87 void help(std::ostream & ostr = std::cout)
const;
97 const Palette & getPalette()
const {
110 Palette & getPalette(
const std::string & key);
155 typedef PaletteMap palette_map_t;
174 const Palette *palettePtr;
Struct for image (excluding data)
Definition: ImageConf.h:333
Base class for image processing functions.
Definition: ImageOp.h:49
ImageOp(const std::string &name=__FUNCTION__, const std::string &description="")
Definition: ImageOp.h:156
Container applicable for Channels and Images, with alpha support.
Definition: ImageTray.h:267
Colorizes an image of 1 channel to an image of N channels by using a palette image as a lookup table.
Definition: PaletteOp.h:55
Palette specialCodes
Intensity mappings set by user, originally with std::string keys in Palette.
Definition: PaletteOp.h:146
double offset
Prescale intensities with scale*i + offset.
Definition: PaletteOp.h:133
void setPalette(const Palette &palette)
Creates an internal palette by taking the colors on the diagonal from lower left to upper right corne...
Definition: PaletteOp.cpp:78
static palette_map_t & getPaletteMap()
Returns a static palette map which is initially empty.
Definition: PaletteOp.cpp:165
double scale
Uses the original coloured palette to create a gray-level palette.
Definition: PaletteOp.h:130
virtual void help(std::ostream &ostr=std::cout) const
Prints name, description and parameters using BeanLike::toOStr(). Virtual, so derived classes may ext...
Definition: PaletteOp.cpp:252
static Palette & loadPalette(const std::string &key)
NEW Load palette to Palette::paletteBank by key (like "DBZH") from TXT or JSON file.
Definition: PaletteOp.cpp:100
void getDstConf(const ImageConf &src, ImageConf &dst) const
Given source image, determine respective dest image configuration.
Definition: PaletteOp.cpp:217
void registerSpecialCode(const std::string &code, double d)
Connect special code (label) to intensity.
Definition: PaletteOp.cpp:174
Definition: DataSelector.cpp:1277