LoadEnviSpecLib

Declaration: LoadEnviSpecLib (FName: string; var EnviHeader: TEnviHeader; SpecType: TLayerType; var SpecData: TDouble2DArray; var ErrSpec, Errix: integer; FeedBack: boolean): integer;
Loads an ENVI spectral library into the two-dimensional array SpecData. The parameter FName specifies the full file path of the ENVI dataset. The spectral data is loaded into the rows of SpecData. The array SpecData is automatically resized to hold all spectra of the library. The variable parameter EnviHeader returns the header parameters of the library (including the wavelengts).

The parameter SpecType determines the type of the loaded spectra (the type of the spectra in an ENVI file is not fully specified in the standard ENVI header file, thus you have to specify it yourself; this will overrule the EnviHeader.SensorType parameter). It may assume one of the following values:

ctIRspec ....... IR spectrum
ctIRdiscrete ... discrete infrared lines
ctMSPos ........ MS positive spectrum (lines)
ctMSPosRaw ..... MS positive spectrum (continuous)
ctMSNeg ........ MS negative spectrum (lines)
ctMSNegRaw ..... MS negative spectrum (continuous)
ctMSsim ........ MS single ion monitoring (lines)
ctLibsRaw ...... LIBS raw data (continuous spectrum)
ctLibssl ....... LIBS single line data
ctRaman ........ Raman spectrum
ctEDX .......... energy dispersive xray (single lines)
ctEDXRaw ....... energy dispersive xray (raw spectra)
ctSIMS ......... SIMS lines
ctUvVis ........ UV/VIS/NIR spectrum
ctTHzSpec ...... THz spectrum
ctImpulse ...... impulse over time
ctOESRaw ....... optical emission spectroscopy (single lines)
ctOESsl ........ optical emission spectroscopy (single lines)
ctTime ......... time

The parameter Feedback controls whether a visual feedback is provided during the import of the data. Please note that unless the script progress bar is already visible you have to make it visible before calling LoadEnviSpecLib, 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, variable parameters are filled accordingly
-1 ... the file does not exist
-2 ... the file is not an ENVI header file
-3 ... the time stamp specification does not conform to the expected format
-4 ... unrecognized file type
-5 ... the size of the binary file does not match the header specifications
-6 ... the binary file contains an invalid number (NaN)
-7 ... the binary file contains an infinite number
-8 ... the binary file contains complex numbers
-9 ... the wave lengths data is not equidistant (warning only)