This page describes file formats used to import or export from the Perception Studio program
Hyperspectral Data Cubes
Text File Format (*.hdt, *.rdt)
We provide a simple, text based, file format to make export from the Studio program and import from other sources easy. If your desired format is not supported by the system you may convert your data to the simple ".rcs" (rowcolumnspectra) text format.
The first entry (first line) denotes the version of the text file format. In the example below the text file format version is 1.
The next 3 entries (second line) denote the size of the cube as [number of frames, number of spectra per frame, spectra size] .
This is followed by the cube data where the cube is stored frame by frame and each frame is stored spectrum by spectrum. A newline character may be added after each spectrum to increase readability.
Example:
For a 2x3x4 Cube with 2 frames with each 3 spectra of length 4 the file would look like this. The first frame consists of 0 values and the second of 1 values.
1 2 3 4 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
Adding additional information in Perception Studio:
Additional information such as a description, spectra sets, ROI, wavelength coordinates and balancing images can not be stored within this format. To add this information one needs to load the file into the Perception Studio program, add it there and then save it as "hsd" file, which is the internal format for hyperspectral data.
 The description can be edited in the bottom left panel when the data set is selected.
 Spectra sets can be edited in the appropriate perspectives (Acquire, Explore, Model) by hitting the "Select Spectra" button in the ribbon bar at the top.
 The ROI can be edited in the appropriate perspectives (Acquire, Explore) or by setting numeric values in the bottom left panel when the dataset is selected.
 Balancing images, dark and white image can be added in the bottom left panel when the dataset is selected by clicking on the import buttons. The balancing images need to fit the number of spectra per frame and spectra size. When cubes with more than one frame are used, the mean of all frames is calculated.
 To add coordinate mappings go to the project browser on the left side, expand the dataset to unveil the coordinate system (NOTE: if the build number of the application is higher than 4808, then the coordinate system is at Data>Camera>CoordinateSystem) , then expand the coordinate system to make the 4 axes visible. Usually a wavelength mapping needs to be added. To do this, click the "Spectral Axis" and press the "Add Mapping" button in the bottom left panel. THEN expand the "Spectral Axis" to show the new mapping. Select the new mapping which should say "AxisMapping". Change the name and unit as desired and enter a polynomial for translation of indices. The polynomial needs to have the form c x x^2 x^3 ... x^n where c is the constant offset, x is the linear term, x^2 is the quadratic term and so on. Then also enter the sensor Indices vector. This vector has to be as long as the corresponding cube size, so for a spectral axis mapping, it needs to be as long as the spectral size of the cube (unprocessed). Then press "Update LUT" to calculate the lookup table from the sensor indices and polynomial.
Raw Text File (*.rdt)
Data saved with the ending *.rdt are describing sensor raw data. Therefore, sensor data processing (defect pixel correction, calibration, etc.) was not applied before exporting to file.
Text File (*.hdt)
Data saved with the ending *.hdt are describing preprocessed hyperspectral data as they where visualized in the Studio program before exporting. Therefore, sensor data processing (defect pixel correction, calibration, etc.) as well as hyperspectral preprocessing (derivative. normalization, etc.) was applied before exporting to file.
Matlab File Format (*.mat)
Hyperspectral cubes can be imported to as well as exported from Matlab.
Variable  Description 

C  C is a matrix of size SxWxT. S is the number of spatial points (spatial domain 1), W is the number of wavelength points (spectral domain), T is the number of samples along the time domain (e.g. spatial domain 2). The value range of C is within 0...2^nBits1 in case of sensor row data. nBits is the sensor dynamic in bits. In case of a reflectance measurement, the values in C are the reflectance values, where 1 is 100% and 0 is 0%. 
p  Is the wavelength calibration polynomial. Where wavelengths are calculated by: p(1)*w^N + p(2)*w^(N1) +...+ p(N)*w + p(N+1), N is the order of the polynomial. 
u  Is the unit specifier of the spectral domain. Where u='nm' specifies nanometers, u='um' micrometers, u='px' pixel and u='undef' if the unit of the spectral domain is not defined. 
Please see the following 2 use cases:
Case 1: Export a cube from the Perception Studio program and load it into Matlab
Export a cube in the format "HyperspectralDataModel Matlab Binary (*.mat)".
Download LoadHSData Matlab function from the Matlab Scripts page and save it in your Matlab user directory.
Import the cube by the following command:
[C,p,u] = LoadHSData;
Get Matlabs help on this function by the command:
help LoadHSData
Case 2: Export a cube from Matlab and import it into the Studio program
Download SaveHSData Matlab function from Matlab Scripts page and save it in your Matlab user directory.
Save a cube by the following command:
SaveHSData(C,p,u);
Get Matlabs help on this function by the command:
help SaveHSData
Open the Perception Studio program and import the generated file.
Example Data:
 See the Matlab Scripts page.
