optris::sdk::RoiContainer
Container that manages ROIs with unique IDs. IDs are generated using sqids: short, unique, numeric. Each Add() call returns the assigned ID.
Public functions
RoiContainer
RoiContainer()
~RoiContainer
~RoiContainer()
RoiContainer
RoiContainer(RoiContainer &&) noexcept
Takes over the ROIs and the ID index; the source is left empty. Copying is deleted below because IDs are unique only within one container, and a copy would give the same IDs two owners.
operator=
RoiContainer & operator=(RoiContainer &&) noexcept
Move assignment, with the same transfer of ownership as the move constructor. The ROIs this container held are destroyed.
RoiContainer
RoiContainer(const RoiContainer &)=delete
operator=
RoiContainer & operator=(const RoiContainer &)=delete
Add
uint64_t Add(Roi roi)
Add an ROI. Returns its unique ID.
Remove
bool Remove(uint64_t id)
Remove an ROI by ID. Returns false if not found.
Get
Roi * Get(uint64_t id)
Get an ROI by ID. Returns nullptr if not found.
Get
const Roi * Get(uint64_t id) const
Const overload of Get(). Same lookup, read-only. Reach for the mutable one to edit an ROI in place: removing and re-adding it gives it a new ID.
GetAll
std::vector< Roi > & GetAll()
Get all ROIs.
GetAll
const std::vector< Roi > & GetAll() const
Const overload of GetAll(), in insertion order.
Remove() erases from the middle of this vector, so it shifts every later element and invalidates outstanding pointers and indices. Hold IDs across calls, not positions.
GetIds
std::vector< uint64_t > GetIds() const
Get all ROI IDs.
Count
size_t Count() const
Number of ROIs.
Clear
void Clear()
Remove all ROIs.
UpdateStats
void UpdateStats(const float *data, uint32_t width, uint32_t height)
Update statistics for all ROIs from celsius data.
UpdateStats
void UpdateStats(const int16_t *data, uint32_t width, uint32_t height)
Update statistics for all ROIs from internal int16 data.
LoadFromFile
void LoadFromFile(const std::string &path)
Load ROIs from a JSON file. Existing ROIs are cleared.
SaveToFile
void SaveToFile(const std::string &path) const
Save all ROIs to a JSON file.