Session Images
The Session Images widget shows the images of a session in a dialog: a grid of square thumbnails and, when one is clicked, a detail panel with the image, its result, its date and the results of each model. The boxes and polygons of the detections are drawn over the image and the thumbnails. The widget shows nothing in its group: one message opens the dialog and the next ones fill it.
Palette: category Pages, label session images. 1 input, 1 output.
The Sessions widget has the same viewer built in, and the images it reads from a session folder have the shape described under Input.
Configuration
| Property | Description | Default |
|---|---|---|
| Name | Node name shown in the editor. | '' |
| Group | Dashboard group of the widget. The dialog opens only in browsers showing the page of this group. | (required) |
| Locale | Locale Config node. This widget takes only the footbar texts from it. | '' |
| Size | Width and height of the widget (0 = automatic). | 0 / 0 |
| Dialog title | Title of the dialog when the opening message has no msg.class. The title is shown in capitals, followed by the number of images. | '' |
| Max images | Maximum number of images in the grid. Empty or 0 uses 60. | 60 |
| Show mask checkbox | Shows the MASK toggle in the footbar. Unticked, the toggle is hidden and the mask stays in its last state (off by default). | true |
| Show bbox checkbox | Shows the BBOX toggle. Unticked, the toggle is hidden and the boxes stay in their last state (shown by default). | true |
| Show polygon checkbox | Shows the POLYGONS toggle. Unticked, the toggle is hidden and the polygons stay in their last state (shown by default). | true |
| Mask checkbox text | Label of the MASK toggle. Built-in text: MASK. | '' |
| Bbox checkbox text | Label of the BBOX toggle. Built-in text: BBOX. | '' |
| Polygon checkbox text | Label of the POLYGONS toggle. Built-in text: POLYGONS. | '' |
| Hover label text | Title of the first option of the footbar cog menu. Built-in text: Labels on hover. | '' |
| Hover label hint | Subtitle of that option. Built-in text: Show a label only while pointing at its detection. | '' |
| Box fill text | Title of the second option of the cog menu. Built-in text: Bounding box fill. | '' |
| Box fill hint | Subtitle of that option. Built-in text: Tint the inside of each bounding box. | '' |
| Annotations on thumbnails | Initial state of the Show annotations button of the dialog header. | true |
The seven text properties work the same way: the node's own text wins. When it is empty, or equal to the built-in text, the text set in the Locale config is used, and when that is empty too, the built-in text.
The dialog
- Header: the title, the number of images and, when there are images, the Show annotations button, which shows or hides the boxes and polygons on the thumbnails (not on the detail image). Its state is remembered per widget in the browser.
- Grid: 200-pixel square thumbnails with the image
nameas caption. The border is red whenisAnomalousistrueand green when it isfalse. Clicking a thumbnail opens the detail panel on the right; clicking it again closes the panel. - Detail panel: the image name, its position (
3 / 40), a selector of the image type when the image has more than one, a maximize button and a button to hide the panel. Below the image: Result, Date and a Models section with one expandable panel per model. The mouse wheel zooms up to 8x, a double click zooms in or returns to fit, dragging moves a zoomed image, and the toolbar in the bottom right corner zooms out, zooms in and fits. The side arrows and the Left and Right arrow keys move to the previous or next image. Maximized, the image takes the dialog, with a strip of thumbnails below it and the information on the right. - Footbar: a cog menu with Labels on hover (a detection label is shown only while the pointer is over its box or polygon) and Bounding box fill (boxes get a translucent fill, in the detail image and on the thumbnails); the cog shows a dot while either is on. Then the MASK toggle (the image and the thumbnails show their mask version when they have one), and the BBOX and POLYGONS toggles. Mask is off, boxes and polygons are on, and both menu options are off by default; changes are remembered per widget in the browser.
Closing the dialog, with the close button, a click outside it or showDialog: false, empties the grid.
Input
A message that carries msg._client, such as a click in another widget of the dashboard, updates only the browser it came from; a message without it updates every browser. The node adds itself to the base's Accept Client Data list, so nothing has to be ticked there.
Open and close
msg.payload = { showDialog: true };
msg.class = "scratch"; // optional: title of the dialog| Property | Type | Description |
|---|---|---|
payload.showDialog | boolean | true opens the dialog, false closes it. A message with this property only opens or closes: the rest of its payload is ignored. |
class | string | Title of the dialog, read when it opens. Without it, Dialog title is used. |
Images
Images are accepted only while the dialog is open: send them after the message that opens it. Images that arrive while it is closed are ignored.
payloadas an array replaces all the images, in the order given.payloadas an object adds one image at the start of the grid.
The list is then cut to Max images, dropping the images at the end. Every image message closes the detail panel.
An image object:
| Field | Type | Description |
|---|---|---|
imageShow | object | The image in one or more types, keyed by type name (for example raw, join). See below. |
id | string | Unique key. Generated when missing. |
name | string | Caption of the thumbnail and title of the detail panel. |
result | string | Shown as Result (— when missing), in red when isAnomalous is true, in green otherwise. |
isAnomalous | boolean | Colour of the thumbnail border and of the result. |
date | number, string or object | Milliseconds since 1970, the same as a numeric string, or an object with seconds. Shown in the browser's time zone with the Spanish date format (day/month/year). Any other value, an ISO date string for example, is shown as received. |
resume | object | Results per model. See below. |
bbox, polygons | array | Detections used when the image type has none. |
Each entry of imageShow:
| Field | Description |
|---|---|
imageData | Full image. |
imageDataThumbnail | Thumbnail. Without it, the thumbnail uses imageData; without imageData, the detail uses the thumbnail. |
imageDataMask | Mask version of the image, shown when MASK is on. |
imageDataThumbnailMask | Mask version of the thumbnail. |
bbox | Boxes of this type. |
polygons | Polygons of this type. |
An image can be a URL, a data URL or bare base64. Bare base64 longer than 100 characters gets a data: header from its first bytes: JPEG, PNG, WebP or GIF, and JPEG when none matches.
The grid shows the first type of each image. The detail panel keeps the type selected for the previous image when the new one has it; otherwise it shows join when the image has that type, else its first type. The selector shows the type names with spaces for underscores, and the strip of the maximized view follows the type selected.
An older format is also accepted: { imageData, filename }, with imageUrl or image in place of imageData and name in place of filename. It becomes an image with a single type named image and no result, date or detections.
Detections
- Box:
{ x_rel, y_rel, w_rel, h_rel, tag, score, color }.x_relandy_relare the top-left corner,w_relandh_relthe size, all as fractions (0 to 1) of the image. A box with a missing or non-numeric coordinate is skipped. - Polygon:
{ points, tag, confidence, color, alpha }.pointsis[[x, y], ...]or[{ x, y }, ...]in fractions of the image, with at least 3 valid points.alphais the opacity of the fill in the detail image (0.35when missing). - Colour: a CSS colour,
{ r, g, b, a }or[r, g, b, a](aoptional). When it is missing or not valid, the colour is derived fromtag; a polygon without tag is green. - Label: in the detail image,
tagfollowed byscore(boxes) orconfidence(polygons) cut to two decimals, for examplescratch 0.95. A detection withouttaghas no label. Thumbnails show the shapes without labels.
Models
resume is an object keyed by model name. Each model is an expandable panel. Its header is red when the model's result is NOK and green when it is OK; with any other result, red or green follows isAnomalous (true or false), and the header is dark blue when neither tells. Inside, one row per field. Numbers between 0 and 1 are shown as percentages when the field name contains score, confidence, probability, ratio or threshold, or when they are not whole numbers. A ruleResults array is listed rule by rule under each rule's name (or Rule 1, Rule 2, and so on). A model named barcode ocr, in any letter case, is not shown.
Output
This node does not send messages. The output port is never used.
Status and errors
No group configured: logged when the node has no group. The widget is not shown.
Usage example
A function node triggered by a click in another widget (so msg._client points to that browser). It opens the dialog with the class as title, then sends the images of that class:
const open = {
_client: msg._client,
class: "scratch",
payload: { showDialog: true }
};
const images = {
_client: msg._client,
payload: [
{
id: "1742547441440",
name: "1742547441440",
date: 1742547441440,
result: "NOK",
isAnomalous: true,
imageShow: {
raw: {
imageData: "/images/1742547441440_raw.jpg",
imageDataThumbnail: "/images/thumbs/1742547441440_raw.jpg",
bbox: [
{ x_rel: 0.42, y_rel: 0.31, w_rel: 0.08, h_rel: 0.05, tag: "scratch", score: 0.93 }
]
}
},
resume: {
defects: { result: "NOK", score: 0.93, minScore: 0.5 }
}
}
]
};
return [[open, images]];Both messages leave on the same output, in that order, so the images arrive once the dialog is open.