This task creates a classification raster by thresholding on select data ranges and colors to highlight areas of a raster. The default behavior is to create 16 classes from distinct colors spread across the "Rainbow" color table.
Example
This example uses the default property settings:
e = ENVI()
File = Filepath('qb_boulder_msi', Subdir=['data'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
Task = ENVITask('ColorSliceClassification')
Task.INPUT_RASTER = Raster
Task.Execute
DataColl = e.Data
DataColl.Add, Task.OUTPUT_RASTER
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)
See More Examples.
Syntax
Result = ENVITask('ColorSliceClassification')
Input properties (Set, Get): CLASS_COLORS, CLASS_RANGES, COLOR_TABLE_NAME, DATA_MAXIMUM, DATA_MINIMUM, INPUT_RASTER, NUMBER_OF_RANGES, RANGE_SIZE, REVERSE_COLOR_TABLE, OUTPUT_RASTER_URI
Output properties (Get only): OUTPUT_RASTER
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:
CLASS_COLORS (optional)
Specify a (3,n) byte array with the RGB colors for the given ranges, where n is the number of classes:
CLASS_COLORS = [[255,0,0], [0,0,200], [0,200,0]]
Or, specify IDL color names:
CLASS_COLORS = [[!color.red], [!color.blue], [!color.green]]
Use this property in conjunction with CLASS_RANGES.
CLASS_NAMES (optional)
Specify an array with the names for the given ranges.
CLASS_RANGES (optional)
Specify a (2,n) array of color slice ranges, where n is the number of classes. In each array element, specify the minimum and maximum data value for the class.
COLOR_TABLE_NAME (optional)
Specify a string with the name of an IDL color table. The default value is Rainbow. Issue the following command to find valid strings:
LOADCT, get_name=color_table_names
DATA_MAXIMUM (optional)
Specify the maximum value used calculate data ranges with NUMBER_OF_RANGES. If this is not set, then the largest value in the INPUT_RASTER band is used.
DATA_MINIMUM (optional)
Specify the minimum value used to calculate data ranges with NUMBER_OF_RANGES or RANGE_SIZE. If this is not set, then the smallest value in the INPUT_RASTER band is used.
INPUT_RASTER (required)
Specify a 1-band raster on which to perform color slice classification.
NUMBER_OF_RANGES (optional)
Specify the number of data ranges to create. If RANGE_SIZE is specified, then the ranges are each that width, starting at DATA_MINIMUM and ending at (DATA_MINIMUM+NUMBER_OF_RANGES*RANGE_SIZE). If RANGE_SIZE is not specified, then the ranges are equal width between DATA_MINIMUM and DATA_MAXIMUM.
OUTPUT_RASTER
This is a reference to the output raster of filetype ENVI.
OUTPUT_RASTER_URI (optional)
Specify a string with the fully qualified filename and path of the associated OUTPUT_RASTER. If you do not specify this property, or set it to an exclamation symbol (!), a temporary file will be created.
RANGE_SIZE (optional)
Specify the width of each data range to create. The NUMBER_OF_RANGES is used in conjunction with RANGE_SIZE. Any data above DATA_MINIMUM+NUMBER_OF_RANGES*RANGE_SIZE will not be classified.
REVERSE_COLOR_TABLE (optional)
Set this property to reverse the color table. Use this property in conjunction with COLOR_TABLE_NAME property. The options are true or false.
More Examples
This example shows the use of CLASS_COLORS and CLASS_RANGES:
e = ENVI()
File = Filepath('qb_boulder_msi', Subdir=['data'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
Subset = ENVISubsetRaster(Raster, BANDS=0)
Class_Ranges = [[200,300],$
[300,400],$
[600,700], $
[700,800],$
[1000,1100]]
Class_Colors = [[255,0,0], $
[0,0,200], $
[0,200,0], $
[128,128,0], $
[0,128,128]]
Task = ENVITask('ColorSliceClassification')
Task.INPUT_RASTER = Subset
Task.CLASS_RANGES = Class_Ranges
Task.CLASS_COLORS = Class_Colors
Task.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
Task.Execute
DataColl = e.Data
DataColl.Add, Task.Output_Raster
View1 = e.GetView()
Layer1 = View1.CreateLayer(Task.Output_Raster)
The next example shows the use of DATA_MINIMUM, DATA_MAXIMUM, and NUMBER_OF_RANGES.
e = ENVI()
File = Filepath('qb_boulder_msi', Subdir=['data'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
Subset = ENVISubsetRaster(Raster, BANDS=3)
Task = ENVITask('ColorSliceClassification')
Task.INPUT_RASTER = Subset
Task.DATA_MINIMUM = 178
Task.DATA_MAXIMUM = 676
Task.NUMBER_OF_RANGES = 5
Task.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
Task.Execute
DataColl = e.Data
DataColl.Add, Task.Output_Raster
View1 = e.GetView()
Layer1 = View1.CreateLayer(Task.Output_Raster)
Version History
API Version
4.3
See Also
ENVITask, ENVISubsetRaster, ExportColorSlices Task, GetColorSlices Task