Thermal Camera SDK 10.0.1
SDK for Optris Thermal Cameras
Loading...
Searching...
No Matches
MeasurementField.h
Go to the documentation of this file.
1// Copyright (c) 2025 Optris GmbH Co. KG
2
10
11#pragma once
12
13#include <vector>
14#include <cstdlib>
15
16#include "otcsdk/Api.h"
17#include "otcsdk/Exceptions.h"
20
21
22namespace optris
23{
24
32{
33 // Special iterator access.
34 friend class ConstMeasurementFieldIterator;
35
36
37public:
40
56 int x,
57 int y,
58 int width,
59 int height,
60 float emissivity = 1.F,
61 float transmissivity = 1.F,
62 float ambientTemperature = INVALID_TEMPERATURE) noexcept;
63
67 OTC_SDK_API MeasurementField& operator=(const MeasurementField& rhs) = default;
68
72 OTC_SDK_API MeasurementField& operator=(MeasurementField&& rhs) noexcept = default;
73
76
77
83 int getId() const noexcept;
84
90 void setId(int id) noexcept;
91
92
102 OTC_SDK_API unsigned short getValue(int index) const;
103
113 float getTemperature(int index) const;
114
125 OTC_SDK_API unsigned short getValue(int x, int y) const;
126
137 float getTemperature(int x, int y) const noexcept(false);
138
139
147 ConstMeasurementFieldIterator getConstIterator() const noexcept;
148
155
161 int getX() const noexcept;
162
168 int getY() const noexcept;
169
170
178 void setPosition(int x, int y) noexcept;
179
180
186 int getWidth() const noexcept;
187
193 int getHeight() const noexcept;
194
200 int getSize() const noexcept;
201
208 OTC_SDK_API void resize(int width, int height);
209
210
216 float getEmissivity() const noexcept;
217
223 float getTransmissivity() const noexcept;
224
231 float getAmbientTemperature() const noexcept;
232
233
244 OTC_SDK_API void setRadiationParameters(float emissivity, float transmissivity, float ambientTemperature);
245
246
252 float getMeanTemperature() const noexcept;
253
259 float getMinTemperature() const noexcept;
260
266 float getMaxTemperature() const noexcept;
267
275 void setTemperatures(float mean, float min, float max) noexcept;
276
277
285 TemperatureConverter getConverter() const noexcept;
286
287
293 MeasurementField clone() const noexcept;
294
304 OTC_SDK_API void setData(const unsigned short* source, int frameWidth, TemperaturePrecision precision);
305
312 OTC_SDK_API void setFromRawData(const void* source, TemperaturePrecision precision);
313
322 OTC_SDK_API void copyDataTo(unsigned short* destination, int size) const noexcept;
323
329 const unsigned short* getData() const noexcept;
330
331
332private:
334 int _id;
335
337 int _x;
339 int _y;
340
342 int _width;
344 int _height;
345
347 float _emissivity;
349 float _transmissivity;
351 float _ambientTemperature;
352
354 std::vector<unsigned short> _values;
355
357 float _meanTemperature;
359 float _minTemperature;
361 float _maxTemperature;
362
364 TemperatureConverter _converter;
365};
366
367
368// Inline implementations
369inline int MeasurementField::getId() const noexcept
370{
371 return _id;
372}
373
374inline void MeasurementField::setId(int id) noexcept
375{
376 _id = id;
377}
378
379inline float MeasurementField::getTemperature(int index) const noexcept(false)
380{
381 return _converter.toTemperature(getValue(index));
382}
383
384inline float MeasurementField::getTemperature(int x, int y) const noexcept(false)
385{
386 return _converter.toTemperature(getValue(x, y));
387}
388
389inline ConstMeasurementFieldIterator MeasurementField::getConstIterator() const noexcept
390{
391 return ConstMeasurementFieldIterator{*this};
392}
393
395{
396 return _converter.getPrecision();
397}
398
399inline int MeasurementField::getX() const noexcept
400{
401 return _x;
402}
403
404inline int MeasurementField::getY() const noexcept
405{
406 return _y;
407}
408
409inline void MeasurementField::setPosition(int x, int y) noexcept
410{
411 _x = x;
412 _y = y;
413}
414
415inline int MeasurementField::getWidth() const noexcept
416{
417 return _width;
418}
419
420inline int MeasurementField::getHeight() const noexcept
421{
422 return _height;
423}
424
425inline int MeasurementField::getSize() const noexcept
426{
427 return static_cast<int>(_values.size());
428}
429
430inline float MeasurementField::getEmissivity() const noexcept
431{
432 return _emissivity;
433}
434
435inline float MeasurementField::getTransmissivity() const noexcept
436{
437 return _transmissivity;
438}
439
440inline float MeasurementField::getAmbientTemperature() const noexcept
441{
442 return _ambientTemperature;
443}
444
445inline float MeasurementField::getMeanTemperature() const noexcept
446{
447 return _meanTemperature;
448}
449
450inline float MeasurementField::getMinTemperature() const noexcept
451{
452 return _minTemperature;
453}
454
455inline float MeasurementField::getMaxTemperature() const noexcept
456{
457 return _maxTemperature;
458}
459
460inline void MeasurementField::setTemperatures(float mean, float min, float max) noexcept
461{
462 _meanTemperature = mean;
463 _minTemperature = min;
464 _maxTemperature = max;
465}
466
468{
469 return _converter;
470}
471
473{
474 return MeasurementField{*this};
475}
476
477inline const unsigned short* MeasurementField::getData() const noexcept
478{
479 return _values.data();
480}
481
482} // namespace optris
Contains defines controlling the Windows DLL export and import of symbols.
#define OTC_SDK_API
Only needed when working with Windows DLLs.
Definition Api.h:65
Contains the exceptions raised by the SDK.
Contains a class realizing the iteration over measurement field data.
Contains a class that converts between temperatures in the internal SDK format and in °C.
OTC_SDK_API void setFromRawData(const void *source, TemperaturePrecision precision)
Sets the field data values from raw data.
float getTransmissivity() const noexcept
Returns the transmissivity of the field.
Definition MeasurementField.h:435
int getX() const noexcept
Returns the x-coordinate of the upper left corner.
Definition MeasurementField.h:399
const unsigned short * getData() const noexcept
Returns a pointer to the first element of the internal value array.
Definition MeasurementField.h:477
OTC_SDK_API void resize(int width, int height)
Resizes the measurement field.
int getY() const noexcept
Returns the y-coordinate of the upper left corner.
Definition MeasurementField.h:404
OTC_SDK_API void setRadiationParameters(float emissivity, float transmissivity, float ambientTemperature)
Sets the radiation parameters stored in the measurement field.
OTC_SDK_API unsigned short getValue(int index) const
Returns the field data value at the given index.
TemperatureConverter getConverter() const noexcept
Returns the temperature converter.
Definition MeasurementField.h:467
int getSize() const noexcept
Returns the overall size of the field (width * height).
Definition MeasurementField.h:425
TemperaturePrecision getTemperaturePrecision() const noexcept
Returns the precision of the temperatures stored in the measurement field.
Definition MeasurementField.h:394
int getWidth() const noexcept
Returns the width in pixels of the field.
Definition MeasurementField.h:415
OTC_SDK_API void copyDataTo(unsigned short *destination, int size) const noexcept
Copies the internal values to the destination array.
void setPosition(int x, int y) noexcept
Sets the position of the measurement field by providing the coordinates of the upper left corner.
Definition MeasurementField.h:409
float getEmissivity() const noexcept
Returns the emissivity of the field.
Definition MeasurementField.h:430
float getMinTemperature() const noexcept
Returns the minimum temperature in the field in °C.
Definition MeasurementField.h:450
float getMaxTemperature() const noexcept
Returns the maximum temperature in the field in °C.
Definition MeasurementField.h:455
OTC_SDK_API void setData(const unsigned short *source, int frameWidth, TemperaturePrecision precision)
Sets the thermal field data values.
int getId() const noexcept
Returns the id of the measurement field.
Definition MeasurementField.h:369
float getTemperature(int index) const
Returns the temperature in in °C at the given index.
Definition MeasurementField.h:379
int getHeight() const noexcept
Returns the height in pixels of the field.
Definition MeasurementField.h:420
ConstMeasurementFieldIterator getConstIterator() const noexcept
Returns an iterator with read access.
Definition MeasurementField.h:389
void setTemperatures(float mean, float min, float max) noexcept
Sets the mean, minimum and maximum temperatures in °C.
Definition MeasurementField.h:460
MeasurementField clone() const noexcept
Returns a complete copy of this frame.
Definition MeasurementField.h:472
float getAmbientTemperature() const noexcept
Returns the set ambient temperature in °C.
Definition MeasurementField.h:440
OTC_SDK_API MeasurementField() noexcept
Constructor.
void setId(int id) noexcept
Sets the id of the measurement field.
Definition MeasurementField.h:374
float getMeanTemperature() const noexcept
Returns the overall mean temperature of the field in °C.
Definition MeasurementField.h:445
Converts temperatures in °C to and from their internal SDK representation.
Definition TemperatureConverter.h:23
Main SDK namespace.
Definition DeviceInfo.h:23
static constexpr float INVALID_TEMPERATURE
All temperatures in °C equal or lower are invalid.
Definition TemperaturePrecision.h:21
TemperaturePrecision
Represents the available temperature precisions.
Definition TemperaturePrecision.h:29