Scripting with flows

From Endrov

(Redirected from Using flows)

This page is about doing image processing in Endrov. You are assumed to know how to open and visualize your data.

Contents

Why flows?

Endrov is designed for the needs of image processing and analysis in research:

  • Original data should never be modified, it is the proof that the work was done appropriately
  • The data processing act must be adequately documented
  • The process must be repeatable and verifiable
  • Once a workflow has been found to work, it should be easy to apply it to large amounts of data

All these problems are solved in one go using Endrov Flows. Flows allow you to describe the process using a graphical language, and store it together with the images. The original data is by default not modfied.

Flowwindow.png

Creating a flow

Open up the flow window. Click the "Create new Flow" button:

WidgetObjectComboCreate.png

You get a popup where you can enter a name and where you want to store it. Anywhere is fine

WidgetObjectComboCreating.png

The same widget is used to select different flows later on.


Flow basics

A Flow is built up using Flow Units ("units"). A unit is created by clicking in the list on the left, and then somewhere on the big panel to place it. You should think of Flows as flow charts, where the flow is from the left to the right.

FlowUnitConcat.png

Above is a unit to put two lists together. The two incoming lists are called A and B (left side), and the resulting concatenated list is called C (right side).

A connection is drawn between two units by dragging (left mouse button) from one connection on one box to the connection on another box.

The input to a box will usually be a constant (special units from the category Constants) such as 123 or "Hello world", or it will be a an Endrov Object.

Referencing objects

Flowobjectreference.png

Endrov objects are both read and written using the special unit ObjectRef. Since it is used so often there is a short-cut; you can quickly place references to any object using the lower-left list. Since Endrov stores all objects as an object hierarchy, you will see paths such as

#d/a

This is the object "a" under the dataset "d". On the other hand,

a/b

means the object "b" under the object "a", which in turn is under the context root. What this root is depends on the situation, but in the Flow scripter it is the root of the flow object.

Object references have a dual function. If you specify the input, it stores data. If you specify the output, it reads the data. In fact, it can do both at the same time. This is very useful for storing intermediate values for later inspection.

Object references also have an optional parent input. If it is specified then the path is relative to this object. Absolute paths are bad - use this whenever possible!


Flow types

All flows are semi-typed: this means that units knows what sort of input and output they have; is it a single number or is it an entire image? You find this information by hovering the mouse over a connection point. Learn to look it up as it will help you figure out how to use the units.


Working with the GUI

Almost all commands are reached by right-clicking either on a unit or on a connection. You can see additional information by hovering above a connection, a connection point or over the unit in the list.

Flowcreateinput.png

Many times you need to create constants such as integers. Right-click on an input/output connector and it will give you suggestions, such as "create integer", creating both the variable and connecting it for you.

Flowexecuterightclick.png

To actually get an output, you need to request that it is calculated. The most direct way of doing it is to right-clicking on the output you want, and press "evaluate".

Prettifying the flow

Flows are designed to look decent automatically - you should spend time on research rather than on layout, and we have tried to remove the temptation to mess with details. Still, readability sometimes calls for layout and you have some tools at your disposal.

WidgetFlowUnitLayout.png

You can align unit by dragging a mouse around them (left mouse button) then using these buttons:

  • To the left: Align horizontally, put them against an invisible vertical line
  • To the right: Align vertically, put them all in evenly spaced rows