Expose public digitize_to_stitches() returning regions + stitch objects without writing a file #75
Labels
No labels
blocked:children
blocked:depends-101
blocked:depends-103
blocked:depends-104
blocked:needs-attention
blocked:needs-decision
blocked:no-changes
blocked:preflight
bug
chore
feature-request
in-progress
lint-cleanup
needs-decompose
performance
quality
quickfix
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/easystitch#75
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Mark/easystitch-servicewrapsEmbroideryPipeline.process_bytes()to serve an HTTP API. The service contract (seeMark/Kimi_Agent_Brother_10_Digitizing_App#11andMark/easystitch-service#1) requires/v1/digitizeto return:The pipeline currently returns
output_bytes(the machine file) but discards the structured regions and stitch points after writing the file. The service has to call a private method (_generate_stitches_from_paths) and re-derive the structured output itself — fragile and leaks implementation.Goal
Add a public method on
EmbroideryPipelinethat runs the raster->vector->semantic-annotate->stitch-generate stages and returns the structured result, without invoking the format emitter or writing a file.Proposed API
The dataclass shapes can mirror
Mark/easystitch-service/models.py(Region, StitchObject, DigitizeStats) so the service translates them 1:1.Implementation
Refactor
_emit_machine_file()insrc/main_pipeline.py:_build_stitches(svg_content, settings) -> list[StitchObject]._build_regions(stitch_intents) -> list[Region]— derive regions fromstitch_intents(polygon + color + stitch_type).digitize_to_stitches()that runs stages 1-4, builds regions + stitch objects, returnsDigitizeResult._emit_machine_file()to call_build_stitches()instead of duplicating the logic.Acceptance
digitize_to_stitches(png_bytes, settings)on a 1024x1024 PNG returnsDigitizeResultwith non-emptyregionsandstitch_objects.tests/test_main.pycovers the new method.process_bytes()API is unchanged.Blocks
Mark/easystitch-service#1(FastAPI wrapper) — can't return the structured shape until this lands.Mark/Kimi_Agent_Brother_10_Digitizing_App#6, #8, #9, #10, #2— all need/v1/digitizeto return regions + stitch objects.Notes
_emit_machine_file()currently branches onfrom_rasterand uses a placeholder stitch generator for raster inputs. Separate issue #3 (raster path uses placeholder stitches) tracks that._emit_machine_file()— separate issue #2 (thread settings through pipeline) tracks that.