The Pixelate method converts any geometry or threshold definitions of an ROI into rasterized pixels of the given ENVIRaster.
Example
e = ENVI()
file = Filepath('qb_boulder_msi', ROOT_DIR=e.Root_Dir, $
SUBDIRECTORY=['data'])
raster = e.OpenRaster(file)
view = e.GetView()
layer = view.CreateLayer(raster)
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
roi.Pixelate, raster
addr = roi.PixelAddresses(raster)
nPts = N_Elements(addr) / 2
roi.ClearPixels, spatialref=raster.SpatialRef
roi.AddPixels, addr[*,0:nPts-1:2], spatialref=raster.SpatialRef
roiLayer = layer.AddRoi(roi)
Syntax
ENVIROI.Pixelate, Raster [, ERROR=variable]
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.
Version History
API Version
4.3
See Also
ENVIROI, ENVIRaster