Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


Harris Geospatial / Docs Center / ENVI API / Processing / ClassificationClumping

ClassificationClumping

ENVIClassificationClumpingTask

This task performs a clumping method on a classification image. This operation clumps adjacent similar classified areas using morphological operators. Classified images often suffer from a lack of spatial coherency (speckle or holes in classified areas). Low pass filtering could be used to smooth these images, but the class information would be contaminated by adjacent class codes. Clumping classes solves this problem. The selected classes are clumped together by first performing a dilate operation then an erode operation on the classified image using one specified kernel (structuring element) for each operation.

Example


The following example performs an unsupervised classification, followed by a sieving, then clumping operation to remove the remaining black pixels.

; Start the application
e = ENVI()
 
; Open an input file
File = Filepath('qb_boulder_msi', Subdir=['data'], $
  Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Process a spatial subset
Subset = ENVISubsetRaster(Raster, Sub_Rect=[600,200,799,399])
 
; Create a classification ENVIRaster
; Get the task from the catalog of ENVITasks
Task = ENVITask('ISODATAClassification')
 
; Define inputs
Task.INPUT_RASTER = Subset
 
; Define outputs
Task.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
 
; Run the task
Task.Execute
 
; Get the collection of data objects currently available in the Data Manager
DataColl = e.Data
 
; Add the output to the Data Manager
DataColl.Add, Task.OUTPUT_RASTER
 
; Display the result
View1 = e.GetView()
Layer1 = View1.CreateLayer(Task.OUTPUT_RASTER)
 
; Get the task from the catalog of ENVITasks
SievingTask=ENVITask('ClassificationSieving')
 
; Define inputs
SievingTask.INPUT_RASTER = Task.OUTPUT_RASTER
 
; Run the sieving task
SievingTask.Execute
 
; Get the clumping task
ClumpingTask = ENVITask('ClassificationClumping')
 
; Define inputs
ClumpingTask.INPUT_RASTER = SievingTask.OUTPUT_RASTER
 
; Define outputs
ClumpingTask.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
 
; Run the task
ClumpingTask.Execute
 
; Add the output to the Data Manager
DataColl.Add, ClumpingTask.OUTPUT_RASTER
 
; Display the result
Layer2 = View1.CreateLayer(ClumpingTask.OUTPUT_RASTER)
 
; Flicker between the original classification and the result
; after clumping
Portal = View1.CreatePortal()
Portal.Animate, 2.0, /FLICKER

Syntax


Result = ENVITask('ClassificationClumping')

Input properties (Set, Get): CLASS_ORDER, DILATE_KERNEL, ERODE_KERNEL, IGNORE_VALIDATE, INPUT_RASTER, OUTPUT_RASTER_URI

Output properties (Get only): DESCRIPTION, NAME, 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


CLASS_ORDER (optional)

Specify the order of class names in which clumping is applied to the classification image. If you do not specify this property, the classes are processed from first to last.

DESCRIPTION

This property describes the task.

DILATE_KERNEL (required)

Specify a 2D array of zeros and ones that represents the structuring element (kernel) used for a dilate operation. If no kernel is specified, a 3 x 3 array will be used with a value of 1 for all of the array elements. Dilation is a morphological operation that uses a structuring element to expand the shapes contained in the input image.

ERODE_KERNEL (required)

Specify a 2D array of zeros and ones that represents the structuring element (kernel) used for a erode operation. If no kernel is specified, a 3 x 3 array will be used with a value of 1 for all of the array elements. Erosion is a morphological operation that uses a structuring element to reduce the shapes contained in the input image.

IGNORE_VALIDATE (optional)

This property is now deprecated and has no effect on task behavior. All task property values are validated when they are set, and they throw an error with bad input.

INPUT_RASTER (required)

Specify a raster on which to perform classification clumping.

NAME

This property contains the name of the task.

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 output raster. If you do not specify this property, the output raster is only temporary. Once the raster has no remaining references, ENVI deletes the temporary file.

Version History


ENVI 5.2, Service Pack 1

Introduced

API Version


3.1.0

See Also


ENVITask, ENVITask::Parameter, ENVISubsetRaster, ENVIISODATAClassificationTask, ENVIClassificationSmoothingTask, ENVIClassificationAggregationTask, ENVIClassificationSievingTask



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us