Declaration: ExtendLayers (NewNLayers, Group: integer; Data: TMat4D; MetaData: TMetaData): integer;
The function ExtendLayers increases a hyperspectral data cube by adding additional layers. The parameter NewNLayers specifies the intended number of layers belonging to the spectral group defined by the Group parameter. The parameter Data contains the four-dimensional raw data and the parameter MetaData contains the corresponding meta data.

If the data cube contains only one spectral group and the specified group number matches the group number of this group the calibration data of the spectra are copied to the new layers (which in effect results in an extension of the existing spectra). If the specified group number does not match the existing spectral group or there is more than one group the new layers are initialized by the default calibration.

The function returns the following error codes:

 0 ... everything is OK
-1 ... the parameter NewNRows is less or equal to the current number of rows
-2 ... the new data cube exceeds the amount of available physical memory
-3 ... the size parameters of the meta data do not match the data cube
-4 ... group number is already used (warning only if there is more than one group in the dataset)
-5 ... invalid group number

Last Update: 2019-Jul-05