Promote CellProfiler parity and accelerated backends#60
Draft
trissim wants to merge 895 commits into
Draft
Conversation
Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
Advance ObjectState to the edit-session snapshot boundary used by UI/MCP code-mode edits. Advance PyQT-reactive to the generic object form renderer and typed table browser contracts that keep OpenHCS widgets thin. Advance ZMQRuntime and PolyStore to the shared viewer spatial metadata, force-stop, ROI, and stream transport contracts used by Napari/Fiji streaming. Keep these pointer updates isolated from OpenHCS source changes so downstream bisects can distinguish submodule API adoption from parent integration work.
Add reusable CellProfiler installation and dataset-cache helpers so benchmark runs resolve native CellProfiler and cached example data through explicit infrastructure instead of ad hoc environment assumptions. Teach the comparison manifest and runner paths to carry the scoped official30 benchmark shape used by current parity checks, including the 3D monolayer first-two-wells reference case. Commit the 3D monolayer two-well native reference outputs needed to re-run the parity baseline after /tmp loss without rerunning CellProfiler on this workstation. Add focused benchmark/acquisition tests covering traceback capture, manifest acquisition metadata, dataset cache plumbing, and compatibility helpers. Validation evidence before commit: official30 was run in five shards under /tmp/openhcs_official30_parity_shards with 30/30 equivalent, total difference_count=0, min parity_accuracy=1.0, and no native/OpenHCS failures.
Introduce nominal authorities for source metadata, source path identity, source-image provenance, source-plane alignment, source-spatial domains, and virtual workspace projection so runtime artifact identity is derived from declared source semantics instead of local filename or component heuristics. Add source binding selection/rebasing and source identity stack-axis handling so non-anchor image operands can be resolved from the source universe while execution anchoring remains separate from required source operands. Refactor FunctionStep runtime artifact routing around compiled invocation keys, runtime-plane projection policy, output identity/materialization manifests, and fail-loud runtime value/source metadata contexts. This includes the central fix that grouped execution only projects runtime planes when the group axis is a declared source-stack axis. Move measurement feature queries, row materialization, image alignment, runtime slice projection, and object-label/source provenance handling into core authorities that can be shared by CellProfiler runtime, materialization, and equivalence code. Add/update focused unit coverage for callable contracts, function patterns, runtime values, source schema workspaces, artifact materialization, runtime-plane projection, and source binding rebasing.
Extract analysis consolidation, compiled plate execution, worker lane planning, and worker execution into explicit orchestrator modules so compile/run semantics no longer depend on one monolithic orchestrator class. Move lane progress, execution result transport, compilation session source-identity metadata, and path planning materialization policy into typed authorities shared by direct execution and ZMQ runtime. Update compiler, lane planning, path planning, and ZMQ orchestrator environment tests around source identity stack axes and materialization policy.
Break the CellProfiler runtime adapter and module execution path into nominal authorities for artifact binding, source candidates, current-image context, measurement materialization, output recording, runtime-plane kwargs, processing contracts, pure-2D aggregation, and relationship/object measurement rows. Keep generated pipeline/runtime contracts explicit so source image operands, module artifacts, and runtime-owned outputs are resolved through shared contracts instead of local adapter branches. Preserve source identity stack axes and multi-input provenance through generated source schemas and symbol table declarations, including the runtime-plane projection fix validated by 3D Monolayer parity. Update generated pipeline, source schema, adapter, and module execution tests around the decomposed runtime authority boundary.
Update CellProfiler-compatible image math, illumination, intensity, intensity distribution, shape, texture, thresholding, watershed, secondary object, and related backend kernels around the shared runtime contracts. Keep module-specific behavior in backend/module declarations while letting the runtime own source, artifact, and measurement routing. Refresh benchmark shim functions and focused backend/library tests for the official30 parity surface.
Move measurement row, fact, key, object-label, and relationship comparison into explicit equivalence authorities so benchmark parity is no longer concentrated in the runtime equivalence module. Align runtime equivalence and CellProfiler Analyst export planning with the canonical measurement row materialization model used by official30 parity checks. Update equivalence package tests around the decomposed comparison semantics.
Extend agent DTOs, capability discovery, execution session services, viewer window services, UI bridge transport, and MCP server capabilities for bounded execution, viewer, code-document, snapshot, and window-state access. Route Napari and Fiji streaming through shared viewer component/protocol semantics and fail-fast ZMQ client/server contracts so viewer payload axes and layer state are inspectable without raw UI internals. Update agent, MCP, progress, streaming, viewer, ZMQ, and UI bridge tests for the new service boundary.
Refactor plate manager, pipeline editor, compile/run/debug workflows, progress presentation, image browsing, and widget action dispatch into shared service boundaries. Use shared edit-commit and batch-context helpers so widget classes stay thinner and code-mode state can remain synchronized with UI workflow actions. Update PyQt workflow, bridge lifecycle, status presenter, recorded workflow, and Textual function selector tests around the refactored workflow boundary.
Move microscope source schema/path matching and materialization utilities into explicit microscope and processing/materialization authorities, removing obsolete function-argument and detect-mixin helper modules. Update backend registry and function registry call sites to use the centralized contracts instead of duplicated low-level helpers. Refresh BioFormats, synthetic-data, and materialization tests around the consolidated registry/materialization behavior.
Update CellProfiler Analyst export integration, generator declaration query refactor, robust streaming refactor, and paper audit notes to match the current source/runtime/viewer architecture. Keep architecture and paper-review documentation separate from runtime source commits so implementation history remains bisectable.
Centralize source-image provenance, runtime slice projection, source binding caches, runtime stack caches, and artifact materialization identity so converted CellProfiler pipelines preserve source plane semantics through images, labels, tables, and viewer payloads. Extend CellProfiler-compatible execution with runtime profiling hooks, stricter output recording requests, source candidate reuse, label geometry kernels, object measurement domain handling, and faster native backend paths for thresholding, intensity, shape, colocalization, illumination, median filtering, watershed, and related parity-critical modules. Improve viewer streaming and MCP validation by carrying component-axis semantics through Napari/Fiji state, exposing payload summaries, coordinate coverage, aggregate payload coordinates, and spatial compatibility checks, and updating MCP DTO/capability metadata for those contracts. Update benchmark adapters and comparison validation for official CellProfiler pipelines, add focused tests for runtime projection, source spatial domains, stream component semantics, materialization, FunctionStep execution, MCP viewer validation, and CellProfiler parity/speed behavior. Update PolyStore to 0d42ad10cc468141e130adfb751806226377090f and zmqruntime to 9d372cf0e9c4ab192e021e28bfdbe588544a08b3 for viewer wire normalization and force-stop viewer cleanup. Validation: git diff --check; PolyStore focused streaming/ROI tests 19 passed; zmqruntime viewer protocol/state tests 4 passed; OpenHCS focused MCP/viewer/source/runtime tests 245 passed; CellProfiler runtime/processing/comparison tests 396 passed before final alias cleanup and 380 passed after; runtime/source/MCP retest 175 passed after cleanup; advisor scan on production MCP/viewer/source/runtime files completed with broader runtime_values/source-authority debt noted but no local correctness blocker. Local generated artifacts are ignored: advisor caches, root .zgroup, temporary ZMQ probe scripts, and Napari streaming validator workspaces.
Add fail-soft MCP bootstrap for stdio startup failures, expose typed MCP health/source freshness, and make normal tools fail fast when the running MCP process is stale. Broaden source freshness coverage to the OpenHCS agent context service modules, path policy, bridge transport, and viewer control helpers so Codex sees stale-process state instead of hanging or serving old behavior. Expose agent-friendly UI bridge controls: selected PlateManager init/compile/run workflow, code-document apply snapshot/revision/undo metadata, generic widget-tree projection backed by pyqt-reactive, and centralized UI bridge gateway dispatch for descriptor resolution and unavailable/error handling. Expose viewer-agnostic payload inspection and validation contracts for per-layer/per-axis arrays and shape payloads, with shared request/result carriers for viewer control calls and Napari/Fiji payload extraction. Preserve CellProfiler runtime callable contracts in pycodified source so pycodified sessions do not need hidden rebinding for contracts. Document MCP development modes: stable control-plane MCP versus active-checkout MCP, Codex stdio restart limits, stale-source behavior, and path-policy environment roots. Include focused tests for MCP stdio roundtrips, bootstrap failure transport survival, stale server behavior, UI bridge workflows, widget-tree projection, viewer payloads, and CellProfiler transport contracts.
Add a package-backed dev client that launches a fresh OpenHCS MCP stdio server from the active checkout for each command, so MCP/UI testing no longer depends on Codex refreshing its attached server process. Expose the client as openhcs-mcp-dev, document the current-checkout workflow, and cover argument parsing plus fresh health roundtrips in unit tests. Fix UI window operation routing by normalizing UiWindowOperationRequest values back to UiWindowIdentity before comparing against catalog routes, so listed embedded panes such as plate_manager can be snapshotted and projected through the widget-tree API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
This PR promotes the CellProfiler compatibility path from benchmark-only smoke execution into a broader OpenHCS runtime compatibility layer with explicit runtime semantics, output equivalence, accelerated backends, parity tracking, and expanded generated-pipeline coverage.
Audit
Runtime and equivalence semantics
CellProfiler module compatibility
.cppipeconversion and binding coverage for alignment, color conversion, image math, mask objects, smooth, enhance edges, expand/shrink, filter objects, classify objects, illumination, object measurements, object relationships, and tracking.Explicit accelerated backends
openhcs.processing.backends.cellprofilermodules for alignment, classification, colocalization, illumination, image quality, intensity, intensity distribution, morphology, neighbors, outlines, region properties, relationships, secondary objects, shape, texture, thresholding, tracking, watershed, and Zernike calculations.numbaa required dependency and declares CellProfiler compatibility extras separately.Benchmark tracking and tests
.cppipesuites.Verification
Ran with the sibling OpenHCS virtualenv:
Result:
Follow-up Work
.cppipedialect compiler out of benchmark ownership into a product-facing OpenHCS interop/dialect package so benchmark, CLI, and PyQt consume the same canonical conversion service..cppipeloading alongside.py: compile.cppipeinto a normal OpenHCSPipeline, show generated OpenHCS code/form state, and expose source-schema/provenance mapping instead of a black-box CellProfiler runner.