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.


; Launch the application
e = ENVI()
; Open the input file
file = Filepath('qb_boulder_msi', ROOT_DIR=e.Root_Dir, $
raster = e.OpenRaster(file)
view = e.GetView()
layer = view.CreateLayer(raster)
; Define an ROI and add a polygon of seed pixels from the reservoir
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
; Display the ROI
roiLayer = layer.AddRoi(roi)
; Grow the region to the entire reservoir
bands = [2,1,0]
roi.GrowRegion, raster, bands, $
  MAX_SIZE=[1024,1024], $
  STDDEV_MULT=2.0, $


ENVIROI.GrowRegion, Raster, Bands [, Keywords=value]



The ENVIRaster references that contain the data used to spatially grow the given ROI.


A long array of 1 or 3 elements defining which bands of the ENVIRaster to use.



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.


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.


The number of iterations to perform to grow the region. The default is 1.


Set this keyword to a long array of 2 elements specifying the maximum size of the region grow. The default is 1024x1024.


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

ENVI 5.1


API Version


See Also