Each workflow step is based on a specific ENVITask. Tasks have a default set of parameters that are exposed and displayed throughout the workflow. You can control which parameters are exposed and hidden by creating a style sheet. These are described in more detail in the Style Sheets for User Interface Elements topic, although style sheets are not just meant for UI elements.
When you create custom tasks, you can create an accompanying style sheet, which is a separate file with a .style extension. The .style file resides in the same directory as the associated .task file. In the case of API workflows, however, you can use the CALLBACK_APPLY_STYLESHEET property in ENVIWorkflowStep to create an internal style sheet (formatted as a hash) that is passed to the appropriate callback routine. There, you can modify which parameters to expose or hide.
ENVI follows this sequence of steps when choosing which task parameters to expose or hide in a workflow:
- If a task has an associated style sheet, load that style sheet first.
- Apply default workflow behaviors; for example, hide the Display Result option until the final step; hide output parameters until the final step, etc.
- Invoke a custom CALLBACK_APPLY_STYLESHEET routine, if defined, where additional changes may take place.
The example below modifies the ISODATA classification task as follows:
- Exposes the Output Raster property. Because of the default workflow behavior, this property would normally be hidden.
- Hides the Change Threshold Percent and Iterations properties.
Copy and paste this code into the IDL Editor. Save the file as apply_stylesheet.pro. Then compile and run the program.
PRO apply_stylesheet_callback, styleSheet, _REF_EXTRA=refExtra
COMPILE_OPT IDL2
ENVIWorkflowStep.StyleSheetShowParameters, styleSheet, 'OUTPUT_RASTER_URI'
ENVIWorkflowStep.StyleSheetHideParameters, styleSheet, ['CHANGE_THRESHOLD_PERCENT', 'ITERATIONS']
END
PRO apply_stylesheet
COMPILE_OPT IDL2
e = ENVI()
workflow = ENVIWorkflow()
workflow.TITLE = 'Classification Workflow'
workflow.DESCRIPTION = 'Goal: to segment an image into meaningful categories.'
step1 = ENVIWorkflowStep()
step1.TASK = ENVITask('ISODATAClassification')
step1.TIMELINE_TITLE = 'Classification'
step1.CALLBACK_APPLY_STYLESHEET = 'apply_stylesheet_callback'
step2 = ENVIWorkflowStep()
step2.TASK = ENVITask('ClassificationSmoothing')
step2.TIMELINE_TITLE = 'Smoothing'
step3 = ENVIWorkflowStep()
step3.TASK = ENVITask('ClassificationToShapefile')
step3.TIMELINE_TITLE = 'Export'
workflow.Connect, step1, 'OUTPUT_RASTER', step2, 'INPUT_RASTER'
workflow.Connect, step2, 'OUTPUT_RASTER', step3, 'INPUT_RASTER'
envi.UI.CreateWorkflowDialog, workflow
END
Result:
See Also
Customize Workflows