The GrowRegion method takes the existing seed locations of an ENVIROI and spatially grows those pixels to surrounding pixels that meet a set of statistical criteria for the given ENVIRaster image. The threshold is determined by specifying a number of standard deviations away from the mean of the seed region. You can use either 4 or 8 neighboring pixels to determine the growth pattern.
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='Reservoir', COLOR='Dark Blue')
data = [[482414.8d, 4427824.8d], $
[482372.8d, 4427696.0d], $
[482596.8d, 4427682.0d], $
[482596.8d, 4427682.0d], $
[482414.8d, 4427824.8d]]
roi.AddGeometry, data, coord_sys=raster.SpatialRef.Coord_Sys_Str, /POLYGON
roiLayer = layer.AddRoi(roi)
bands = [2,1,0]
roi.GrowRegion, raster, bands, $
MAX_SIZE=[1024,1024], $
STDDEV_MULT=2.0, $
ITERATIONS=2, $
/EIGHT_NEIGHBORS
Syntax
ENVIROI.GrowRegion, Raster, Bands [, Keywords=value]
Arguments
Raster
The ENVIRaster references that contain the data used to spatially grow the given ROI.
Bands
A long array of 1 or 3 elements defining which bands of the ENVIRaster to use.
Keywords
EIGHT_NEIGHBORS
Set this keyword to 0 and the four immediate neighboring pixels will be considered. If this keyword is not set, the eight neighboring pixels will be considered.
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.
ITERATIONS
The number of iterations to perform to grow the region. The default is 1.
MAX_SIZE
Set this keyword to a long array of 2 elements specifying the maximum size of the region grow. The default is 1024x1024.
STDDEV_MULT
The standard deviation multiplier used to determine which neighboring pixels are statistically close enough to the mean of the “seed” pixels. The default is 2.0.
Version History
API Version
4.3
See Also
ENVIROI, ENVIRaster