The AddPixels method adds pixels to an ROI.

Example


For the following example:

  1. Copy and paste the procedure into an IDL editor window.
  2. Save the file as enviroi_addpixels_example.pro.
  3. Compile and run the procedure.
 
PRO enviroi_addpixels_example
compile_opt idl2
 
; Launch the application
e = ENVI()
 
; Create an ROI
file = FILEPATH('qb_boulder_pan', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
view = e.GetView()
layer = view.CreateLayer(raster)
roi1 = ENVIROI(NAME='Sun Reflectance', COLOR='Red')
 
; Iterate through the tiles of the data set
tileIterator = raster.CreateTileIterator()
FOREACH data, tileIterator DO BEGIN
ptr = WHERE(DATA GT 1000 AND data LT 1530, COUNT)
  IF (COUNT GT 0) THEN BEGIN
    x = (tileIterator.Current_Subrect)[0] + $
        (ptr mod (tileIterator.Tile_Size)[0])
    y = (tileIterator.Current_Subrect)[1] + $
        (ptr / (tileIterator.Tile_Size)[0])
    roi1.AddPixels, Transpose([[x],[y]]), spatialref=raster.spatialref
  ENDIF
ENDFOREACH
 
visRoi1 = layer.AddRoi(roi1)
 
END

Syntax


ENVIROI.AddPixels, Data [, Keywords=value]

Arguments


Data

A 2 x n array that defines the 2-D vertex data. This data is stored as a 64-bit long integer.

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.

SPATIALREF

Set the ENVIRaster reference that establishes the coordinate system reference for the pixel locations contained in the data. This keyword is not required; however, if it is not specified, ENVI will be unable to reproject the ROI pixels correctly.

Version History


ENVI 5.1

Introduced

API Version


4.2

See Also


ENVIROI, ENVIRasterLayer::AddROI, ENVI::OpenROI