Skip to content

ShapesOut: outlines as GeoJSON, with a labels_to_shapes helper - #31

Merged
guijacquemet merged 1 commit into
mainfrom
claude/shapes-out
Oct 7, 2026
Merged

guijacquemet merged 1 commit into
mainfrom
claude/shapes-out

Conversation

@guijacquemet

Copy link
Copy Markdown
Contributor

Wave 1, item 3 (decisions: GeoJSON, 50 000 outline host limit, helper in Tools; spec in #27). Adds the ShapesOut output type: a tool returns a GeoJSON FeatureCollection, or a list of polygons (arrays of (y, x) vertices, or dicts with polygon plus properties); the worker writes <name>.geojson and the result is {type: "shapes", name, path, n, apply_to?}. Coordinates are [x, y] with pixel centres at integers, like points. Only Polygon and MultiPolygon are accepted; bad input (non-finite, fewer than 3 vertices, wrong shape, other geometry types) fails with a readable message. Replace() and ApplyTo work on it.

labconstrictor_tools.shapes.labels_to_shapes(labels, simplify=0.5, min_area=1) traces a 2D label image: one feature per label (Polygon, or MultiPolygon for several parts), holes kept, properties label and area. It needs scikit-image and scipy (the app's, not a Tools dependency). Also: testing validates shapes results ({"features": n}), the notebook form lists them, docs updated (PROTOCOL, MANIFEST, AUTHORING recipes, HOST_FEATURES rows "planned"), and the example app has an "Outline the blobs" tool (labels + outlines + message).

Tests: 13 new (writing, refusals, helper: holes, parts, areas, centres at integers, empty, many labels). The helper tests skip without scikit-image. Full suite passes except the root-only test_foreign_owned... (also fails on main). I also ran the example tool through the real worker: 17 blobs, valid GeoJSON.

Hosts that do not know shapes list the file, so nothing breaks before the host PRs.

Next: Napari (shapes layer), Fiji (polygon ROIs), QuPath (annotations).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y2SN8SuEakTdiWy3F2WUqN


Generated by Claude Code

… testing, docs, example tool, tests)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2SN8SuEakTdiWy3F2WUqN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants