This example shows how perform classification smoothing (using the ClassificationSmoothing task) and automatically apply it to the classification result without requiring a separate step. Use the CALLBACK_POST_EXECUTE property to invoke the smoothing task after the ISODATA classification task.
Copy and paste this code into the IDL Editor. Save the file as example_postexecute.pro. Then compile and run the program.
PRO example_postexecute_postexecute, workflow, _REF_EXTRA=refExtra
COMPILE_OPT IDL2
task = ENVITask('ClassificationSmoothing')
task.INPUT_RASTER = workflow.CURRENT_STEP.task.OUTPUT_RASTER
task.KERNEL_SIZE = 25
task.Execute
workflow.CURRENT_STEP.task.OUTPUT_RASTER = task.OUTPUT_RASTER
view = envi.GetView()
!null = view.CreateLayer(task.INPUT_RASTER)
!null = view.CreateLayer(task.OUTPUT_RASTER)
END
PRO example_postexecute
COMPILE_OPT IDL2
e = ENVI()
workflow = ENVIWorkflow()
workflow.TITLE = 'Classification Workflow'
workflow.DESCRIPTION = 'In this example, smoothing happens invisibly between steps.'
step1 = ENVIWorkflowStep()
step1.TASK = ENVITask('ISODATAClassification')
step1.TIMELINE_TITLE = 'Classification'
step1.CALLBACK_POSTEXECUTE = 'example_postexecute_postexecute'
step2 = ENVIWorkflowStep()
step2.TASK = ENVITask('ClassificationToShapefile')
step2.TIMELINE_TITLE = 'Vectorize'
workflow.Connect, step1, 'OUTPUT_RASTER', step2, 'INPUT_RASTER'
envi.UI.CreateWorkflowDialog, workflow
END
Result:
See Also
Customize Workflows