LoadEnviDataToMemory

Declaration: LoadEnviDataToMemory (FName, FExt: string; SpecType: TLayerType; var Data: TDouble3DArray; MetaData: TMetaData; var PixMask: TInt2DArray; MirrorY: boolean; var WLCalError: double; FeedBack: boolean): integer;
The function LoadEnviDataToMemory loads a dataset stored in the ENVI format into memory. 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 (the type of spectra in an ENVI file is not fully specified in the ENVI header file, thus you have to specify it yourself). 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 variable parameter Data is the array which contains the binary data after importing it, the parameter MetaData contains the meta data and the variable parameter PixMask contains the pixelmask of the data.

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 LoadEnviDataToMemory, 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 be should 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 back-calibration is greater than 0.05 (warning only)