Loading...
Searching...
No Matches
resources-image.h
1/*
2
3MIT License
4
5Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26/*
27Part of Rack development has been done in the BALTRAD projects part-financed
28by the European Union (European Regional Development Fund and European
29Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30*/
31
32// # pragma once
33#ifndef RACK_RESOURCES_IMG
34#define RACK_RESOURCES_IMG
35
36#include <string>
37
38#include <drain/RegExp.h>
39#include <drain/image/Image.h>
40#include <drain/image/LayoutSVG.h>
41#include <drain/image/TreeSVG.h>
42#include <drain/image/TreeUtilsSVG.h>
43#include <drain/imageops/PaletteOp.h>
44#include <drain/imageops/ImageModifierPack.h>
45#include <drain/imageops/PaletteOp.h>
46#include <drain/prog/CommandBankUtils.h>
47#include <drain/util/Rectangle.h>
48
49#include "data/QuantityMap.h"
50#include "data/VariableFormatterODIM.h"
51
52
53namespace rack {
54
55
56
57
58// using namespace drain::image;
59
60
61
62// Consider moving ImageKit here?
64public:
65
66
69
72
75
77
83
84 // Accessed by CmdSampler
85 ImageSampler imageSampler;
86
87
88 inline
89 void setCurrentImageColor(const drain::image::Image & src){
90 currentImage = &src;
91 }
92
93 inline
94 void setCurrentImages(const drain::image::Image & src){
95 currentImage = &src;
96 currentGrayImage = &src;
97 }
98
99 inline
100 void unsetCurrentImages(){
101 currentImage = nullptr;
102 currentGrayImage = nullptr;
103 }
104
105 void getImageStatus(drain::FlexVariableMap & statusMap) const;
106
107
109 const Image *currentImage = nullptr; // = NULL;
110
112 const Image *currentGrayImage = nullptr; // = NULL; // data or grayImage
113
114
115 Image grayImage;
116 Image colorImage;
117
118 std::string paletteKey;
119 unsigned short int paletteResolution = 0;
120
121 drain::image::Palette & getPalette();
122
123 drain::image::Palette & getPalette(const std::string & key);
124
125 void refinePalette(drain::image::Palette & palette);
126
127
128 // New, returns also the actual key.
129 //PaletteMap::iterator it getPaletteEntry(const std::string & key);
130
132 static
133 void getImageInfo(const drain::image::Image *ptr, drain::Variable & entry);
134
135
136
137 static
139
140//protected:
141
142 void updateImageStatus(drain::VariableMap & statusMap) const ;
143
144
145};
146
147
148}
149
150#endif /* RACKLET_H_ */
151
152// Rack
A map of FlexVariable:s.
Definition VariableMap.h:144
A map of Variables.
Definition VariableMap.h:61
Traverses image, returning samples.
Definition ImageModifierPack.h:400
Class for multi-channel digital images. Supports dynamic typing with base types (char,...
Definition Image.h:183
Definition Palette.h:55
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition Data.h:1293
Definition resources-image.h:63
bool imagePhysical
Defines if the next image processing operation uses scaled intentsites instead of raw byte values.
Definition resources-image.h:74
const Image * currentImage
Pointer to the last 2D data (image) processed.
Definition resources-image.h:109
static void getImageInfo(const drain::image::Image *ptr, drain::Variable &entry)
Given image pointer (null ok), get properties.
Definition resources-image.cpp:175
static std::string outputQuantitySyntax
Definition resources-image.h:138
ImageContext()
Default constr.
Definition resources-image.cpp:43
ODIMPathElem::group_t qualityGroups
Defines which quality data, if any, is used as input weight.
Definition resources-image.h:82
const Image * currentGrayImage
Pointer to the last single-channel 2D data (image) processed.
Definition resources-image.h:112
DRAIN_VARIABLE Variable
Value container supporting dynamic type.
Definition Variable.h:63
Definition AltitudeOp.cpp:42