GetColorSlices Task

This task retrieves data ranges and colors from a density slice range file (.dsr). Density slices are used to group pixel values into discrete ranges, each with a different color. Overlaying a density slice on an associated image is helpful for visualizing image processing results. Density slices can also be used as input into color slice classification.

Example

This example creates a Red Edge NDVI spectral index image from an AVIRIS hyperspectral scene. It creates a density slice, where the healthiest vegetation is colored bright green. It then creates a classification raster from the density slice.

; 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

 

; Open a density slice range (DSR) file

DSRfile = FILEPATH('RENDVIColorSlice.dsr', $

  ROOT_DIR=e.ROOT_DIR, $

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

 

; Get the density slice task from the catalog of ENVITasks

Task = ENVITask('GetColorSlices')

 

; Define inputs

Task.INPUT_DSR_URI = DSRfile

 

; Run the task

Task.Execute

 

; Create a classification raster based on the density 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('GetColorSlices')

Input parameters (Set, Get): INPUT_DSR_URI

Output parameters (Get only): COLORS, RANGES

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_DSR_URI (required)

Specify a string with the fully qualified path and filename for the density slice range file (.dsr).

Output Parameters

COLORS

An array with the RGB colors for the given ranges.

RANGES

An array of color slice ranges.

Methods

Execute

Parameter

ParameterNames

Properties

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

Version History

ENVI 5.3

Introduced

See Also

ENVITask, ExportColorSlices Task, ColorSliceClassification Task