To organize a model when it contains many elements, you can create a metatask that encloses multiple Task nodes. A metatask is a task that contains other tasks. It contains JSON code that combines multiple tasks, similar to ENVITask templates. See Metatasks in ENVI API Programming for more information.
You can generate a metatask and save it to a .task file on disk, or publish it so that it becomes available for use with other ENVITasks. Use the Code > Generate Metatask option in the ENVI Modeler menu bar. See Generate and Run Code From Models for details.
The Create Task from Model option collapses multiple nodes into a single node. For example, here is a typical Image Registration workflow that consists of three Task nodes:
By using Create Task from Model, the model is collapsed into a single element as follows:
The metatask that will be created from this model will ignore the Data Manager and View Nodes. The input rasters defined by the File nodes will become static inputs to the nodes used in the model. The Define Metatask Inputs and Outputs section below provides some guidance for managing inputs and outputs.
Follow these steps to create a metatask from a model:
- Display a model.
- Select Edit > Create Task from Model from the ENVI Modeler menu bar, or click the Create Task from Model button in the toolbar. The model elements are collapsed into a single box, in a new "Untitled" tab.
- Click the Rename button and enter a name for the task.
To expand the task to see its contents, click the button. The nodes and connectors that comprise the model are displayed in a new tab, with the exception of Comment nodes.
Note: This feature does not support metatasks that contain iterators or aggregators.
Define Metatask Inputs and Outputs
Before creating a task using the Code > Generate Metatask or Edit > Create Task from Model menu option, you should define input and output parameters for the model.
Add an Input Parameters node to the beginning. This will allow anyone who runs the model to choose inputs through an Input Parameters dialog.
Next, add an Output Parameters node to a model from which you will generate a metatask. Why is this important? Suppose that you want to create a metatask from the following model:
If you select Code > Generate Metatask and click the Run button from the Metatask dialog, no output is displayed or saved to an output file. Similarly, if you click the Create Task from Model button, a new Task node is created without any way to specify output; it does not have an arrow on its right side.
Adding an Output Parameters node to the end of the model ensures that model users can access the output. It also lets you connect the outputs of a metatask to other nodes.
See Specify Model Output for directions on how to specify output file locations.
Tip: The Output Parameters node can also be used in a metatask to present the numeric results of a model, insteaed of creating an output file.
See Also
ENVI Modeler Example: Image Registration Metatask, Generate Metatasks, Specify Input Datasets and Task Parameters, Specify Model Output