Create workflow: Range

From ILWIS
Jump to: navigation, search
Main Page Arrow.png Operations Arrow.png Create objects Arrow.png Create workflow Arrow.png
NDVI Condition Range
Range example

In this example, a simple workflow is designed and constructed for creating a raster map of multi layers/bands having a stack domain. The input raster image for this example can be a hyperspectral image in e.g.,GeoTiFF or JPEG format or an ILWIS3 map list. The goal is to demonstrate how to use a junction box (for I in range of) in a workflow which allow you to select number of layers/bands from a multispectral image using specific index. In this example, the workflow task is to compare each layer/band position of the input raster map with the given value range (index). If the input layer/band position index is equal to the specified range, then the input layer/band will be added to the new raster map. If index of the input raster layer/band is not found in the given range, it will not be added to the new raster map. The range or loop operation will continue until all the layers/bands of the input map is checked. The output result(the new constructed raster coverage) of the range operation can be saved and used in the workflow as an input for a certain operation as well. Note, since the output of saveas operation will be saved on dick and due to the fact that each operation in workflow is limited to one output therefore the saveas box can not be connected to any other box as it is shown in Figure 2.

Figure 1, a condition box used within workflow.

To construct aforementioned workflow, we used number of operations namely: connect, serviceobject, createrastercoverage, rasterband, addrasterband, saveas, mapcalc and a rangebox with a junction (Figure 1) which operates as a loop using a specified index. Each of these operation is illustrated as a box in the workflow. As it can be seen in Figure 1, the rangebox consists of the flowing:

  • Range field; allows for values or string to be used as an index. It uses the string or values to compare with the ones derived from the serviceobject operation. and if the result is True the operations in the loop will be implemented and when the results is false it looks for the next input and so on. In this example, the given values in the Range field is compared with the raster layer/band number and in case the output True the band will be added to the newly created raster coverage.
  • The Zoom button in the Test field is used to visualize details of the dropped in operations.
  • The Operation area is used to include the operation that has to be implemented if the condition is met.
  • The Button bar is used to create a junctions.
  • The Junction task is to look after the inputs and output. It receive two inputs; one is the output of the operation in the range box and one directly from connect box(the same input that goes to the operation in the range box). Depending on the outcome of the Test field, it will pass one of the output to the next operation that happens outside of the range (loop).


The following steps allows you to create and build this example (Figure 2):

Mar.jpg


  • From ILWIS main window, click Create tab
  • From the opened Object Creation form, select Workflow
  • Type a name for the workflow in the corresponding field of the opened workflow form
  • You may add Keywords and Description in their corresponding location in the form; it is optional
  • Click Create & Open button once you are ready with the form
Figure 2, a workflow to resample raster maps to desired georeference.


This will generate an empty workflow and open the workflow builder panel as illustrated in Figure 2.
To add the required input data and operations to the workflow panel:

Mar.jpg


  • From ILWIS main window, click Operation tab or operation catalog tab
  • From the operation list, drag the connect operation and drop it in the workflow editor
  • From the operation list, drag the serviceobject operation and drop it in the workflow editor
  • From the operation list, drag the createrastercoverage operation and drop it in the workflow editor
  • From the operation list, drag the rasterband operation and drop it in the workflow editor
  • From the operation list, drag the addrasterband operation and drop it in the workflow editor
  • From the operation list, drag the saveas operation and drop it in the workflow editor
  • From the operation list, drag the mapcalc operation and drop it in the workflow editor
  • From the workflow Button bar click the add condition tab and then place the mouse pointer within the workflow editor to and a Range box
  • From the Range Button bar click add junction button to add a junction to the Range box.


You may add metadata and customize the contents and title of each added box in the workflow editor; the details are explained in Create workflow.
Follow the steps bellow to specify the fixed parameters for number of the added operation to the workflow editor:

Mar.jpg


  • Select one of the box in the workflow editor; e.g., serviceobject
  • Click Selected operation tab from the Action panel tab
  • The opened Selected operation form allows you to select an ILWIS service object from the dropdown list. Click, on the field Requested aspect value and select georeference
  • Click the Set fixed parameters button to set the georeference<tt> as a fixed parameter. If it done correctly the color of the text (1: Requested aspect value) in the serviceobject box will change to green.
  • Select one of the box in the workflow editor; e.g., <tt>createrastercoverage
  • Click Selected operation tab from the Action panel tab
  • The opened Selected operation form allows you to select a georeference or a raster coverage and to define the band dimensions of the new raster coverage. When selection True for the clean option; means a raster coverage with zero bands will created. When selecting False and the input for the georeference is a raster coverage, then the new raster coverage will have the same number of bands meaning the new raster coverage have the same bands while their contents are empty. In this exercise we do not define a georeference since that is already defined in previous step and accept the default (True) for the clean option.
  • Click the Set fixed parameters button to set the True<tt> option as a fixed parameter. If it done correctly the color of the text (1: Clean) in the createrastercoverage box will change to green.
  • Select the <tt>saveas box in the workflow editor
  • Enter the location, where the file will be saved, in the field Output url; input a format for file e.g. ilwis3, in the field <tt> Format; type the name of the provider in the field Provider,in this case raster file. Click the Set fixed parameters button; if it done correctly the color of the text (1: Output url,2: Format, and 3: Provider) in the saveas box will change to green.
  • Select one of the box in the workflow editor; e.g., mapcalc box
  • Click Selected operation tab from the Action panel tab
  • The opened Selected operation form allows you to define an expression. Click, on the field Expression and enter an expression.
  • Click the Set fixed parameters button to set the defined expression as a fixed parameter. If it done correctly the color of the text (0: Expression) in the serviceobject box will change to green.


In order to define the execution procedures you need to connect and define the input and output for each box. Note once the box is selected, 8 tiny handles (connectors) will appear around the selected box. You can use any of them to connect the box to another one by dragging an arrow form it using the mouse. By pointing the mouse pointer at one of the connectors, it color changes to red and an arrow will appear at the tip of the mouse pointer which can be dragged (extend) by moving the mouse. At the same time, the connectors around all the other boxes will be available and thus you are able to connect to any one of them and specify the inputs parameters for that box. it has to be mentioned that each box (or operation) in workflow generate one output which can be used as an input parameter for other operations. To define the execution procedure for the workflow follow the steps below(Figure 2):

Mar.jpg


  • Select the Connect box and connect it to serviceobject box and rasterband box, as it shown in Fig 2.
  • Connect the serviceobject box to createrastercoverage.
  • Connect the createrastercoverage to Junction and rasterband box.
  • Connect the rasterband box to addrasterband box
  • Connect the junction to addrasterband box and vice versa
  • Connect the addrasterband to saveas box and to mapcalc box
  • Enter a desired index for example: 4, 3, 2 in the Range field; The created loop will add bands 4, 3 and 2 to the new raster coverage if they are available in the input raster coverage.


If everything is done correctly, the color of Range box will change from red to green meaning the workflow is ready and has to be saved by using the save button; the first one on the button bar. Now you can run the workflow directly using the Run form. The run form allow you to add the required input parameters by drag and drop action. Once you are ready with the Run form:

Mar.jpg


  • Click the Run on the Action button bar to run the workflow in one go
  • Click the Stop button to stop the workflow of being executed. Note, using the Stop button will completely stop the workflow.
  • Click the Run in step mode button to run the workflow one step at the time. The output result after each step will be displayed in the Step form and can be visualized by being double clicked. Note, once the workflow is saved, it will be available in the ILWIS operation list and therefore it can be executed as an operation.