The PixelAddresses function method returns a list of the pixel locations that comprise the ROI for the given ENVIRaster.

Example


; Launch the application
e = ENVI()
 
; Open the input file
file = Filepath('qb_boulder_msi', ROOT_DIR=e.Root_Dir, $
  SUBDIRECTORY=['data'])
raster = e.OpenRaster(file)
 
; Define a new ROI with a polygon.
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
 
; Print the full list of addresses of this polygon
PRINT, 'addresses = '
PRINT, roi.PixelAddresses(raster)
 
; Print the run length encoded addresses of this polygon
PRINT, 'RLE addresses = '
PRINT, roi.PixelAddresses(raster, /RLE)

Syntax


Result = ENVIROI.PixelAddresses(Raster [, Keywords=value])

Return Value


Returns the pixel address. If the RLE keyword is not set, the result will be a 2xn 64-bit long array of pixel locations. If RLE is set, then the result will be a one-dimensional 64-bit long array of start locations and run lengths.

Arguments


Raster

The ENVIRaster reference that establishes the coordinate system reference of the ROI pixel locations.

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.

RLE

Set this keyword to a non-zero value to return the result as a run-length encoded list of one-dimensional addresses into the data, stored in a one-dimensional unsigned long array. When the result is run-length encoded, each element with an even subscript contains the length of the run, and the following element contains the starting index of the run.

Version History


ENVI 5.1

Introduced

API Version


4.2

See Also


ENVIROI, ENVIRaster, ENVIROI::PixelCount