ENVIRasterToFID
For a given ENVIRaster object, this function returns a file ID (FID) for use with ENVI Classic programming routines. Your code must invoke the ENVI application in order for ENVIRasterToFID to be functional and recognized as a valid routine.
ENVIRasterToFID accepts data formats listed in ENVI::OpenRaster. If the translation from an ENVIRaster object to an ENVI Classic file ID (FID) is not successful, the result returned by this function will be undefined, and an error message will be issued.
Note: If you use ENVIRasterToFID inside a full user routine (with PRO/END statements), be sure to include the command COMPILE_OPT, STRICTARR
after the PRO statement.
Example
This example returns a file ID (FID) from a 4-band multispectral image and passes it to ENVI Classic to perform a decorrelation stretch. It saves the result to the system's temporary directory.
; Launch the application
e = ENVI()
; Create an ENVIRaster
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
; Return a file ID
fid = ENVIRasterToFID(raster)
; Use ENVI_FILE_QUERY to get required details
; about the raster before running DECOR_DOIT
ENVI_FILE_QUERY, fid, DIMS=dims
t_fid = [fid, fid, fid, fid]
pos = [0, 1, 2, 3]
; Determine an output file
out_file = e.GetTemporaryFilename()
; Run a decorrelation stretch on the raster
ENVI_DOIT, 'DECOR_DOIT', FID=t_fid, POS=pos, $
DIMS=dims, OUT_NAME=out_file, R_FID=r_fid
Syntax
Result = ENVIRasterToFID(ENVIRaster) [, ERROR=variable]
Arguments
Raster
An ENVIRaster object
Keywords
Keywords are applied only during the initial creation of the object.
ERROR
Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''
). If an error occurs and the routine is a function, then the function result will be undefined.
When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.
See Manage Errors for more information on error handling in ENVI programming.
Version History
ENVI 5 |
Introduced |
API Version
4.2