ENVI (*.hdr, etc.)
Data in "ENVI" format may be imported as well as exported from the Perception Studio program.
Export Options
Data format
 Processed: the data is exported as shown in Perception Studio program. This includes the correction of defect pixels, balancing and additional noise reduction. The spectral size will be reduced in comparison to the raw data (usually by 8). This is due to the noise reduction.
 Raw: camera raw data are exported. This is without balancing and further processing, just as provided by the camera.
Byte Order
Endian refers to the sequential order in which bytes are arranged into larger numerical values.
 Big Endian: Bigendian is the most common format in data networking; fields in the protocols of the Internet protocol suite, such as IPv4, IPv6, TCP, and UDP, are transmitted in bigendian order.
 Little Endian: Littleendian storage is popular for microprocessors, in part due to significant influence on microprocessor designs by Intel Corporation.
Interleave
Method of organizing image data for multiband images.
 BIP: band interleaved by pixel
 BIL: band interleaved by line
 BSQ: band sequential
Spectra Sets
Export in Text File Format (*.sst)
We provide a simple, text based, file format to make export from the Studio program easy. If your desired format is not supported by the system you may convert your data to the simple ".sst" (spectra set) text format.
The file contains various information separated by a new line character. The format exports only the spectra sets of a cube. Those spectra sets are exported fully processed (including derivative stage and normalization if applied).
The import of Spectra Sets described in a text file format is not supported by the Studio program at the moment.
Coordinate Mapping
A coordinate mapping specifies the mapping of spectral points to the coordinate system in which the data should appear.
A mapping consists of a name like Wavelength, a unit identifier like [nm] and a lookup table describing the mapping to the desired coordinates.
name: Wavelength
unit: [nm]
mapping: 1100 1102 1104 1106
The coordinate mapping "Wavelength" specifies that spectra listed in the file are beginning at 1100 nanometer, are resolved by 4 spectral points, and ending at 1106 nanometer.
In the file multiple mappings can be described that all stated spectra belong to, typical are: Wavelength, Wavenumber, Data Index, etc.
file version  A number specifying the version of the file. 
begin of spectral coordinates block  have to be the string spectral coordinates 
number of coord mappings  Number of coordinate mappings specified in the file. 
mapping #1 name  A string specifying the name of mapping #1 (like Data Index, Wavelength, Wavenumber,...) 
mapping #1 unit  A string specifying the unit. [px] for pixel, [nm] for nanometers, [um] for micrometers 
mapping #1 LUT  Lookup table used for mapping. Must be of the same length as the spectra. 
...  
mapping #M name  A string specifying the name of mapping #M 
mapping #M unit  Unit of mapping #M 
mapping #M LUT  Lookup table of mapping #M 
begin of spectra set block  Have to be the string selected spectra 
number of spectra  a number specifying the number of spectra (N) stated below 
spec set name of spectra #1  The name of the spectra set spectra #1 belongs to. 
values of spectra #1  The spectra. 
...  
spec set name of spectra #N  The name of the spectra set spectra #N belongs to. 
values of spectra #N  The spectra. 
Example
1 spectral coordinates 1 Wavelength [nm] 1100 1102 1104 1106 1108 1110 1112 1114 selected spectra 14 SpectraSet1 104.095 96.4762 81.9048 74.3333 73.619 75.2381 75.0476 72.9524 SpectraSet1 99.0952 92.4286 77.8571 71.5238 75.619 79.0952 79.9524 78.2857 SpectraSet1 92.1429 87.7143 78.7619 72.1905 72.6667 74 76 73.4762 SpectraSet1 105.095 97.3333 80.2381 73.381 76.4762 81.5238 83.3333 82.0476 SpectraSet2 188.571 185.571 176.286 170.333 173.333 169.667 160.048 152.905 SpectraSet2 173.238 170.667 165 161.19 161.095 158.857 149.048 144.524 SpectraSet2 180.905 177.81 171.286 165.571 167.381 165.19 159.19 155 SpectraSet2 173.619 172.143 166.857 163.048 163.857 163 154.333 150.429 SpectraSet3 64.4286 60.5714 53.0476 49.381 49.0476 50.2381 49.0952 47.7619 SpectraSet3 61.2857 58.2381 51.619 48.5714 49.0476 50.4286 49.1905 47.7143 SpectraSet3 60.4286 56.3333 49.6667 47.1905 46.381 48.5714 47.5238 47.2381 SpectraSet3 62.4286 58.5714 51.1429 47.3333 46.3333 47.7619 47.6667 47.2381 SpectraSet4 173.476 169.048 158.286 152.619 154.381 155.381 154.619 153.238 SpectraSet4 165.429 166.905 167.095 164.429 160.714 158.095 156 154.524
Matlab Import in Text File Format(*.sst)
Spectra sets can be imported to Matlab.
Variables  Description 

