Thread max_colors from API request through pipeline to raster quantizer #104

Closed
opened 2026-07-29 16:41:53 +00:00 by Mark · 0 comments
Owner

Goal

Wire the max_colors setting from the POST /v1/digitize API request all the way through the pipeline to the new raster quantizer added in ch1. Currently, max_colors is passed to PhysicalOptimizer but not to the raster/vector stage.

Approach

  1. Add max_colors to the pipeline config/context object passed from the API handler through main_pipeline.py.
  2. Extract max_colors from the digitize request settings in src/service/handlers/digitize.py.
  3. Pass it through src/pipeline_api.py and src/main_pipeline.py to src/raster/raster_converter.py.
  4. Ensure the raster quantizer receives and applies the value.

Acceptance Criteria

  • max_colors from POST /v1/digitize settings reaches the raster quantizer
  • Default value (8) is used when not specified
  • PhysicalOptimizer still gets max_colors as before (backward compat)
  • End-to-end: POST /v1/digitize with max_colors=4 produces ≤4 thread colors
  • No new lint errors

Files touched

  • src/service/handlers/digitize.py
  • src/main_pipeline.py
  • src/pipeline_api.py
  • src/raster/raster_converter.py

Decomposed from Mark/easystitch#101

## Goal Wire the `max_colors` setting from the `POST /v1/digitize` API request all the way through the pipeline to the new raster quantizer added in ch1. Currently, `max_colors` is passed to `PhysicalOptimizer` but not to the raster/vector stage. ## Approach 1. Add `max_colors` to the pipeline config/context object passed from the API handler through `main_pipeline.py`. 2. Extract `max_colors` from the digitize request settings in `src/service/handlers/digitize.py`. 3. Pass it through `src/pipeline_api.py` and `src/main_pipeline.py` to `src/raster/raster_converter.py`. 4. Ensure the raster quantizer receives and applies the value. ## Acceptance Criteria - [ ] `max_colors` from `POST /v1/digitize` settings reaches the raster quantizer - [ ] Default value (8) is used when not specified - [ ] `PhysicalOptimizer` still gets `max_colors` as before (backward compat) - [ ] End-to-end: `POST /v1/digitize` with `max_colors=4` produces ≤4 thread colors - [ ] No new lint errors ## Files touched - `src/service/handlers/digitize.py` - `src/main_pipeline.py` - `src/pipeline_api.py` - `src/raster/raster_converter.py` --- _Decomposed from [Mark/easystitch#101](https://forgejo.tail018ac4.ts.net/Mark/easystitch/issues/101)_
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/easystitch#104
No description provided.