BuildBandStack Task

This task builds a band-stacked raster (also called a metaspectral raster), which is a stack of ENVIRasters with the same dimensions. A common use is to include bands from different rasters.

This task is different than the LayerStack task, where the input rasters can have different numbers of rows and columns.

The virtual raster associated with this task is ENVIMetaspectralRaster.

Example

This example creates one raster that consists of Band 2 from a 1985 Landsat TM image and Band 2 from a 2005 TM image. Both images have the same number of rows and columns; they are also in the same coordinate system and have the same pixel size (30 m).

The example uses sample images that are available from our ENVI Tutorials web page. Click the Landsat Case Studies link to download the .zip file to your machine, then unzip the files. The files you will use in this example are located in the TimeSeries folder of the download. Update the file references in the example with the correct locations.

; Start the application

e = ENVI()

 

; Select a Landsat TM scene from 1985

File1 = 'LasVegasMay1985.dat'

Raster1 = e.OpenRaster(File1)

 

; Select a Landsat TM scene from 2005

File2 = 'LasVegasMay2005.dat'

Raster2 = e.OpenRaster(File2)

 

; Get the red band (3) from the 1985 scene.

; Bands are zero-based.

RedRaster1 = ENVISubsetRaster(Raster1, BANDS=2)

 

; Get the red band (3) from the 2005 scene.

RedRaster2 = ENVISubsetRaster(Raster2, BANDS=2)

 

; Get the task from the catalog of ENVITasks

Task = ENVITask('BuildBandStack')

 

; Define inputs

Task.INPUT_RASTERS = [RedRaster1, RedRaster2]

 

; Run the task

Task.Execute

 

; Add the output to the Data Manager

e.Data.Add, Task.OUTPUT_RASTER

 

; Display the result

View = e.GetView()

Layer1 = View.CreateLayer(Task.OUTPUT_RASTER)

Layer2 = View.CreateLayer(Task.OUTPUT_RASTER, BANDS=[1])

View.Zoom, /FULL_EXTENT

View.Animate, 2.0, /FLICKER

Syntax

Result = ENVITask('BuildBandStack')

Input parameters (Set, Get): INPUT_RASTERS, ORDER_BANDS_BY_WAVELENGTH, OUTPUT_RASTER_URI, SPATIAL_REFERENCE

Output parameters (Get only): OUTPUT_RASTER

Parameters marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Parameters marked as "Get" are those whose values you can retrieve but not set.

Input Parameters

INPUT_RASTERS (required)

Specify an array of ENVIRasters from which to build a band-stacked raster.

ORDER_BANDS_BY_WAVELENGTH (optional)

Set if bands should be ordered by increasing wavelength value. This parameter is ignored if the rasters do not have wavelength metadata.

OUTPUT_RASTER_URI (optional)

Specify a string with the fully qualified filename and path to export the associated OUTPUT_RASTER.

SPATIAL_REFERENCE (optional)

Set this parameter to an ENVIStandardRasterSpatialRef, ENVIPseudoRasterSpatialRef, or ENVIRPCRasterSpatialRef object to be used by OUTPUT_RASTER. If this is not specified, then the first valid SPATIALREF parameter found in the INPUT_RASTERS array will be used.

Output Parameters

OUTPUT_RASTER

This is a reference to the output raster of filetype ENVI.

Methods

Execute

Parameter

ParameterNames

Properties

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

Version History

ENVI 5.2

Introduced

ENVI 5.5

OUTPUT_RASTER_URI now supports '*', which allows OUTPUT_RASTER to be virtual output.

ENVI 6.1

Added ORDER_BANDS_BY_WAVELENGTH parameter

See Also

ENVITask, ENVIMetaspectralRaster, RegridRaster Task, ENVISubsetRaster, Masking Support in ENVITasks