This example shows how to create a report in the final step of a workflow. The report lists all of the steps and parameters that were used.

Copy and paste this code into the IDL Editor. Save the file as final_report_page.pro. Then compile and run the program.

; This is a callback routine that modifies the task style
; sheet in Step 3
 
PRO final_report_page_step3_stylesheet, styleSheet, _REF_EXTRA=refExtra
COMPILE_OPT IDL2
 
; This setting removes the parameter titles from the left part of the dialog
styleSheet['show_titles'] = 0
IF (~styleSheet.HasKey('parameters')) THEN BEGIN
  styleSheet["parameters"] = List()
ENDIF
 
style = Hash()
style['name'] = 'final_report'
style['type'] = 'IDLMultiString_UI'
style['keywords'] = Hash()
style['keywords', 'editable'] = 0
style['keywords', 'xSize'] = 40
style['keywords', 'ySize'] = 13
styleSheet['parameters'].Add, style
END
 
;------------------------------------------------------------------------------
; This is a callback routine that builds the final report
PRO final_report_page_step3_PreBuildUI, workflow, _REF_EXTRA=refExtra
COMPILE_OPT IDL2
 
step1 = workflow.GetStep('1')
step2 = workflow.GetStep('2')
value = List()
value.Add, 'Workflow Report'
value.Add, ''
 
raster = workflow.DATA_CONTAINER  .GetScalar('step_1_raster')
value.Add, 'Input Raster: ' + raster.NAME
value.Add, 'Number of Classes: ' + step1.TASK.NUMBER_OF_CLASSES.ToString()
value.Add, 'Number of Classes: ' + step1.TASK.NUMBER_OF_CLASSES.ToString()
value.Add, 'Iterations: ' + step1.TASK.ITERATIONS.ToString()
value.Add, ''
value.Add, 'Kernel Size: ' + step2.TASK.KERNEL_SIZE.ToString()
value.Add, ''
value.Add, 'Result location: ' + step2.TASK.OUTPUT_RASTER_URI
workflow.CURRENT_STEP.TASK.FINAL_REPORT = value.ToArray()
END
 
;------------------------------------------------------------------------------
PRO final_report_page_step3_execute, _REF_EXTRA=refExtra
COMPILE_OPT IDL2
 
; Do nothing. The UI shows the final report.
END
;------------------------------------------------------------------------------
; This is a callack routine that stores the final report for later use
PRO final_report_page_step1_postexecute, workflow, _REF_EXTRA=refExtra
COMPILE_OPT IDL2
 
workflow.DATA_CONTAINER.AddScalar, 'step_1_raster', workflow.CURRENT_STEP.TASK.INPUT_RASTER
END
;------------------------------------------------------------------------------
; This is the workflow routine
PRO final_report_page
COMPILE_OPT IDL2
 
; Start the application
e = ENVI()
 
; Create and customize the workflow
workflow = ENVIWorkflow()
 
; Add a step for ISODATA classification
step1 = ENVIWorkflowStep()
step1.TASK = ENVITask('IsodataClassification')
step1.NAME = '1'
step1.TIMELINE_TITLE = 'Classification'
step1.CALLBACK_POSTEXECUTE = 'final_report_page_step1_postexecute'
 
; Add a step for classification smoothing
step2 = ENVIWorkflowStep()
step2.TASK = ENVITask('ClassificationSmoothing')
step2.NAME = '2'
 
; Add a step that displays the final report
step3 = ENVIWorkflowStep()
step3.TITLE = 'Final Report'
step3.SUBTITLE = 'Summary of parameter values used.'
step3.TASK.AddParameter, ENVIParameterENVIRaster($
  NAME='input_raster', $
  DISPLAY_NAME='Input Raster', $
  DIRECTION='input', $
  HIDDEN=1)
step3.TASK.AddParameter, IDLParameterStringArray($
  NAME='final_report', $
  DISPLAY_NAME='Final Report', $
  DIMENSIONS='[*]', $
  DIRECTION='input')
step3.CALLBACK_APPLY_STYLESHEET = 'final_report_page_step3_stylesheet'
step3.CALLBACK_PREBUILDUI = 'final_report_page_step3_PreBuildUI'
step3.CALLBACK_EXECUTE = 'final_report_page_step3_execute'
step3.SHOW_DISPLAY_RESULT = 0
 
; Connect the workflow steps
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