ENVIUI::SelectInputData
The SelectInputData function method displays a dialog in which the user selects files for rasters or vectors.
Example
; Launch the application
e = ENVI()
; Create an ENVIRaster
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
; Get the UI object
UI = e.UI
; Choose a raster from the dialog box
raster = UI.SelectInputData(/RASTER)
; Now display the chosen raster.
view = e.GetView()
layer = view.CreateLayer(raster)
Syntax
Result = ENVIUI.SelectInputData([, Keywords=value])
Return Value
This method normally returns an ENVIRaster or ENVIVector. If the dialog is closed before a file is selected, or if Cancel is clicked, !NULL is returned.
Arguments
None
Keywords
Keywords are applied only during the initial creation of the object.
ALLOW_MULTIPLE
Set this keyword to allow multiple selection in the data-selection dialog. When this keyword is set, SelectInputData can return an array of data objects.
APPLY_SUBSET
Set this keyword to return a subsetted ENVIRaster from the extents and bands specified by the end user. This keyword cannot be used with the ALLOW_MULTIPLE keyword.
BANDS
Set this keyword to a named variable that will contain the spectral subset information chosen in the dialog.
DIALOG_PARENT
Set this keyword to the widget ID of a widget to be used as the parent of this dialog. When this ID is specified, the closing of the caller dialog results in the closing of the SelectInputData dialog.
DISABLE_BANDS
Set this keyword to disable the dialog option of choosing bands (all bands are used). All bands in the selected raster are returned by the BANDS keyword.
Note: This keyword is not applicable to vectors. If you select a vector file in the dialog, the dialog option of choosing bands will be disabled, and the keyword will be ignored.
DISABLE_NO_DATA
Set this keyword to disable the dialog option of setting a no data value, and to ignore the NO_DATA keyword.
Note: This keyword is not applicable to vectors. If you select a vector file in the dialog, the dialog option of setting a no data value will be disabled, and the keyword will be ignored.
DISABLE_MASK
Set this keyword to disable the dialog option of choosing a mask.
Note: This keyword is not applicable to vectors. If you select a vector file in the dialog, the option to choose bands will be disabled, and this keyword will be ignored.
DISABLE_SUB_RECT
Set this keyword to disable the dialog option of setting a spatial subset. The selected raster's full extent is returned by the SUB_RECT keyword.
Note: This keyword is not applicable to vectors. If you select a vector file in the dialog, the dialog option of setting a spatial subset will be disabled, and the keyword will be ignored.
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.
NO_DATA
Set this keyword to a named variable that will contain the no data value chosen in the dialog.
RASTER
Set this keyword to specify that the dialog should only display raster files that are supported by ENVI.
SUB_RECT
Set this keyword to a named variable that will contain the spatial subset information chosen in the dialog.
TITLE
Set this keyword to a string with a custom title bar for the dialog. The default title is Select Input Data
.
VECTOR
Set this keyword to specify that the dialog should only display vector files that are supported by ENVI.
Note: The RASTER and VECTOR keywords may not both be set. If neither is set, the dialog displays all files with ENVI-supported formats.
Version History
ENVI 5 |
Introduced |
ENVI 5.3 |
Added APPLY_SUBSET and DISABLE_MASK keywords |
API Version
4.2