This task performs the Spectral Information Divergence (SID) classification.
Example
This example performs the following steps:
-
Opens an AVIRIS hyperspectral image subset.
-
Runs a forward minimum noise transform (MNF) to reduce noise in the data.
-
Defines three regions of interest (ROIs), each containing nine pixels of a common material.
-
Retrieves the spectra from the ROIs and uses their means as targets for Spectral Information Divergence classification.
-
Runs the SID task, which performs spectral information divergence classification.
-
Displays the result. To see all of the bands, open the Data Manager.
e = ENVI()
File = Filepath('AVIRISReflectanceSubset.dat', $
SUBDIR=['data', 'hyperspectral'], $
ROOT_DIR=e.Root_Dir)
Raster = e.OpenRaster(File)
Task = ENVITask('ForwardMNFTransform')
Task.INPUT_RASTER = Raster
Task.Execute
Subset = ENVISubsetRaster(Task.OUTPUT_RASTER, BANDS=LINDGEN(15))
nSpectra = 9d
roi1 = ENVIROI(NAME='Green Field')
pixelAddr1 = [[77,182],[78,182],[79,182], $
[77,183],[78,183],[79,183], $
[77,184],[78,184],[79,184]]
roi1.AddPixels, pixelAddr1, SPATIALREF=Subset.SPATIALREF
roi2 = ENVIROI(NAME='Soil')
pixelAddr2 = [[386,285],[387,285],[388,285], $
[386,286],[387,286],[388,286], $
[386,287],[387,287],[388,287]]
roi2.AddPixels, pixelAddr2, SPATIALREF=Subset.SPATIALREF
roi3 = ENVIROI(NAME='Ground')
pixelAddr3 = [[296,326],[297,326],[298,326], $
[296,327],[297,327],[298,327], $
[296,328],[297,328],[298,328]]
roi3.AddPixels, pixelAddr3, SPATIALREF=Subset.SPATIALREF
spectra1 = Subset.GetData(ROI=roi1)
mean1 = Total(spectra1,1) / nSpectra
spectra2 = Subset.Getdata(ROI=roi2)
mean2 = Total(spectra2,1) / nSpectra
spectra3 = Subset.GetData(ROI=roi3)
mean3 = Total(spectra3,1) / nSpectra
means = [[mean1],[mean2],[mean3]]
Task = ENVITask('SpectralInformationDivergenceClassification')
Task.INPUT_RASTER = Subset
Task.MEAN = means
Task.Execute
dataColl = e.Data
dataColl.Add, Task.OUTPUT_RASTER
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)
Syntax
Result = ENVITask('SpectralInformationDivergenceClassification')
Input parameters (Set, Get): CLASS_COLORS, CLASS_NAMES, INPUT_RASTER, MEAN, OUTPUT_RASTER_URI, OUTPUT_RULE_RASTER_URI, THRESHOLD
Output parameters (Get only): OUTPUT_RASTER, OUTPUT_RULE_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
CLASS_COLORS (optional)
This is an array of [3, number of classes] for RGB triplets representing the class colors.
CLASS_NAMES (optional)
This is an array of [number of classes] for unclassified and class names.
INPUT_RASTER (required)
Specify an input raster to process.
MEAN (required)
Specify an array that is [number of bands, number of classes].
OUTPUT_RASTER_URI (optional)
Specify a string with the fully qualified filename and path to export the associated OUTPUT_RASTER.
- If you do not specify this parameter, the OUTPUT_RASTER will not be created.
- If you set this parameter to an asterisk symbol (*), the OUTPUT_RASTER will be virtual and not written to disk.
- To force the creation of a temporary file, set this parameter to an exclamation symbol (!).
- If you set it to the hash symbol (#), ENVI creates a file in the temporary directory, but this file will not be deleted when ENVI closes.
OUTPUT_RULE_RASTER_URI (optional)
Specify a string with the fully qualified filename and path of the associated OUTPUT_RULE_RASTER.
- If you do not specify this parameter, the OUTPUT_RULE_RASTER will not be created.
- To force the creation of a temporary file set the parameter to an exclamation symbol (!).
- If you set it to the hash symbol (#), ENVI creates a file in the temporary directory, but this file will not be deleted when ENVI closes.
THRESHOLD (required)
Specify a maximum value or array of maximum values (one for each class) for each class is tested against its corresponding maximum spectral divergence. The default value is 0.05.
Output Parameters
OUTPUT_RASTER
This is a reference to the output raster of filetype ENVI.
OUTPUT_RULE_RASTER
This is a reference to the output rule image of filetype ENVI.
This output will not be generated unless its associated URI input parameter is set.
Methods
Execute
Parameter
ParameterNames
Properties
DESCRIPTION
DISPLAY_NAME
NAME
REVISION
TAGS
Version History
See Also
ENVITask, Masking Support in ENVITasks