ALTA  alpha
Data File Formats

ALTA usually takes as input material reflectance measurements. While ALTA plug-ins can support arbitrary file formats, ALTA has built-in support for two input file formats. The first one is a simple human-readable textual format, and the second one is a compact binary format. This section describes the actual data formats.

#DIM 1 1
#PARAM_IN  UNKNOWN
#PARAM_OUT UNKNOWN


Lines starting with # are considered comments, except for those lines that start with # immediately followed by a letter: these constitute the file header.

The header ends when either a non-comment line is read, or when the following line is encountered:

#ALTA END HEADER


The file header essentially defines key/value associations. For example, ALTA expects DIM key to be associated with a pair of integers representing the dimensions of the inputs; the value for PARAM_IN must be a string denoting a valid input parametrization, such as RUSIN_TH_TD_PD.

## Textual Data Format

For a text data file with n data entries where the input domain has N dimensions and a input_param parametrization and the output domain has P dimensions and a output_param parametrization, the textual file format is the following:

#DIM N P
#PARAM_IN  %input_param%
#PARAM_OUT %output_param%
#VS [0|1|2] (P times)
x_{1,1} ... x_{1,N}  y_{1,1} ... y_{1,P}
...
x_{i,1} ... x_{i,N}  y_{i,1} ... y_{i,P}
...
x_{n,1} ... x_{n,N}  y_{n,1} ... y_{n,P}


Vertical segments are not defined if VS is 0. For a VS of 1, each sample as a radius associated for the associated dimension. If VS is 2, each sample has a min and max segment value for the associated dimension.

## Binary Data Format

In addition to the default textual format described above, ALTA supports a compact binary format for representing raw data. The binary format starts with a similar header:

#DIM 1 1
#PARAM_IN  UNKNOWN_INPUT
#PARAM_OUT UNKNOWN_OUTPUT
#FORMAT binary
#VERSION 0
#PRECISION ieee754-double
#SAMPLE_COUNT 150
#ENDIAN little
#BEGIN_STREAM


After BEGIN_STREAM comes a byte sequence representing the actual data, store in row order. In this example, the byte sequence is an array of 151 little-endian IEEE-754 double precision numbers. The byte sequence is followed by END_STREAM on a line on its own.

The header represents a matrix of SAMPLE_COUNT rows and DIM_X + DIM_Y columns of double-precision floating point numbers.

This simple binary format was designed with two goals in mind: providing a compact way to store large input data, and allowing implementations to directly map the file in memory, as opposed to having to allocate storage and parse large sequences of numbers.