ENVIFIDToRaster

This function returns a reference to an ENVIRaster object, when given an ENVI Classic file ID. Your code must invoke the ENVI application in order for ENVIFIDToRaster to be functional and recognized as a valid routine.

ENVIFIDToRaster only works with the supported raster data sources listed in OpenRaster. If the translation from an ENVI Classic file ID (FID) to an ENVIRaster object is not successful, the result returned by this function will be undefined, and an error message will be issued.

Note: If you use ENVIFIDToRaster 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 uses ENVI Classic to perform a decorrelation stretch and returns the associated ENVIRaster object for display in ENVI. Copy and paste the following code into the IDL command line.

; Launch ENVI

e = ENVI()

 

; Open the file and process it with ENVI_DOIT

file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $

SUBDIRECTORY = ['data'])

ENVI_OPEN_FILE, file, R_FID=fid

 

; 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

 

; Return an ENVIRaster from the output fid

raster = ENVIFIDToRaster(r_fid)

 

; Display the result

view = e.GetView()

layer = view.CreateLayer(raster, BANDS=[2, 1, 0])

Syntax

Result = ENVIFIDToRaster(FID [, ERROR=variable])

Arguments

FID

A file ID (integer) generated from an ENVI Classic routine.

Keywords

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

See Also

ENVIRaster, ENVIRasterToFID