OptrisOptrisDocumentation

Documentation/OTC SDK/OTC SDK — C++ API referencev12.0

optris::sdk::rec::CsvOptions

How a CSV snapshot spells its table, for a spreadsheet set to a locale other than English.

A default-constructed CsvOptions writes the file SaveCsv() has always written: degrees Celsius, , between values, . before the decimals, nan for a pixel that was not measured, and the # header lines. That is the form for programs, and it stays the default so that every existing reader keeps working. The header names its unit on a # Unit: degC line (# Unit: degF in Fahrenheit), which a reader that skips the # lines never sees.

A spreadsheet set to German, French or most other European locales splits on ; and reads , as the decimal separator, so it opens the default file as one text column per row with nothing in it a number. Ask for that spelling instead:

optris::sdk::rec::CsvOptions csv;
csv.delimiter = ';';
csv.decimal_separator = ',';
csv.leave_unmeasured_empty = true;
imager->Recorder().SaveCsvSnapshot("capture.csv", csv);

The same struct chooses the unit, for a person who reads degrees Fahrenheit, and it composes with the spelling:

optris::sdk::rec::CsvOptions csv;
csv.temperature_unit = optris::sdk::TemperatureUnit::kFahrenheit;
imager->Recorder().SaveCsvSnapshot("capture_f.csv", csv);

The output depends on these fields and on nothing else. The process locale (std::locale::global(), setlocale(), the Windows regional settings) never reaches the file, so the same options write the same bytes on every machine.

A separate struct rather than fields on SnapshotOptions because a 12.0 patch adds types and never changes the size of one that has shipped; and because none of this means anything to the other three formats.

Every field is spelled so that its default is what the SDK did before the struct existed.

Public attributes

delimiter

char delimiter = ','

What goes between two values on a row: , (the default), ; or a tab (\t'`). Anything else is refused with kInvalidParameter.

decimal_separator

char decimal_separator = '.'

What goes before the decimals: . (the default) or ,. Anything else is refused with kInvalidParameter, and so is a decimal separator equal to delimiter, because a reader could not tell 1,5 from two values.

It applies to every number in the file, the # header lines included, so one file never mixes the two spellings.

leave_unmeasured_empty

bool leave_unmeasured_empty = false

Write a pixel that was not measured as an empty field instead of nan. Every spreadsheet reads an empty field as a blank cell; it reads nan as text. Wide-correction frames always have such pixels at their edges.

omit_header_lines

bool omit_header_lines = false

Leave out the # header lines (model, serial, emissivity, the capture time and the rest), so the file is the table and nothing else. A spreadsheet shows each header line as a row of its own. The # Unit: line is one of them and goes too.

temperature_unit

TemperatureUnit temperature_unit = TemperatureUnit::kCelsius

The unit every temperature in the file is written in: the pixels and the ambient header line. Degrees Celsius by default.

In Fahrenheit each value is converted at full precision and then rounded once to the file's two decimals, half away from zero, as Temperatures::Format() rounds (so it is within 0.005 F of the Celsius value x 9/5 + 32); nan stays nan; the header carries # Unit: degF, and the ambient line is keyed AmbientTempF instead of AmbientTempC. A Celsius file says # Unit: degC. Emissivity and transmissivity are not temperatures and do not change. Any value other than the two units is refused with kInvalidParameter.