---
title: "Type Mapping"
description: "How LumiScan Script Runner maps HALCON procedure parameters to Data Layer nodes: integers, reals, strings, arrays, images, handles, regions and contours."
product: "LumiScan Script Runner"
component: "lumiscan-script-runner"
version: "1.0.0"
display_version: "1.0.0.2"
latest_version: true
language: "en"
url: "https://docs.hdvisionsystems.com/en/lumiscan-script-runner/type-mapping.html"
---

# Type Mapping – LumiScan Script Runner

## Parameters to nodes {#parameters}

| Procedure parameter | Node | Notes |
| --- | --- | --- |
| Control, element type `integer` only | INT64 |   |
| Control, element types with `real` (also `number`, `angle.`, `point.`) | FLOAT64 | An integer the procedure returns for a real output is converted. |
| Control, element type `string` (also `filename*`) | STRING | A file name is resolved inside the script folder. |
| Any of the above with `multivalue` `true` or `optional` | ARRAY_OF_INT64, ARRAY_OF_FLOAT64, ARRAY_OF_STRING |   |
| Control, strings mixed with numbers | refused (`-10002`) |   |
| Control, `handle` (`shape_model`, `dict`, any model) | no node | An input must be bound to the group’s store; an output goes to the store by default. See [Modules, Groups and the Store](https://docs.hdvisionsystems.com/en/lumiscan-script-runner/modules-groups-and-store.html). |
| Iconic, object class `image` | image group | `<name>/data` (RAW), `width`, `height`, `pixel-type`, see [Images](https://docs.hdvisionsystems.com/en/lumiscan-script-runner/type-mapping.html#images). |
| Iconic input, region or contour (XLD) | refused (`-10002`) |   |
| Iconic output, region or contour (XLD) | no node | Convert it in the procedure, for example with `region_to_bin`. |
| A vector parameter (dimension 1 or 2) on a node | refused (`-10002`) | Bind it to the store, or use a tuple with several values instead. |

### Types from `sem_type` {#sem-type}

When `type_list` is empty, the type is taken from `sem_type` where it says one:

- `integer` gives an integer;
- `real`, `angle.` and `point.` give a real, `number` an integer or a real;
- `string` and `filename*` give a string;
- the handle labels `handle`, `dict`, `window`, `message`, `message_queue`, `serial`, `socket` and any `*_model` (`shape_model`, `ncc_model`, …) give a handle.

Any other `sem_type` is kept as a label and needs a `type_list` or an interface file.

A `type_list` of `integer` alone beside a handle label is read as a handle, and the log names the parameter with a warning. Before HALCON 18 handles were integers, and some of MVTec’s own procedures still document a model that way, for example `ModelID` of `dev_display_shape_matching_results` (`type_list` `integer`, `sem_type` `shape_model`). Any other `type_list` is taken as it is.

The node name is the parameter name in kebab case (`MinScore` → `min-score`), lower case, only `a-z`, `0-9`, `-` and `_`. The original name is the node’s display name. The parameter’s description ends with its unit, min, max and default, for example `the lowest gray value (min 0, max 255, default 128)`. An input node starts at the parameter’s default value.

## Images {#images}

An image parameter is a group of four nodes:

| Node | Type | Content |
| --- | --- | --- |
| `data` | RAW | The pixels, row by row without padding; 16-bit values little-endian. |
| `width` | UINT64 | Width in pixels. |
| `height` | UINT64 | Height in pixels. |
| `pixel-type` | STRING | `mono8`, `mono12`, `mono16`, `rgb8` or `bgr8`. |

| `pixel-type` | Image input becomes | Image output from |
| --- | --- | --- |
| `mono8` | `byte`, one channel | `byte`, one channel |
| `mono12` | `uint2`, one channel, shifted right by the module’s `mono12Shift` bits | – |
| `mono16` | `uint2`, one channel | `uint2`, one channel |
| `rgb8` | `byte`, three channels (r, g, b) | `byte`, three channels |
| `bgr8` | `byte`, three channels (r, g, b) | – |

- An input image is checked before the procedure runs: a known pixel type, width and height above 0, exactly width × height × bytes per pixel bytes, and a pixel type and channel count the parameter accepts. A failed check ends the run with `-3`.
- LumiScan X cameras put their 12 bits at the top of the 16-bit word. Set `mono12Shift` to `4` for such a module to give the procedure values from 0 to 4095.
- An image output must be exactly one image of pixel type `byte` (one or three channels) or `uint2` (one channel). Anything else fails the run with `-10003`: convert it in the procedure (`convert_image_type`, `scale_image_max`).

### Copy time {#image-copy-time}

Every image is copied into HALCON before the procedure runs, and every image output is copied out of HALCON after it. The copy adds to the run time. For a 5-megapixel frame (2448 × 2048) a development PC took per direction:

| `pixel-type` | Copy time per direction |
| --- | --- |
| `mono8` | about 1 to 3 ms |
| `mono16` | about 3 to 10 ms |
| `rgb8` | about 13 to 27 ms |

The time grows with the number of bytes; your PC may be faster or slower. Where the cycle time is tight, prefer `mono8`, and pass only the images the procedure needs.

## The closed type set {#closed-type-set}

HALCON has no user-defined types. The Script Runner, the interface file and the type checks know exactly these names:

- element types of control values: `integer`, `real`, `string`, `handle`;
- object classes of iconic objects: `image`, `region`, `xld`;
- pixel types: `byte`, `int1`, `int2`, `uint2`, `int4`, `int8`, `real`, `complex`, `cyclic`, `direction`, `vector_field`;
- multiplicity: `false` (one), `true` (several), `optional`;
- dimension: `0`, `1` or `2`.

A name outside this set refuses the procedure and names the parameter. `sem_type` is a free label, not a type: any label is kept.