svSpecSet  Structure variable. In case multiple spectra sets are read, length of svSpecSet > 1.

svCoordMap  Structure variable. In case multiple coordinate mappings are read, length of svCoordMap > 1.

filename  If specified, the sst file referenced by filename is read. 
Export spectra sets from the Studio program and load it into Matlab
Export selected spectra sets from the Studio.
Download LoadSpectraSet function from the Matlab Scripts page and save it in your Matlab user directory.
Import the spectra sets by the following command:
[svSpecSet , svCoordMap]= LoadSpectraSet(strFilename)
Get Matlabs help on this function by the command:
help LoadSpectraSet
Visualize spectra sets in Matlab
[svSpecSet , svCoordMap]= LoadSpectraSet; figure; cvLegend={}; for i=1:length(svSpecSet) plot(svCoordMap(end).W,svSpecSet(i).I','color',getcolorfromindex(gca,i)); hold on; end xlabel(sprintf('%s [%s]',svCoordMap(end).name,svCoordMap(end).unit));
CCI Model
A CCI (Chemical Color Imaging) model contains 3 linear models to describe the red, the green and the blue value per spatial object pixel.
A linear model is specified by the equation:
y_ = b * x_ + b0
Where y_ is the predicted value of the mean centered spectra x_, b is an array of length x and b0 is a scalar. In addition scaling can be applied to the predicted values. When autoscaling is on, the Studio program scales the resulting image (prediction image) according to the user's selection in the program regardless of the scaling parameters k and d. In case autoscaling is off, the predictions (y_) are scaled according to the following equation:
y = k y_ + d
In case k=1 and d=0 and autoscaling is off, no scaling is applied to the predictions (therefore: y = b * x_ + b0).
Typically for chemometric modelling is to apply mean centering to the spectra. This is done by the following equation:
x_ = x  xMeanCenter
Where x_ is the "mean centered spectra", x is the input spectra and xMeanCenter is the "mean center spectra".
Studio Import/Export of a CCI Model in a Text File Format (*.FLTP)
In the following the XMLbased FLTPFormat of a CCI model file is described .
param name  param type  param value 

AutoScaling  bool  true in case the Studio program should do autoscaling on predicted data (not typical) false in case the predicted data sould remain in their originated value range. 
SubsamplingMode  int  must be 1 
Version  int  version of the XML file 
ScalingK_0  float  Scaling parameter k of linear model 0. 
ScalingK_1  float  Scaling parameter k of linear model 1. 
ScalingK_2  float  Scaling parameter k of linear model 2. 
LinearModelB0_0  float  b0 of linear model 0. 
LinearModelB0_1  float  b0 of linear model 1. 
LinearModelB0_2  float  b0 of linear model 2. 
ScalingD_0  float  Scaling parameter d of linear model 0. 
ScalingD_1  float  Scaling parameter d of linear model 1. 
ScalingD_2  float  Scaling parameter d of linear model 2. 
Format  string  Must be the string XML 
Name  string  A string specifying the name of the CCI model 
LinearModelB_0  float_field  b vector of linear model 0. 
LinearModelB_1  float_field  b vector of linear model 1. 
LinearModelB_2  float_field  b vector of linear model 2. 
MeanCenterSpectrum_0  float_field  Mean center spectra applied for linear model 0 
MeanCenterSpectrum_1  float_field  Mean center spectra applied for linear model 1 
MeanCenterSpectrum_2  float_field  Mean center spectra applied for linear model 2 
Example
<ModelAlgorithmApplyFilterPreset> <param name="AutoScaling" type="bool" value="true"/> <param name="SubsamplingMode" type="int" value="1"/> <param name="Version" type="int" value="1"/> <param name="ScalingK_0" type="float" value="0.523581"/> <param name="ScalingK_1" type="float" value="1.607"/> <param name="ScalingK_2" type="float" value="3.44363"/> <param name="LinearModelB0_0" type="float" value="0"/> <param name="LinearModelB0_1" type="float" value="0"/> <param name="LinearModelB0_2" type="float" value="0"/> <param name="ScalingD_0" type="float" value="153.135"/> <param name="ScalingD_1" type="float" value="120.707"/> <param name="ScalingD_2" type="float" value="129.448"/> <param name="Format" type="string" value="XML"/> <param name="Name" type="string" value="PCA_TEST"/> <param name="LinearModelB_0" type="float_field" value="0.347775 0.353302 0.356659 0.356629 0.361604 0.35727 0.349416 0.345469"/> <param name="LinearModelB_1" type="float_field" value="0.56126 0.4755 0.167228 0.06416 0.090672 0.180529 0.380986 0.490759"/> <param name="LinearModelB_2" type="float_field" value="0.427591 0.152734 0.410798 0.548997 0.289258 0.010953 0.329336 0.362538"/> <param name="MeanCenterSpectrum_0" type="float_field" value="148.259933 144.527786 135.710312 131.105164 132.472214 133.563492 131.787704 129.688492"/> <param name="MeanCenterSpectrum_1" type="float_field" value="148.259933 144.527786 135.710312 131.105164 132.472214 133.563492 131.787704 129.688492"/> <param name="MeanCenterSpectrum_2" type="float_field" value="148.259933 144.527786 135.710312 131.105164 132.472214 133.563492 131.787704 129.688492"/> </ModelAlgorithmApplyFilterPreset>
Matlab Import/Export of a CCI Model in a Text File Format (*.XML)
CCI Models can be imported to as well as exported from Matlab.
Variables  Description 

B  B is composed of 3 bvectors: B = [b_1; b_2; b_3]; 
B0  B0 is composed of 3 b0values: B0 = [b0_1, b0_2, b0_3]; 
K  K is composed of 3 kvalues: K = [k_1, k_2, k_3]; 
D  D is composed of 3 dvalues: D = [d_1, d_2, d_3]; 
XMeanCenter  XMeanCenter is composed of 3 meancenterspectra: XMeanCenter = [xMeanCenter_1; xMeanCenter_2; xMeanCenter_3]; 
name  name is a string specifying the name of the CCI model 
autoscale  autoscale is a Boolean variable specifying whether autoscaling should be applied or not (in the Studio program). 
Please see the following 2 use cases:
Case 1: Export a CCI model from the Studio program and load it into Matlab
Export a CCI model in the format "CCIModelAlgorithm XML (*.fltp)".
Download LoadCCIModel Matlab function from the Matlab Scripts page and save it in your Matlab user directory.
Import the CCI model by the following command:
[B,B0,K,D,XMeanCenter,name,autoscale]=LoadCCIModel(strFilename)
Get Matlabs help on this function by the command:
help LoadCCIModel
Case 2: Export a CCI model from Matlab and import it into the Studio program
Download SaveCCIModel Matlab function from the Matlab Scripts page and save it in your Matlab user directory.
Save a CCI model by the following command:
SaveCCIModel( filename , B , B0 , K , D , XMeanCenter , name , autoscale )
Get Matlabs help on this function by the command:
help SaveCCIModel
Open the Perception Studio program and import the generated file.
© 2019 by Perception Park GmbH
The content of this page and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact Perception Park and delete copied material. Perception Park GmbH, Wartingergasse 42, A8010 Graz; Austria; FN 400381x