ExportColorSlices Task

This task exports raster color slices to a density slice range (DSR) file.

Example

; Start the application

e = ENVI()

 

; Open an AVIRIS hyperspectral image

File = FILEPATH('AVIRISReflectanceSubset.dat', $

  ROOT_DIR=e.ROOT_DIR, $

  SUBDIRECTORY=['data', 'hyperspectral'])

Raster = e.OpenRaster(File)

 

; Compute a Red Edge NDVI spectral index

SITask = ENVITask('SpectralIndex')

SITask.INPUT_RASTER = Raster

SITask.INDEX = 'Red Edge Normalized Difference Vegetation Index'

SITask.Execute

 

; Get the collection of data objects currently available in the Data Manager

DataColl = e.Data

DataColl.Add, SITask.OUTPUT_RASTER

 

; Get the export color slice task from the catalog of ENVITasks

Task = ENVITask('ExportColorSlices')

 

; Define inputs

Task.COLORS = $

  [[127,255,0], $

  [34,204,4], $

  [44,122,25], $

  [202,229,25],$

  [255,255,0], $

  [255,165,0], $

  [209,104,29], $

  [159,81,44]]

 

Task.RANGES = $

  [[0.6, 0.676519], $

  [0.55, 0.6], $

  [0.5, 0.55], $

  [0.45, 0.5], $

  [0.4, 0.45], $

  [0.35, 0.4], $

  [0.3, 0.35], $

  [0.2, 0.3]]

 

; Run the task

Task.Execute

 

; Create a classification raster from the raster color slice

ClassTask = ENVITask('ColorSliceClassification')

ClassTask.INPUT_RASTER = SITask.OUTPUT_RASTER

ClassTask.CLASS_COLORS = Task.COLORS

ClassTask.CLASS_RANGES = Task.RANGES

ClassTask.Execute

DataColl.Add, ClassTask.OUTPUT_RASTER

 

; Display the result

View = e.GetView()

Layer1 = View.CreateLayer(SITask.OUTPUT_RASTER)

Layer2 = View.CreateLayer(ClassTask.OUTPUT_RASTER)

Syntax

Result = ENVITask('ExportColorSlices')

Input properties (Set, Get): COLORS, OUTPUT_DSR_URI, RANGES

Output properties (Get only): None

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

Methods

This task inherits the following methods from ENVITask:

AddParameter

Execute

Parameter

ParameterNames

RemoveParameter

Properties

This task inherits the following properties from ENVITask:

COMMUTE_ON_DOWNSAMPLE

COMMUTE_ON_SUBSET

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

This task also contains the following properties:

COLORS (required)

Specify a (3 x n) byte array of RGB color triplets, where n is the number of ranges set in the RANGES property.

OUTPUT_DSR_URI (required)

Specify a string with the fully qualified path and filename for the exported DSR file.

RANGES (required)

Specify a (2 x n) double-precision array of color slice ranges, where n is the number of colors set in the COLORS property.

Version History

ENVI 5.3

Introduced

API Version

4.2

See Also

ENVITask, GetColorSlices Task, ColorSliceClassification Task