Thermal Camera SDK 10.1.0
SDK for Optris Thermal Cameras
Loading...
Searching...
No Matches
MeasurementField.h
Go to the documentation of this file.
1// Copyright (c) 2008-2025 Optris GmbH & Co. KG
2
10
11#pragma once
12
13#include <string>
14#include <vector>
15
16#include "otcsdk/Api.h"
17#include "otcsdk/Exceptions.h"
21
22
23namespace optris
24{
25
33{
34 // Special iterator access.
35 friend class ConstMeasurementFieldIterator;
36
37
38public:
41
48 OTC_SDK_API MeasurementField(const MeasurementFieldConfig& config, long long fieldId) noexcept;
49
50
54 OTC_SDK_API MeasurementField& operator=(const MeasurementField& rhs) = default;
55
59 OTC_SDK_API MeasurementField& operator=(MeasurementField&& rhs) noexcept = default;
60
63
64
70 const MeasurementFieldConfig& getConfig() const noexcept;
71
77 long long getId() const noexcept;
78
84 int getIndex() const noexcept;
85
91 void setIndex(int index) noexcept;
92
98 const std::string& getName() const noexcept;
99
105 void setName(const std::string& name) noexcept;
106
116 OTC_SDK_API unsigned short getValue(int index) const;
117
127 float getTemperature(int index) const;
128
139 OTC_SDK_API unsigned short getValue(int x, int y) const;
140
151 float getTemperature(int x, int y) const noexcept(false);
152
153
161 ConstMeasurementFieldIterator getConstIterator() const noexcept;
162
169
175 int getX() const noexcept;
176
182 int getY() const noexcept;
183
191 void setPosition(int x, int y) noexcept;
192
198 FieldShape getShape() const noexcept;
199
205 FieldMode getMode() const noexcept;
206
212 void setMode(FieldMode mode) noexcept;
213
219 int getWidth() const noexcept;
220
226 int getHeight() const noexcept;
227
233 int getSize() const noexcept;
234
241 OTC_SDK_API void resize(int width, int height);
242
243
249 float getEmissivity() const noexcept;
250
256 float getTransmissivity() const noexcept;
257
264 float getAmbientTemperature() const noexcept;
265
266
277 OTC_SDK_API void setRadiationParameters(float emissivity, float transmissivity, float ambientTemperature);
278
279
285 float getMeanTemperature() const noexcept;
286
292 float getMinTemperature() const noexcept;
293
299 float getMaxTemperature() const noexcept;
300
306 OTC_SDK_API float getDataPoint() const noexcept;
307
315 void setTemperatures(float mean, float min, float max) noexcept;
316
317
325 TemperatureConverter getConverter() const noexcept;
326
327
333 MeasurementField clone() const noexcept;
334
344 OTC_SDK_API void setData(const unsigned short* source, int frameWidth, TemperaturePrecision precision);
345
352 OTC_SDK_API void setFromRawData(const void* source, TemperaturePrecision precision);
353
362 OTC_SDK_API void copyTemperaturesTo(float* destination, int size) const noexcept;
363
372 OTC_SDK_API void copyDataTo(unsigned short* destination, int size) const noexcept;
373
379 const unsigned short* getData() const noexcept;
380
381
382private:
385
387 long long _id;
389 int _index;
390
392 std::vector<unsigned short> _values;
393
395 float _meanTemperature;
397 float _minTemperature;
399 float _maxTemperature;
400
402 TemperatureConverter _converter;
403};
404
405
406// Inline implementations
407inline const MeasurementFieldConfig& MeasurementField::getConfig() const noexcept
408{
409 return _config;
410}
411
412inline long long MeasurementField::getId() const noexcept
413{
414 return _id;
415}
416
417inline int MeasurementField::getIndex() const noexcept
418{
419 return _index;
420}
421
422inline void MeasurementField::setIndex(int index) noexcept
423{
424 _index = index;
425}
426
427inline const std::string& MeasurementField::getName() const noexcept
428{
429 return _config.name;
430}
431
432inline void MeasurementField::setName(const std::string& name) noexcept
433{
434 _config.name = name;
435}
436
437inline float MeasurementField::getTemperature(int index) const noexcept(false)
438{
439 return _converter.toTemperature(getValue(index));
440}
441
442inline float MeasurementField::getTemperature(int x, int y) const noexcept(false)
443{
444 return _converter.toTemperature(getValue(x, y));
445}
446
447inline ConstMeasurementFieldIterator MeasurementField::getConstIterator() const noexcept
448{
449 return ConstMeasurementFieldIterator{*this};
450}
451
453{
454 return _converter.getPrecision();
455}
456
457inline int MeasurementField::getX() const noexcept
458{
459 return _config.positionX;
460}
461
462inline int MeasurementField::getY() const noexcept
463{
464 return _config.positionY;
465}
466
467inline void MeasurementField::setPosition(int x, int y) noexcept
468{
469 _config.positionX = x;
470 _config.positionY = y;
471}
472
474{
475 return _config.shape;
476}
477
479{
480 return _config.mode;
481}
482
483inline void MeasurementField::setMode(FieldMode mode) noexcept
484{
485 _config.mode = mode;
486}
487
488inline int MeasurementField::getWidth() const noexcept
489{
490 return _config.width;
491}
492
493inline int MeasurementField::getHeight() const noexcept
494{
495 return _config.height;
496}
497
498inline int MeasurementField::getSize() const noexcept
499{
500 return static_cast<int>(_values.size());
501}
502
503inline float MeasurementField::getEmissivity() const noexcept
504{
505 return _config.emissivity;
506}
507
508inline float MeasurementField::getTransmissivity() const noexcept
509{
510 return _config.transmissivity;
511}
512
513inline float MeasurementField::getAmbientTemperature() const noexcept
514{
515 return _config.ambientTemperature;
516}
517
518inline float MeasurementField::getMeanTemperature() const noexcept
519{
520 return _meanTemperature;
521}
522
523inline float MeasurementField::getMinTemperature() const noexcept
524{
525 return _minTemperature;
526}
527
528inline float MeasurementField::getMaxTemperature() const noexcept
529{
530 return _maxTemperature;
531}
532
533inline void MeasurementField::setTemperatures(float mean, float min, float max) noexcept
534{
535 _meanTemperature = mean;
536 _minTemperature = min;
537 _maxTemperature = max;
538}
539
541{
542 return _converter;
543}
544
546{
547 return MeasurementField{*this};
548}
549
550inline const unsigned short* MeasurementField::getData() const noexcept
551{
552 return _values.data();
553}
554
555} // 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 encapsulating the configuration of a measurement field.
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.
Encapsulates the configuration of a measurement field.
Definition MeasurementFieldConfig.h:26
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:508
int getX() const noexcept
Returns the x-coordinate of the upper left corner.
Definition MeasurementField.h:457
const unsigned short * getData() const noexcept
Returns a pointer to the first element of the internal value array.
Definition MeasurementField.h:550
OTC_SDK_API void resize(int width, int height)
Resizes the measurement field.
int getIndex() const noexcept
Returns the index of the measurement field.
Definition MeasurementField.h:417
int getY() const noexcept
Returns the y-coordinate of the upper left corner.
Definition MeasurementField.h:462
OTC_SDK_API void setRadiationParameters(float emissivity, float transmissivity, float ambientTemperature)
Sets the radiation parameters stored in the measurement field.
OTC_SDK_API void copyTemperaturesTo(float *destination, int size) const noexcept
Copies the thermal data as degree Celsius to a one-dimensional array or vector.
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:540
void setName(const std::string &name) noexcept
Sets the name of the measurement field.
Definition MeasurementField.h:432
FieldShape getShape() const noexcept
Returns the shape of the measurement field.
Definition MeasurementField.h:473
int getSize() const noexcept
Returns the overall size of the field (width * height).
Definition MeasurementField.h:498
TemperaturePrecision getTemperaturePrecision() const noexcept
Returns the precision of the temperatures stored in the measurement field.
Definition MeasurementField.h:452
int getWidth() const noexcept
Returns the width in pixels of the field.
Definition MeasurementField.h:488
FieldMode getMode() const noexcept
Returns the mode for the measurement field.
Definition MeasurementField.h:478
OTC_SDK_API float getDataPoint() const noexcept
Returns the data point specified by the the mode of this field.
const std::string & getName() const noexcept
Returns the name of the measurement field.
Definition MeasurementField.h:427
OTC_SDK_API void copyDataTo(unsigned short *destination, int size) const noexcept
Copies the internal values to a one-dimensional array or vector.
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:467
float getEmissivity() const noexcept
Returns the emissivity of the field.
Definition MeasurementField.h:503
float getMinTemperature() const noexcept
Returns the minimum temperature in the field in °C.
Definition MeasurementField.h:523
float getMaxTemperature() const noexcept
Returns the maximum temperature in the field in °C.
Definition MeasurementField.h:528
OTC_SDK_API void setData(const unsigned short *source, int frameWidth, TemperaturePrecision precision)
Sets the thermal field data values.
float getTemperature(int index) const
Returns the temperature in in °C at the given index.
Definition MeasurementField.h:437
void setIndex(int index) noexcept
Sets the index of the measurement field.
Definition MeasurementField.h:422
int getHeight() const noexcept
Returns the height in pixels of the field.
Definition MeasurementField.h:493
ConstMeasurementFieldIterator getConstIterator() const noexcept
Returns an iterator with read access.
Definition MeasurementField.h:447
void setTemperatures(float mean, float min, float max) noexcept
Sets the mean, minimum and maximum temperatures in °C.
Definition MeasurementField.h:533
MeasurementField clone() const noexcept
Returns a complete copy of this frame.
Definition MeasurementField.h:545
float getAmbientTemperature() const noexcept
Returns the set ambient temperature in °C.
Definition MeasurementField.h:513
void setMode(FieldMode mode) noexcept
Sets the mode for the measurement field.
Definition MeasurementField.h:483
OTC_SDK_API MeasurementField() noexcept
Constructor.
long long getId() const noexcept
Returns the ID uniquely identifying the measurement field.
Definition MeasurementField.h:412
float getMeanTemperature() const noexcept
Returns the overall mean temperature of the field in °C.
Definition MeasurementField.h:518
const MeasurementFieldConfig & getConfig() const noexcept
Returns the configuration of the measurement field.
Definition MeasurementField.h:407
Converts temperatures in °C to and from their internal SDK representation.
Definition TemperatureConverter.h:23
Main SDK namespace.
Definition DeviceInfo.h:23
FieldShape
Represents the different available shapes of fields.
Definition FieldProperties.h:24
FieldMode
Represents the different field modes that define what data point is calculated.
Definition FieldProperties.h:30
TemperaturePrecision
Represents the available temperature precisions.
Definition TemperaturePrecision.h:32