Application File

lumiscan-script-runner.json in the settings folder holds all settings of the Script Runner. It is read at start; see When changes take effect. The shipped file states every setting. Its JSON schema is schemas/lumiscan-script-runner.schema.json next to it.

Example

{
    "$schema": "schemas/lumiscan-script-runner.schema.json",
    "apiVersion": 1,
    "scriptFolder": "scripts",
    "engine": {
        "threadNum": 1,
        "useSpinLock": false,
        "startUpThreadPool": false,
        "jitCompiled": false,
        "ignoreDisplay": true
    },
    "modules": [
        {
            "name": "blobs",
            "procedure": "count_blobs",
            "group": "vision",
            "trigger": "handshake",
            "inputs": {
                "ImageFile": { "from": "node" },
                "MinGray": { "from": "node" },
                "MinArea": { "from": "node" }
            },
            "outputs": {
                "Binary": { "to": "node" },
                "Count": { "to": "node" },
                "Areas": { "to": "node" },
                "MeanGray": { "to": "node" }
            },
            "mono12Shift": 0,
            "acceptedInterfaceHash": "sha256:d7b6f8ff6d772a1392512bf7d11d1d00050e7fc9fc4045da50d566ea6676e64d"
        }
    ]
}

Top level

Key Type Default Meaning

apiVersion

integer

1

The Data Layer API version the app serves. Only 1 is valid; any other value stops the app at start.

scriptFolder

string

"scripts"

The script folder, relative to the settings folder or absolute. Must not be empty.

engine

object

see engine

How HALCON and HDevEngine are set up.

modules

array

[]

The modules, see modules. Their order is the order on the Data Layer.

engine

These settings put HALCON into a CPU-friendly state before the first operator runs. They apply to the whole app.

Key Type Default Meaning

threadNum

integer

1

How many threads HALCON may use to parallelise one operator (HALCON’s thread_num), 0 to 1024. 0 keeps HALCON’s own default, which uses every core. Raise it only if the PC has cores to spare: the groups already run in parallel.

useSpinLock

boolean

false

HALCON’s spinlocks. They slow down severely with more threads than cores; leave them off.

startUpThreadPool

boolean

false

HALCON’s thread pool. It always spins and keeps cores busy; leave it off.

jitCompiled

boolean

false

Runs procedures JIT-compiled (HDevEngine’s execute_procedures_jit_compiled). Faster for loops; HALCON falls back to the interpreter on its own where it cannot compile.

ignoreDisplay

boolean

true

The display operators (dev_*) do nothing; dev_open_window and dev_get_window fail. The Script Runner has no display.

The Script Runner never gives a HALCON thread real-time scheduling, and it sets HALCON so that an output a procedure never set fails the run instead of coming back empty.

modules

Each entry is one module, see Modules, Groups and the Store.

Key Type Default Meaning

name

string

required

The module’s name and its folder on the Data Layer (v1/<name>/). Lower case, only a-z, 0-9, - and _. system, api-version and v followed by digits are reserved. Unique.

procedure

string

required

The procedure the module runs: the file name in the script folder without .hdvp.

group

string

the module’s name

The group the module runs in. Same rules as name. Modules that share store keys must be in one group.

trigger

string

"handshake"

handshake: the module has a run function. start: it runs once when its group starts and has no run function. The schema also lists stream and a stream section: they are reserved for a later version and not served in this one; do not use them.

inputs

object

every value and image input on a node

The input bindings, keyed by parameter name, see Bindings.

outputs

object

every value and image output on a node, every handle output to the store; in a start module every output to the store

The output bindings, keyed by parameter name, see Bindings.

mono12Shift

integer

0

Bits a mono12 input image is shifted right before the procedure gets it, 0 to 4. LumiScan X images need 4.

acceptedInterfaceHash

string

none

The interface hash the module’s nodes were built for (sha256:…). Without it, or when it differs from the procedure’s current hash, the module is refused with -10005. See Interfaces and Hashes.

Bindings

inputs and outputs map a parameter name to a binding. A parameter without an entry gets its default.

Table 1. Input binding
Binding Meaning

{ "from": "node" }

A node under run/input/ (default for value and image inputs).

{ "from": "store", "key": "model" }

Read from the group’s store under key; without key, under the parameter name. No node. Required for handle inputs.

{ "from": "value", "value": 0.7 }

A fixed value. No node. Only for number and string parameters, not for images or handles. value is required: a JSON number or string, or an array of them, that fits the parameter (an integer also fits a real parameter; a single-value parameter takes one value). A file name is resolved in the script folder.

Table 2. Output binding
Binding Meaning

{ "to": "node" }

A node under run/output/ (default for value and image outputs).

{ "to": "store", "key": "model" }

Written to the group’s store under key; without key, under the parameter name (default for handle outputs, and for every output of a start module).

{ "to": "both", "key": "model" }

Node and store.

{ "to": "none" }

Dropped.

The module is refused (-10002, the status text names the parameter) when a binding names a parameter the procedure does not have, binds it in the wrong direction, puts a handle, a vector, a mixed tuple, a region or a contour input on a node, gives an image or a handle a fixed value, gives a fixed value that does not fit the parameter, or gives a start module a node.

Checks at start

The app does not start, and logs why, when:

  • the file is not valid JSON, or apiVersion is not 1;

  • a section has the wrong kind, scriptFolder is empty, engine.threadNum is not a whole number from 0 to 1024, or an engine switch is not true or false;

  • a module entry is refused: it has no valid name or group, no procedure, an unknown trigger, a binding with an unknown from or to, a value binding without value, or a mono12Shift outside 0 to 4 (the log names the module);

  • two modules have the same name.

A module whose procedure is missing, cannot be loaded or cannot be mapped is refused on its own with -10002; the other modules run.