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:

  1. If a task has an associated style sheet, load that style sheet first.
  2. Apply default workflow behaviors; for example, hide the Display Result option until the final step; hide output parameters until the final step, etc.
  3. 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.

; This is the routine to invoke using the APPLY_STYLESHEET callback.
; That callback creates a style sheet and passes it as an argument 
; to this routine.
 
PRO apply_stylesheet_callback, styleSheet, _REF_EXTRA=refExtra
COMPILE_OPT IDL2
 
; Expose OUTPUT_RASTER_URI
ENVIWorkflowStep.StyleSheetShowParameters, styleSheet, 'OUTPUT_RASTER_URI'
 
; Hide CHANGE_THRESHOLD_PERCENT and ITERATIONS
ENVIWorkflowStep.StyleSheetHideParameters, styleSheet, ['CHANGE_THRESHOLD_PERCENT', 'ITERATIONS']
END
 
; ---------------------------------
 
; This is the workflow routine
 
PRO apply_stylesheet
COMPILE_OPT IDL2
 
; Run the application
e = ENVI()
 
; Create and customize a workflow
workflow = ENVIWorkflow()
workflow.TITLE = 'Classification Workflow'
workflow.DESCRIPTION = 'Goal: to segment an image into meaningful categories.'
 
; Add a step for ISODATA classification
step1 = ENVIWorkflowStep()
step1.TASK = ENVITask('ISODATAClassification')
step1.TIMELINE_TITLE = 'Classification'
 
; After the task runs, call the
; apply_stylesheet_callback routine
step1.CALLBACK_APPLY_STYLESHEET = 'apply_stylesheet_callback'
 
; Add a step for classification smoothing
step2 = ENVIWorkflowStep()
step2.TASK = ENVITask('ClassificationSmoothing')
step2.TIMELINE_TITLE = 'Smoothing'
 
; Add a step to convert the classification result
; to a vector shapefile
step3 = ENVIWorkflowStep()
step3.TASK = ENVITask('ClassificationToShapefile')
step3.TIMELINE_TITLE = 'Export'
 
; Connect outputs to inputs
workflow.Connect, step1, 'OUTPUT_RASTER', step2, 'INPUT_RASTER'
workflow.Connect, step2, 'OUTPUT_RASTER', step3, 'INPUT_RASTER'
 
; Run and display the workflow
envi.UI.CreateWorkflowDialog, workflow
END

Result:

See Also


Customize Workflows