HD Vision Systems
← All software apps

VISION & ROBOTICS / RUNTIME APP

LumiScan
Script Runner

Your HALCON expertise. Connected to LumiScan.

LumiScan Script Runner runs your own MVTec HALCON procedures in LumiScan Keryx – with the same connection to cameras, PLCs and robots as every other LumiScan app.

Discuss your application

Data flow
Images + values
Script RunnerYour HALCON procedure
Images + results
LumiScan KeryxCameras · PLCs · Robots · Cockpit

For the vision tasks only you know.

The LumiScan Vision Suite apps solve standard tasks without vision expertise. Script Runner is for the other end: HALCON experts who need full control for their hardest cases. Both run side by side in Keryx.

Reuse your expertise

Existing HDevelop procedures run unchanged once they follow the script contract. You keep writing HALCON – Script Runner handles the connection, the handshake and operation.

Connect consistently

PLCs, robots, Cockpit and other LumiScan apps see your script like any other LumiScan app: the same Keryx nodes, the same data types, the same trigger handshake.

Robust in production

Every script runs in its own worker process with a watchdog. A faulty script reports an error and restarts – Keryx and the other apps keep running.

How it works

From HDevelop to production.

  1. Write

    Write the procedure lumiscan_process in HDevelop or adapt an existing one: a list of images and a list of values in, a list of images and a list of values out.

  2. Upload

    Upload the procedure as .hdvp or from a .hdpl library. Script Runner checks its name, parameters and HALCON classes before activation and keeps the previous version for rollback.

  3. Run

    On every trigger, HDevEngine executes the procedure JIT-compiled. Results, cycle time and status are available in Keryx immediately.

The script contract.

One fixed interface for every script, so no procedure needs its own integration code.

procedure lumiscan_process (Images : ImagesOut : Values : ValuesOut)
ParameterHALCON classDirectionContent
ImagesIconic object tupleInput0…n images, in the order of the Keryx input list
ValuesControl tupleInput0…n values (integer, real, string)
ImagesOutIconic object tupleOutput0…n result images, e.g. masks, overlays, rectified images
ValuesOutControl tupleOutput0…n result values, e.g. measurements, OK/NOK flags, counts, strings
  • The entry procedure name is fixed; support procedures in the same library may have any name.
  • All four parameters must exist, even if unused. An empty list is valid.
  • You define the meaning of each value position as the script author.
  • Result images must be HALCON images; convert regions and XLDs in the script, e.g. with region_to_bin or paint_region.
  • No global variables, no file access to fixed paths; dev_* operators are ignored at runtime.
  • Raise errors as normal HALCON exceptions – Script Runner reports them in Keryx with procedure and line.
Example: count parts per image within an area range and return one mask per image
procedure lumiscan_process (Images : ImagesOut : Values : ValuesOut)
* Values[0] = minimum area, Values[1] = maximum area
gen_empty_obj (ImagesOut)
ValuesOut := []
count_obj (Images, NumImages)
for I := 1 to NumImages by 1
    select_obj (Images, Image, I)
    threshold (Image, Region, 128, 255)
    connection (Region, Parts)
    select_shape (Parts, Selected, 'area', 'and', Values[0], Values[1])
    count_obj (Selected, NumParts)
    ValuesOut := [ValuesOut, NumParts]
    get_image_size (Image, Width, Height)
    region_to_bin (Selected, Mask, 255, 0, Width, Height)
    concat_obj (ImagesOut, Mask, ImagesOut)
endfor
return ()

The Keryx interface.

Each Script Runner instance gets its own subtree in LumiScan Keryx. Several instances with different scripts run in parallel.

