the open source for machine vision and data visualization
Introduction to Execution Graph Framework (ExGraF)

Introduction to Execution Graph Framework (ExGraF)

by Eduard Baranovsky

Execution graph, in terms of this frame work, is a network of processing tasks, connected together with data links. The order of task execution depends on data propagation throw the graph. When some task in the graph, have all its inputs available, execution is performed. One of advantages of this paradigm is that the same execution graph could achieve optimal CPU utilization for different input data load. In the case of static order of processing, it could lead to waist of time, waiting for data, ready at some input.

ExGraF framework is a collection of components (classes, interfaces and graphical widgets), which could be easily combined together and integrated with other components to form compleet application.

Different paradigms in software development

Different kinds of problem in real world, requires different software approaches for their solution. If you are building extensive GUI application, you may use Object Oriented paradigm for your design, create many classes with complex hierarchy, and connect them together to obtain desired system behavior. For automation control system, you may use State Machine paradigm, define each module as a state machine and define transition from one state to another. For calculation problems, such as signal and image processing Generic Programming is more suitable, you are defining your data structures, and set of functions, to process them. Execution Graph (or Data Flow) is also a kind of paradigm, distinguished from those mentioned above, that could be useful for certain kinds of problem. For example it could work good in calculation and automation control systems development.

How it works

The main part of ExGraF is a workspace where user can create graph for his application.
On the left side of the main application window there are tasks which are avaliable for the application and on the right is a workspace where tasks can be connected together to form an application (execution) graph.

To demonstrate how it works, we'll create a graph that reads color image and display it on the screen.

First we select color image reader object

Then put image display object and connect it to the reader.

Provide reader task with name of the image to read. Click left mouse button on reader task and put path to image file.

Now our graph is ready so we can run it. Press "run" button.

Now we can add some other stuff, split color image to red, green and blue components and show them as separate images.

Useful development tools

ExGraF comes with logger and scope tools integrated to the framefork.

A logger displays debug messages coming from ExGraF tasks.

A scope display timing of every task executed in the graph and very useful in the application performance tuning.

ExGraF architecture

ExGraF framework consists from several basic classes:

  • EgWorkspaceWidget - graphical widget, displaying execution tasks and data connection between them.
  • EgTask - abstract class, encapsulating common execution task behavior. Inhereted by real (My) task.
  • EgManager - maneges tasks and data connections
  • EgScheduler - tasks manager, manages task execution, and communicate with EgShcedulerView class for graphics updates. It inherits from EgTask, and contains them (composite pattern), could be defined as a task, introducing sub graphs composition.
  • EgShcedulerView - graphical view of specific scheduler.
  • EgTaskView - graphical representation of some task.

    Using TCL for creating ExGraF graphs

    The most intuitive and simplest way for creating execution graph, is using of graphical interface. But in real application, graph topology could depend on application parameters. For example if you have some video/imaging application and number of tasks depends on number of cameras, it is convenient to write script that create desired graph topology, taking to account number of cameras parameter. TCL script languish is very useful in such configuration task, and can be easily embedded to C++ code. EgTclConfigurator is C++ class which responsible for graph creation from TCL script.
    The following script shows TCL script creating graph of dataflow coming from 3 different cameras. First for each channel, 1-st derivative is calculated, then all streams coming to the common task, which compares images from different cameras.

    # create common comparison task (with 3 inputs)
    createTask PTask3ImageCompare image_compare
    
    # create 3 camera grabbers and connect sobel operator to each task
    for { set cam 0} { $cam <3 } { incr cam} {
    
    	createTask PTaskCameraGrabber grabber_$cam
     	createTask PTaskSobel sob_$cam
    	connectTasks out grabber_$cam in sob_$cam
    	connectTasks out sob_$cam in_$cam image_compare
    }
    
      

    Comments: