optris::sdk::view::ViewConfig
Top-level view configuration with switchable presets.
Public attributes
version
std::string version = "1.0"
Schema version stamped into the file as version.
Written and read back, never compared against anything: there is no migration path and no version is rejected. It exists so a future loader has something to branch on, and so you can inspect what wrote a file. Do not expect the SDK to refuse a config because of it.
global_emissivity
float global_emissivity = 1.0F
Emissivity of the scene as a whole, physically (0, 1].
Stored only. Loading a config pushes it nowhere -- hand it to FrameProcessor::SetGlobalEmissivity() yourself. A Roi carrying its own non-zero emissivity overrides it over the pixels that ROI covers.
It lives on ViewConfig rather than on a preset on purpose: it describes the target being measured, not how you want to look at it, so switching presets must not silently change a temperature reading. Nothing validates the range.
presets
std::vector< VisualizationPreset > presets
The presets in the file, in file order. The index is identity.
May be empty: a config with no presets loads fine, and GetActivePreset() covers that case rather than failing. Erasing or reordering entries invalidates active_preset_index, which is a bare index and is not fixed up for you.
active_preset_index
uint32_t active_preset_index = 0
Which entry of presets is current.
Stored under the JSON key active_preset, which does not match this field's name. An out-of-range value is clamped to the last preset by GetActivePreset() rather than rejected, so a stale index left over from a longer list quietly selects a different preset instead of reporting anything.
Public static functions
LoadFromFile
static ViewConfig LoadFromFile(const std::filesystem::path &path)
Load from a JSON file.
Exceptions
| Name | Description |
|---|---|
IoException |
if the file cannot be opened. |
SdkException |
if it is not the JSON this expects. |
Both are SDK exception types deliberately: a consumer cannot name nlohmann's own without nlohmann on their include path.
LoadOrDefault
static ViewConfig LoadOrDefault(const std::filesystem::path &path)
Load from file, returning defaults if the file is missing/corrupt.
CreateDefault
static ViewConfig CreateDefault()
Built-in default: Iron palette, auto scaling, no ROIs.
Public functions
GetActivePreset
const VisualizationPreset & GetActivePreset() const
The preset at active_preset_index, clamped into range.
Cannot fail. When presets is empty it returns a shared, default-constructed preset with static lifetime that is not part of this ViewConfig: the reference stays valid, but it is the same object for every empty config in the process, and filling presets afterwards does not update it. Call again rather than holding the reference across a change to presets.
GetActivePreset
VisualizationPreset & GetActivePreset()
The preset at active_preset_index, for modification.
Unlike the const overload this one can mutate the config: on an empty presets it appends a default preset and returns that, so merely reading a setting through it changes the config's size and invalidates any outstanding reference or iterator into presets.
SaveToFile
void SaveToFile(const std::filesystem::path &path) const
Serialize to JSON and write atomically.