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.
PRO final_report_page_step3_stylesheet, styleSheet, _REF_EXTRA=refExtra
COMPILE_OPT IDL2
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
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
END
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
PRO final_report_page
COMPILE_OPT IDL2
e = ENVI()
workflow = ENVIWorkflow()
step1 = ENVIWorkflowStep()
step1.TASK = ENVITask('IsodataClassification')
step1.NAME = '1'
step1.TIMELINE_TITLE = 'Classification'
step1.CALLBACK_POSTEXECUTE = 'final_report_page_step1_postexecute'
step2 = ENVIWorkflowStep()
step2.TASK = ENVITask('ClassificationSmoothing')
step2.NAME = '2'
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
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