ImportEnviData

Declaration: ImportEnviData(FName, FExt: string; SpecType: TLayerType; MirrorY: boolean; var WLCalError: double; FeedBack: boolean): integer;
Imports a data file stored in the ENVI format. The parameter FName specifies the full file path of the ENVI header data. The parameter FExt specifies the file extension of the binary data part of an ENVI file. Setting it to '*' forces the function to search for data files having the extensions '.dat', '.img' or no extensions at all.

The parameter SpecType determines the type of expected spectra.1) It may assume one of the following values:

ctUndefined .... undefined/unknown property type
ctIRspec ....... IR spectrum
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)
ctRaman ........ Raman spectrum
ctUvVis ........ UV/VIS/NIR spectrum
ctColor ........ individual color
ctRGBcolors .... red green and blue from a color image (always three layers!)
ctBwImg ........ black and white image (gray scale 0..255 per pixel)
ctPixMask ...... pixel mask (deprecated!! masks are managed in an extra structure from version 1.0 upwards)
ctPhysProp ..... physical properties
ctTHzSpec ...... THz spectrum
ctImpulse ...... impulse over time
ctOESRaw ....... optical emission spectroscopy (single lines)
ctOESsl ........ optical emission spectroscopy (single lines)
ctEDX .......... energy dispersive xray (single lines)
ctEDXRaw ....... energy dispersive xray (raw spectra)
ctSIMS ......... SIMS lines
ctAFM .......... AFM layers
ctIRdiscrete ... discrete infrared lines
ctClassMap ..... classification results
ctChemMap ...... chemical map
ctSpecDesc ..... spectral descriptor
ctPhaseSpec .... phase spectrum
ctMagSpec ...... magnitude spectrum
ctPowerSpec .... power spectrum
ctLibsRaw ...... LIBS raw data (continuous spectrum)
ctLibssl ....... LIBS single line data
ctTime ......... time
ctInvalid ...... indicates an invalid layer type

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 ImportEnviData, otherwise the feedback will not be displayed. You can activate the script progress bar by calling the function ScriptBar(0).

The parameter MirrorY allows to mirror the image in y direction. The variable parameter WLCalError returns the standard deviation of the back-calibration (from wavelengths to layer indices). This error should be close to zero and can be used to detect any problems in the wavelength calibration (for example, if discontinuities in the wavelength table occur).

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 standard deviation of the backcalibration is greater than 0.05 (warning only)



1) The type of the spectra in an ENVI file is not fully specified in the ENVI header file. Epina ImageLab supports the proprietary keyword sensor type, which contains information of the spectral type. However, as this is a non-standard keyword, the information on the spectral type is overwritten by the value of SpecType when importing ENVI data.