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.
e = ENVI()
file = FILEPATH('AVIRISReflectanceSubset.dat', $
ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data', 'hyperspectral'])
raster = e.OpenRaster(file)
SITask = ENVITask('SpectralIndex')
SITask.INPUT_RASTER = raster
SITask.INDEX = 'Red Edge Normalized Difference Vegetation Index'
SITask.Execute
DataColl = e.Data
DataColl.Add, SITask.OUTPUT_RASTER
DSRfile = FILEPATH('RENDVIColorSlice.dsr', $
ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data', 'hyperspectral'])
Task = ENVITask('GetColorSlices')
Task.INPUT_DSR_URI = DSRfile
Task.Execute
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
View = e.GetView()
Layer1 = View.CreateLayer(SITask.OUTPUT_RASTER)
Layer2 = View.CreateLayer(ClassTask.OUTPUT_RASTER)
Syntax
Result = ENVITask('GetColorSlices')
Input properties (Set, Get): INPUT_DSR_URI
Output properties (Get only): COLORS, RANGES
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
An array with the RGB colors for the given ranges.
INPUT_DSR_URI (required)
Specify a string with the fully qualified path and filename for the density slice range file (.dsr).
RANGES
An array of color slice ranges.
Version History
API Version
4.3
See Also
ENVITask, ExportColorSlices Task, ColorSliceClassification Task