Declaration: SaveEnvi (FName: string; llx, lly, urx, ury, TimeSlot, Group, MaskIx: integer; ILeave: TEnviInterLeave; Endian: TEndian; FeedBack: boolean): integer;
Saves all spectra of the spectral group GroupNr in the area specified by the parameters llx, lly, urx and ury and the time slot TimeSlot in ENVI format. The parameter MaskIx determines the pixel mask of pixel not to be exported. Setting MaskIx to zero exports all pixels in the specified spatial range. As the ENVI format cannot store irregular image matrices, all masked pixels are replaced by the "indefinite value" substitute (which can be set in the preferences of Epina ImageLab). The parameter ILeave determines the order of data values in the ENVI data file. The Endian parameter controls the byte order of the binary data (use edWindows, if you are not sure)

The filename of the exported data file is given by FName. The parameter FName has to contain the full path specification of the Epina ImageLab file. If the filename does not contain any path the file will be stored in the current working directory of Epina ImageLab.

If the parameter Feedback is TRUE a visual feedback of the progress is provided. Please note that unless the script progress bar is already visible you have to make it visible before calling SaveEnvi, otherwise the feedback will not be displayed. You can activate the script progress bar by calling the function ScriptBar(0).

The function returns the following error codes:

 0 ... everything is OK
-1 ... file cannot be generated (readonly or full disk)
-2 ... invalid group number
-3 ... content type is not supported
-4 ... spatial range (llx, lly, urx, ury) is out of range
-5 ... invalid time slot (TimeSlot
-6 ... invalid mask index MaskIx (must be between 0 and 32)


Hint: Setting both borders of a particular dimension is a shortcut for specifying the entire range of this dimension. For example, the statement
   SaveENVI ('mydatafile', 0, 1, 0, 10, 1, 1, 0, ilBIP, edWindows, true);
is equivalent to
   SaveENVI ('mydatafile', 1, 1, GetCubSize(dimX), 10, 1, 1, 0, ilBIP, edWindows, true);.