SatDump 2.0.0-alpha-76a915210
Loading...
Searching...
No Matches
image_product_handler.h
1#pragma once
2
4#include "product_handler.h"
7#include "products/image/image_calibrator.h"
9#include <vector>
10
11namespace satdump
12{
13 namespace handlers
14 {
15 class ImageProductHandler : public ProductHandler
16 {
17 public:
18 ImageProductHandler(std::shared_ptr<products::Product>, bool dataset_mode = false);
19 ~ImageProductHandler();
20
21 std::shared_ptr<ImageHandler> img_handler;
22
23 // Advanced mode
24 bool enabled_advanced_menus = false;
25
26 // Products
28 std::shared_ptr<products::ImageCalibrator> img_calibrator;
29
30 // Auto-update in UI
31 bool needs_to_update = true;
32
33 // Channel selection
34 std::string channel_selection_box_str;
35 int channel_selection_curr_id = 0;
36
37 // Calibration : Single channels / range
38 bool images_can_be_calibrated = false;
39 bool channel_calibrated = false;
40
41 struct CalibInfo
42 {
44 double min;
45 double max;
46 };
47
48 std::map<int, std::map<std::string, CalibInfo>> channels_calibrated_ranges;
49 std::string channels_calibrated_curr_unit;
50
51 // Calibration : Units / Ranges for mouse overlay
52 std::vector<std::pair<calibration::UnitInfo, std::shared_ptr<calibration::UnitConverter>>> channels_calibration_units_and_converters;
53
54 void initOverlayConverters();
55
56 // Expression
57 std::string expression;
58 float progress = 0;
59
60 // Proc function
61 void do_process();
62
63 // The Rest
64 void drawMenu();
65 void drawContents(ImVec2 win_size);
66 void drawMenuBar();
67
68 void setConfig(nlohmann::json p);
69 nlohmann::json getConfig();
70 void resetConfig() { img_handler->resetConfig(); }
71
72 void saveResult(std::string directory);
73
74 void addSubHandler(std::shared_ptr<Handler> handler, bool ontop = false)
75 {
76 // Handler::addSubHandler(handler, ontop);
77 img_handler->addSubHandler(handler, ontop);
78 }
79
80 void delSubHandler(std::shared_ptr<Handler> handler, bool now = false)
81 { // Handler::delSubHandler(handler, now);
82 img_handler->delSubHandler(handler, true);
83 }
84
85 bool drawTreeMenu(std::shared_ptr<Handler> &h)
86 {
87 // Handler::drawTreeMenu(h);
88 return img_handler->drawTreeMenu(h);
89 }
90
91 std::string getID() { return "image_product_handler"; }
92 };
93 } // namespace handlers
94} // namespace satdump
void resetConfig()
Optional, allows resetting the handler's configuration.
Definition image_product_handler.h:70
void drawContents(ImVec2 win_size)
Render explorer contents (center/left)
Definition image_product_handler.cpp:402
void drawMenuBar()
Render explorer menu bar (in the left sidebar)
Definition image_product_handler.cpp:387
void drawMenu()
Render explorer menu left sidebar.
Definition image_product_handler.cpp:92
void addSubHandler(std::shared_ptr< Handler > handler, bool ontop=false)
Add a new subhandler.
Definition image_product_handler.h:74
void do_process()
Actual processing function to be implemented by the child class.
Definition image_product_handler.cpp:351
void setConfig(nlohmann::json p)
Optional, allows setting a configuration/state from JSON.
Definition image_product_handler.cpp:263
void delSubHandler(std::shared_ptr< Handler > handler, bool now=false)
Delete a subhandler.
Definition image_product_handler.h:80
nlohmann::json getConfig()
Optional, allows getting a configuration/state as JSON.
Definition image_product_handler.cpp:324
bool drawTreeMenu(std::shared_ptr< Handler > &h)
Render explorer menu bar (in the left sidebar)
Definition image_product_handler.h:85
ProductHandler(std::shared_ptr< products::Product > p, bool dataset_mode=false, std::function< bool(nlohmann::ordered_json &)> filterPreset=[](auto &) { return true;})
Constructor.
Definition product_handler.cpp:17
SatDump image product class.
Definition image_product.h:42
ImageProduct implementation.
Calibration Unit information.
Definition calibration_units.h:35
Definition image_product_handler.h:42