The ExportROIs method will output the pixel locations for a given ENVIROI with an ENVIRaster to an ENVI Classic .roi file, a Comma Separated Value .csv file, or an ESRI Shapefile .shp. Shapefile output can be stored as points or geometry.

To save an ENVIROI to its native .xml format, use ENVIROI::Save.

Example


; Launch the application
e = ENVI()
 
; open qb_boulder_msi
file = Filepath('qb_boulder_msi', ROOT_DIR=e.Root_Dir, $
  SUBDIRECTORY=['data'])
raster = e.OpenRaster(file)
 
; open ROIs from qb_boulder_roi.xml
file = Filepath('qb_boulder_roi.xml', ROOT_DIR=e.Root_Dir, $
  SUBDIRECTORY=['data'])
rois = e.OpenRoi(file)
 
; export ROIs to shapefile as geometry
raster.ExportRois, e.GetTemporaryFilename('shp'), rois, 'SHAPEFILE'
 
; export ROIs to shapefile as points
raster.ExportRois, e.GetTemporaryFilename('shp'), rois, 'SHAPEFILE POINTS'
 
; export ROIs to classic .roi file
raster.ExportRois, e.GetTemporaryFilename('roi'), rois, 'CLASSIC'
 
; export ROIs to comma separated values text file
raster.ExportRois, e.GetTemporaryFilename('csv'), rois, 'CSV'

Syntax


ENVIRaster.ExportROIs, OutputFilename, ROI, Format [, ERROR=value]

Arguments


OutputFilename

The name of the output file to write.

  • If the Format is CLASSIC, the filename extension must be .roi.
  • If the Format is CSV, the filename extension must be .csv or .txt.
  • If the Format is SHAPEFILE or SHAPEFILE POINTS, the filename extension must be .shp.

ROIs

An array of one or more ENVIROI objects used as the ROIs to export.

Format

A scalar string denoting the format in which the ROI(s) will be saved. An error will be thrown if the format is unrecognized or unsupported. The valid string values are:

Format Strings

Notes

'classic'

Export the input ROIs to an ENVI Classic file (.roi).

'csv'

Export the input ROIs to a Comma Separated Value file (.csv or .txtgina).

'shapefile'

Export the input ROIs to polygon shapefile file (.shp).

'shapefile points'

Export the input ROIs to multipoint shapefile file (.shp).

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.1

Introduced

API Version


4.2

See Also


ENVIROI, ENVIRaster, ENVIROI::Save