lumiscan/scriptrunner/<instance>/
NodeTypeAccessMeaning
config/scriptstringread/writeActive script (library + version)
config/timeout_msint32read/writeMaximum execution time per call
input/image_refsarray of stringread/writeNode paths of the source images, e.g. LumiScan Cam Driver image nodes
input/imagesarray of imageread/writeAlternative: write images directly
input/valuesarray of variantread/writeInput values in contract order
output/imagesarray of imagereadResult images in contract order
output/valuesarray of variantreadResult values in contract order
control/triggerboolread/writeStarts a cycle
control/doneboolreadCycle finished, outputs valid
status/stateint32read0 Idle · 1 Busy · 2 Done · 3 Error · 4 Not ready
status/error_codeint32readError code (see below)
status/error_textstringreadHALCON error message with procedure and line
status/cycle_time_msdoublereadExecution time of the last call
status/cycle_counterint64readNumber of completed calls
status/script_versionstringreadVersion and hash of the loaded script

Handshake

  1. The PLC or client writes input/* and sets control/trigger.
  2. Script Runner sets status/state to Busy and calls lumiscan_process with the images and values.
  3. Script Runner writes output/* and status/* completely, then sets control/done = true and the state Done or Error.
  4. The PLC reads output/* and resets control/trigger.
  5. Script Runner sets control/done = false and the state Idle – the next cycle can start.

Data types

KeryxHALCONBack to Keryx
boolinteger 0 / 1integer
int32, int64integerint64
float, doublerealdouble
stringstringstring
image (mono 8/16 bit, RGB 8 bit)image (byte / uint2 / 3-channel byte)image of the same type

Error codes

CodeMeaningBehaviour
0OK–
1HALCON exception in the scriptOutputs empty, error text set, ready for the next trigger
2Timeout exceededWorker restarted, script reloaded
3No valid script loaded or contract violatedNot ready until a valid script is activated
4Input error (missing image reference, unsupported type)Script not called
5Worker crashedWorker restarted, script reloaded
6Licence error (LumiScan or HALCON runtime)Not ready

At a glance.

Platforms, connectivity and licensing.

Execution
One HALCON procedure (.hdvp or from a .hdpl library) per instance, JIT-compiled through HDevEngine on every trigger.
Instances
Several instances in parallel, each with its own script and its own Keryx subtree.
Platforms
Windows 11 and Ubuntu 24.04 with LumiScan Keryx. ctrlX OS is in preparation – with the same node layout and handshake through the ctrlX Data Layer.
Connectivity
Image and value lists through Keryx; images directly from LumiScan Cam Driver, status in LumiScan Cockpit, PLC and robot connection as with every LumiScan app.
Know-how protection
Password-protected HALCON procedures run without exposing their source code.
Operation
Isolated worker process, configurable timeout, versioning with rollback, cycle-time and error counters, structured log.
Licensing
LumiScan Key (CodeMeter). Every installation is supplied with the complete MVTec HALCON runtime licence.

HALCON and HDevelop are trademarks of MVTec Software GmbH.

Frequently asked questions

Which HALCON procedures can Script Runner run?

Any procedure that follows the script contract lumiscan_process(Images : ImagesOut : Values : ValuesOut), saved as .hdvp or in a .hdpl library. Support procedures from the same library may be called.

Do we need our own HALCON licence?

No. Every installation is supplied with the complete MVTec HALCON runtime licence; Script Runner itself is licensed with the LumiScan Key.

Can we protect our know-how?

Yes. Password-protected HALCON procedures run without exposing their source code.

What happens if a script fails?

Each script runs in its own worker process. A HALCON exception is reported in Keryx with procedure and line; on a timeout or crash the worker restarts and reloads the script, while Keryx and the other apps keep running.

Which platforms are supported?

Windows 11 and Ubuntu 24.04 with LumiScan Keryx. ctrlX OS is in preparation, with the same node layout and handshake.

Already working with HALCON?

Tell us about your application, the number of instances and your target platform – we will send you a quote.

YOUR ENQUIRY

Let’s talk about your application.

A few details are enough – we get back to you within one business day. Prefer to talk? +49 6221 6721900

Up to 3 files, 10 MB in total · JPG, PNG, PDF, STEP

We use your details to answer your enquiry. See the privacy notice.