The GetExtent function method returns the pixel coordinates boundary of the ROI for a given ENVIRaster.
Example
e = ENVI()
file = Filepath('qb_boulder_msi', ROOT_DIR=e.Root_Dir, $
SUBDIRECTORY=['data'])
raster = e.OpenRaster(file)
roi = EnviRoi(NAME='Tennis Court', COLOR='Green')
data = [[480872.7214d, 4428333.0664d], $
[480908.2576d, 4428333.0664d], $
[480907.5742d, 4428265.4108d], $
[480873.3289d, 4428265.7720d], $
[480872.7214d, 4428333.0664d]]
roi.AddGeometry, data, $
coord_sys=raster.SpatialRef.Coord_Sys_Str, /POLYGON
extent = roi.GetExtent(raster)
PRINT, 'ROI extent = ', extent
subset = ENVISubsetRaster(raster, SUB_RECT=extent, $
BANDS=Indgen(raster.nbands))
view = e.GetView()
layer1 = view.CreateLayer(raster)
layer2 = view.CreateLayer(subset)
layer3 = layer2.AddRoi(roi)
layer3.transparency = 60
Syntax
Result = ENVIROI.GetExtent (Raster [, Keywords=value])
Return Value
Returns the pixel extent coordinates. The result will be a one-dimensional array in the following order: [xMin, yMin, xMax, yMax]. If there are no pixels found in the raster that matches the ROI definition then !NULL is returned.
Arguments
Raster
The ENVIRaster that establishes the coordinate system reference of the ROI pixel boundary.
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
API Version
4.3
See Also
ENVIROI, ENVIROI::PixelAddresses