You are here: Start » Programming Reference » Connections


Read before: Introduction to Data Flow Programming.


In general, connections in a program can be created between inputs and outputs of compatible types. This does not mean, however, that the types must be exactly equal. You can connect ports of different types if only it is possible to adapt the transferred data values by means of automatic conversions, array decompositions, loops or conditions. The power of this drag and drop programming model stems from the fact that the user just drags a connection and all the logic is added implicitly on the do what I mean basis.

Connection Logic

This is probably the most complicated part of the Adaptive Vision programming model as it concentrates most of its computing flexibility. The good news is that you will never define any connection logic explicitly as this is done by the application automatically.

There are 5 basic types of connection logic:

  1. Basic Connection
    T T
    This kind of connection appears between ports of equal types.
  2. Automatic Conversion
    A B
    Automatic conversion is used when the user connects two ports having two different types, e.g. Integer and Real, and there is an appropriate filter in the Conversions category, e.g. IntegerToReal, that can be used to translate the values.
  3. Array Connection
    TArray T
    This logic creates an implicit loop on a connection from an array to a scalar type, e.g. from RegionArray to Region. All the individual results are then merged into arrays and so the outputs of the second filter turn into arrays as well (see also: Arrays).

    Example array connection (computing area of each blob).

  4. Singleton Connection
    T TArray
    Conversely, when an output of a scalar type is connected to an array input, e.g. Point2D to Point2DArray, a singleton connection assures that the value will be converted into a single element array.
  5. Conditional Connection
    T? T
    The last connection type, conditional connection appears when conditional data (T?) is transferred to a non-conditional input (T). This causes the second filter to be executed conditionally depending on whether the value actually exists or not (then it is NIL). The filter outputs are changed into conditional outputs accordingly, assuring that consecutive filters will be executed conditionally as well. Conditional execution ends at a filter with a conditional input. More information on this topic can be found in Conditional Execution section.

    Example conditional connection (intersection between two segments may not exist).

Mixed Connection Types

For maximum flexibility many combinations of the above logics can appear. Again, this is always inferred automatically.

  1. Conditional Connection with Conversion
    A? B
    If the object exists, then it is converted and passed to the input port. If not, the filter is not invoked.
  2. Array Connection with Conversions
    AArray B
    All elements of the input array are individually converted.
  3. Conditional Array Connections
    TArray? T
    All array elements are processed or none – depending on the condition. The output is of a conditional array type.
  4. Conditional Array Connection with Conversions
    AArray? B
    All array elements are processed and converted individually or none – depending on the condition.
  5. Array Connection with Conditional Elements
    T?Array T
    The second filter is invoked conditionally for each array element and the output types turn into arrays of conditional elements.
  6. Array Connection with Conditional Elements and Conversions
    A?Array B
    As above plus conversions.
  7. Singleton Connection with Conversion
    A BArray
    A single-element array is created from a converted input value.
  8. Conditional Singleton Connection
    T? TArray
    If the object exists, then it is transformed into a single-element array. If not, the second filter is not invoked.
  9. Conditional Singleton Connection with Conversion
    A? BArray
    If the object exists, then it is converted and transformed into a single-element array. If not, the second filter is not invoked.

Each individual connection logic is a realization of one control flow pattern from C/C++. For example, Array Connection with Conditional Elements corresponds to this basic code structure:

for (int i = 0; i < arr.Size(); ++i)
    if (arr[i] != NIL)

Previous: Optional Inputs Next: Conditional Execution