The ENVI function launches the ENVI application and returns an object reference to the application.

Note: The ENVI interface and ENVI Classic interface should not be started within the same IDL session.

Example 1


Copy and paste the following code into the IDL command line:

; Launch the application
e = ENVI()
 
; Open a file
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
 
; Display the data
view = e.GetView()
layer = view.CreateLayer(raster)

Example 2


Copy and paste the following code into the IDL command line:

; Launch the application with two vertical views
e = ENVI(LAYOUT=[2,1])
 
; Open a file
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
 

Display the data in two views:

views = e.GetView(/ALL)
layer1 = views[0].CreateLayer(raster)
layer2 = views[1].CreateLayer(raster, /CIR)

Create a third view:

view3 = e.CreateView()

Switch back to one (empty) view:

e.LAYOUT=[1,1]

Syntax


Result = ENVI([, Keywords=value] [, Properties=value])

Methods


AddCustomReader

AddExtension

CleanupTemporaryWorkspace

Close

CreateView

GetBroadcastChannel

GetTemporaryFilename

GetView

HideExtensionFiles

LogMessage

OpenAnnotation

OpenPointCloud

OpenRaster

OpenROI

OpenVector

QueryPointCloud

Refresh

ReportError

RestoreSession

SaveSession

Show

Return Value


The ENVI function returns a reference to the ENVI application. Use the returned reference to manipulate the application after creation by changing properties or calling methods.

Properties


Properties marked as (Init) are applied only during the initial launch of the application. Properties marked as (Get) can be retrieved but not set. All other properties can be set during launch, or retrieved or changed after launch.

API_VERSION

This property retrieves a semantic version number for the ENVI API. This version number is also displayed in the Help > About dialog in the ENVI application. Semantic versioning provides a quick way to extract information about a new software release using a convention of X.Y.Z, where:

  • X represents the major version. An incremented value indicates that API additions and updates are not backward-compatible.
  • Y represents the minor version. An incremented value indicates that API additions and updates are backward-compatible.
  • Z represents the patch number. An incremented value indicates bug fixes that do not affect the API.

For example, suppose that your current ENVI API version is 3.1. If version 3.1.125 is available, you can tell that this version only contains bug fixes and you are safe to upgrade without breaking any API scripts. However, if version 4.0 becomes available, upgrading to the new version may break your API scripts because the new API is not backward-compatible.

Note: The API version number is the same value displayed in the schema key in ENVITask templates.

CURRENT

Set this keyword to test if the ENVI software is currently running and to retrieve a reference to the application. If this keyword is set and ENVI is not already running, the application will not be launched.

DATA (Get)

This property retrieves a reference to the ENVIDataCollection object, which is a collection of data objects currently available in the Data Manager.

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.

HEADLESS (Init)

Set this property to 1 to start the application without creating the user interface. The WIDGET_ID property is 0 when running ENVI in headless mode.

LANGUAGE (Init)

Note: Windows only

Set this property to a string specifying the name of the language to use for the user interface. This property affects components such as menus, buttons and messages. You can also specify the three-character ISO 639-3 language code (for example, jpn for Japanese).

The following example shows how to set the interface language to Japanese:

e = ENVI(LANGUAGE='jpn')

LAYOUT

Set this property to a two-element array specifying the layout of ENVIViews. The number of views is limited to 16. The options are as follows:

  • [1, 1]: One view (default)
  • [2, 1]: Two vertical views
  • [1, 2]: Two horizontal views
  • [3, 1]: Three vertical views
  • [1, 3]: Three horizontal views
  • [4,1]: Four vertical views
  • [1, 4]: Four horizontal views
  • [2, 2]: Four views, 2 x 2 layout
  • [3, 3]: Nine views, 3 x 3 layout
  • [4, 4]: Sixteen views, 4 x 4 layout

For other layout options (for example, three views) that were created using ENVI::CreateView, retrieving this property returns the scalar 0. If LAYOUT is set to an invalid value, it defaults to one view.

LOG_FILE

Set this property to a string specifying a full path and filename for a log file that will contain any warnings or errors issued during execution of ENVI routines. Set this property to a null string ('') to turn off error logging. To add custom messages to the default content, use the ENVI::LogMessage method.

Errors that occur through user interaction of ENVI (non-programmatically) are not written to this log file but are handled by the Enable System Logging preference.

See Manage Errors for more information on error handling in ENVI programming.

PREFERENCES (Init, Get)

This property retrieves the ENVIPreferences class associated with the ENVI application. At application start-up, set the PREFERENCES keyword to the URI of a JSON file in which ENVI will load and save preferences.

ROOT_DIR (Get)

A string specifying the ENVI installation path.

TASK_NAMES (Get)

A string array with the names of all available ENVITasks.

UI (Get)

This property retrieves a reference to the ENVIUI object.

UVALUE

Set this property to an IDL variable of any data type.

VERSION (Get)

This property retrieves the current ENVI version number. This version number is for marketing purposes and is different from the API version.

WIDGET_ID (Get)

The widget ID for the top-level base of the ENVI application. This widget ID may be used as both the group leader to IDL routines like WIDGET_BASE and the dialog parent to the IDL DIALOG_* routines. (See the DIALOG_PARENT keyword description in the DIALOG_MESSAGE function in IDL Help, for an example.) If ENVI is started without a user interface (using the HEADLESS property), the WIDGET_ID will be 0.

Version History


ENVI 5

Introduced

ENVI 5.0.3

Added TASK_NAMES property

ENVI 5.1

Added ExportROIs method

Added OpenROI method

Added RestoreSession method

Added SaveSession method

Deprecated ExportRaster method. See ENVIRaster::Export.

Deprecated CreateRaster method. See ENVIRaster.

Deprecated CreateRasterMetadata method. See ENVIRasterMetadata.

Deprecated ENVI::GetOpenData method. See ENVIDataCollection.

Deprecated ENVI::CreateRasterSpatialRef method. See ENVIPseudoRasterSpatialRef, ENVIRPCRasterSpatialRef, and ENVIStandardRasterSpatialRef.

ENVI 5.2

Deprecated ENVI::GetPreference method. See ENVIPreferences.

Added PREFERENCES property

ENVI 5.3

Added OpenPointCloud method

Added QueryPointCloud method

ENVI 5.4.1

Added API_VERSION property

ENVI 5.5.3

Added CleanupTemporaryWorkspace method

ENVI 5.6

Added [3,1], [1,3], [4,1], and [1,4] options to LAYOUT

ENVI 5.6.1

Added OpenAnnotation method

API Version


4.3

See Also


ENVIView, ENVIUI, ENVIRaster, ENVIVector, ENVIROI, ENVIAnnotationSet, ENVIPointCloud