6.4.5.2   Setting Up the Procedure Parameters

This part of the dialog is used for the definition of procedure parameters. HDevelop procedure interfaces have the same structure as HALCON operator interfaces, that is, they may contain parameters of the four categories iconic input, iconic output, control input, and control output in this order. The procedure interface dialog contains four separate areas where the different parameters types may be edited. Each area contains a button for appending new parameters to the parameter list.

Figure 6.43: Procedure parameters..

When creating a new procedure from selected program lines, HDevelop automatically determines suitable interface parameters for the procedure from the usage of the variables in the selected code. The combo box Selection Scheme determines the suggestion of the procedure parameters. The meaning of this selection is as follows:

First In
If the first use of a variable inside the selected lines is as an input variable, it will be suggested as an input parameter of the procedure.

Last Out
If the last use of a variable inside the selected lines is as an output variable, it will be suggested as an output parameter of the procedure.

All In
All input variables inside the selected lines are suggested as input parameters in the procedure.

All Out
All output variables inside the selected lines are suggested as output parameters of the procedure.

The classification of variables in the selected program lines is performed separately for iconic and control variables.

If a variable is an input as well as an output variable, it is assigned to the first category, i.e., the corresponding procedure parameter becomes an input parameter.

If, according to the above rules, a variable name would be suggested as an input as well as an output parameter, it becomes an input parameter of the procedure. In addition, an output parameter with the variable name extended by “Out” is created.

As an illustration, the following program lines are selected for a new procedure:

threshold (Image, Region, 128, 255)
connection (Region, ConnectedRegions)

Then, based on the selection scheme All In All Out, the procedure body will read

copy_obj (Region, RegionOut, 1, -1)
threshold (Image, RegionOut, 128, 255)
connection (RegionOut, ConnectedRegions)

To the right of the parameter list, the following buttons are provided:

Reset

If you are creating a new procedure, clicking this button removes all entered parameters. If you are editing an existing procedure, the original interface is restored, i.e., any changes to the parameters are undone.

Remove

Using this button you can remove single parameters from the list. Before clicking this button, focus the corresponding parameter by clicking its text field.

Move Up, Move Down

Using these buttons you can alter the order of the parameters. Select a parameter by clicking its text field and use the buttons to change its position.

To move a parameter from one parameter group to another parameter group, follow these steps:

Vector Parameters

HDevelop 12.0 and later versions support vector variables. See section “Vectors” on page 869 for a detailed description. Vector variables may be used in procedure calls. The following buttons handle the conversion of parameters to vector and back again. Please note that the dimension of a vector in a procedure call must match the dimension specified in the procedure interface, i.e., if the procedure expects a vector of tuples, it cannot be called by passing a vector of vectors of tuples.

Vector parameters are distinguished from other parameters by showing the contained type and the dimension next to the parameter name, e.g., object {1} for a vector of iconic objects, or tuple {2} for a vector of vectors of tuples.

To Vector

Set the type of the selected parameter to vector. If the selected variable is of type vector already, its dimension may be increased with this button (label changes to Dim +).

To Object / To Tuple

Set the type of the selected parameter to object (iconic parameters), or to tuple (control parameters). If the selected variable is a multi-dimensional vector, its dimension may be decreased with this button (label changes to Dim -).