From 435ebb9741c39e8da39910d658186d835728e9ce Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 7 Oct 2026 20:17:57 +0000 Subject: [PATCH] ShapesOut: outlines as annotations (holes and parts kept, numeric properties as measurements, Replace); GUI test body Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Y2SN8SuEakTdiWy3F2WUqN --- .../qupath/LabConstrictorTools.groovy | 54 ++++++++++++++ tests/gui_test_shapes_body.groovy | 71 +++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 tests/gui_test_shapes_body.groovy diff --git a/src/main/resources/org/cellmigrationlab/labconstrictor/qupath/LabConstrictorTools.groovy b/src/main/resources/org/cellmigrationlab/labconstrictor/qupath/LabConstrictorTools.groovy index 56e48d8..6a24a3c 100644 --- a/src/main/resources/org/cellmigrationlab/labconstrictor/qupath/LabConstrictorTools.groovy +++ b/src/main/resources/org/cellmigrationlab/labconstrictor/qupath/LabConstrictorTools.groovy @@ -972,6 +972,9 @@ class LcDialog { case "points": box.children.addAll(boldLabel((r.name ?: "points") + " (points)"), new Label(placePoints(appName, r)), tableView(r.path as String)) break + case "shapes": + box.children.addAll(boldLabel((r.name ?: "shapes") + " (outlines)"), wrapped(placeShapes(appName, r))) + break case ["image", "labels"]: def open = new Button("Open in QuPath") def path = r.path as String @@ -1031,6 +1034,57 @@ class LcDialog { return xs.size() + " point(s) added to the open image as the annotation '" + name + "'." } + static Label wrapped(String text) { + def l = new Label(text) + l.wrapText = true + return l + } + + static final int MAX_SHAPES = 50000 // outlines added to the image; the rest are counted in the message + + /** Outlines (GeoJSON Polygon / MultiPolygon, [x, y] with pixel centres at integers) become annotations named ":