Stitches several datacubes into a single big mosaic, the fully qualified filenames of the individual data tiles have to be stored in the open array parameter FNames. The individual tiles can be either Epina ImageLab datacubes (file extension .ilab) or ENVI files (.hdr). In the case of ENVI files you have to define the file extension of the binary data part of ENVI files using the property EnviDataExt (including the leading dot, e.g. '.dat');
StitchCubes supports three different modes of stitching which differ in the information drawn from the layers of the source tiles. The parameter Mode can assume the following values:
||Use all available layers, the layer dimension of the resulting mosaic cube will be the same as the layer dimension of the tiles. Be careful when using this mode because it may create huge datacubes which potentially cannot be handled by your computer.
||Use only selected layers. For this mode the list of layers must be contained in the parameter LayersToExtract, which is an open integer array. The layers are specified by their index numbers (and not by their wavelengths), use the function WorldToIndex to convert wavelengths or masses to layer indexes.
||Use spectral descriptors. The list of spectral descriptors is defined in the file SpecDesc (fully qualified path). Please note that creating mosaics of spectral descriptors deprives you of further processing your data since the spectral information is lost.
Version  of the function (StitchCubes2) allows to override the spatial resolution of the imported ENVI files, which is necessary if the software of the microscope exports the wrong ENVI header. The parameters EnforcedSpatialX and EnforcedSpatialY control the spatial resolution (in pixel).
The information about the position and the resolution of the individual tiles is given by the parameter CubeList. This parameter is an open array of records whose size is the same as the size of the FNames array. Each record contains the following parameters:
||the x-position of the lower left corner of the corresponding tile (in pixels)
||the y-position of the lower left corner of the corresponding tile (in pixels)
||the width of the corresponding tile (in pixels)
||the height of the corresponding tile (in pixels)
||the x-position of the lower left corner of the corresponding tile (in world coordinates)
||the y-position of the lower left corner of the corresponding tile (in world coordinates)
||the width of the corresponding tile (in world coordinates)
||the height of the corresponding tile (in world coordinates)
The parameter MirrorY controls whether the y axis of each tile is mirrored or not.
During the execution of this command the script progress bar at the bottom right of the Epina ImageLab main window indicates the progress of the calculation. Please note that unless the script progress bar is already visible you have to make it visible before calling StitchCubes, otherwise the feedback will not be displayed. You can activate the script progress bar by calling the function ScriptBar(0).
The function resturns the following error codes:
0 ... everything is OK
-1 ... CubeList is empty
-2 ... not enough physical memory available
-3 ... x coordinates in CubeList are ambiguous
-4 ... y coordinates in CubeList are ambiguous
-5 ... specified envi file(s) do(es) not exist
-6 ... the number of data values in binary file does not match the specification in the header file
-7 ... the binary file contains an invalid number (NaN)
-8 ... the binary file contains an infinite number
-9 ... the binary file contains complex numbers
-10 ... the standard deviation of the backcalibration is greater than 0.1 (warning only)