This routine has been replaced with the SelectInputData method to ENVIUI.

This function returns a compound widget used to specify image subsets, and it returns the base ID of the widget. An interactive ENVI Classic session is required to run this function.


Result = WIDGET_SUBSET(Base [, AUTO_MANAGE={0 | 1}], DIMS=array, FID=file ID [, /ROI], UVALUE=value [, XS=value])



This is the ID of the base widget.


AUTO_MANAGE (optional)

Use this keyword to specify how ENVI Classic auto-manages the widget with AUTO_WID_MNG. The keyword value specifies if the widget must have a defined value. Setting this keyword to a value of 1 requires that the widget has either a default value or a value that you enter. Setting this keyword to 0 does not require a value. Do not use this keyword for user-managed widgets.


The “dimensions” keyword is a five-element array of long integers that defines the spatial subset (of a file or array) to use for processing. Nearly every time you specify the keyword FID, you must also specify the spatial subset of the corresponding file (even if the entire file, with no spatial subsetting, is to be processed).

  • DIMS[0]: A pointer to an open ROI; use only in cases where ROIs define the spatial subset. Otherwise, set to -1L.
  • DIMS[1]: The starting sample number. The first x pixel is 0.
  • DIMS[2]: The ending sample number
  • DIMS[3]: The starting line number. The first y pixel is 0.
  • DIMS[4]: The ending line number

To process an entire file (with no spatial subsetting), define DIMS as shown in the following code example. This example assumes you have already opened a file using ENVI_SELECT or ENVI_PICKFILE:

  envi_file_query, fid, dims=dims


Use this keyword to specify the file ID of the file in use. The file ID is used to get the filename and the number of samples and lines.

ROI (optional)

Set this keyword to allow ROI subsetting of a file. The ROI ID is returned as the first element in the DIMS array.


Use this keyword to assign a “user value” to the widget. This value may be of any data type and organization. The user value exists entirely for your convenience. For widgets managed by the ENVI Classic function AUTO_WID_MNG, UVALUE is a tag name in the returned anonymous structure. For user-managed widgets, you can set and use UVALUE however you wish. You must set UVALUE for all compound widgets.

XS (optional)

Use this keyword to specify the x size in characters

Widget Event

When the widget is not auto-managed, widget events set event.result to the DIMS array.


Create a simple compound widget for selecting image subsets. Print out the new DIMS array.

compile_opt IDL2
envi_file_query, fid, dims=dims
	base = widget_auto_base(title='Subset test')
	ws = widget_subset(base, uvalue='subset', fid=fid, $
   dims=dims, /auto)
	result = auto_wid_mng(base)
	if (result.accept eq 0) then return
	print, 'New dims', result.subset

API Version