Skip to content

Promote CellProfiler parity and accelerated backends#60

Draft
trissim wants to merge 895 commits into
mainfrom
benchmark-platform
Draft

Promote CellProfiler parity and accelerated backends#60
trissim wants to merge 895 commits into
mainfrom
benchmark-platform

Conversation

@trissim

@trissim trissim commented Dec 19, 2025

Copy link
Copy Markdown
Collaborator

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

  • Adds CellProfiler measurement dialect normalization and equivalence policy wiring.
  • Expands runtime output equivalence for images, tables, measurements, reference artifacts, and cache-aware OpenHCS adapter comparisons.
  • Promotes runtime artifact query/export/value semantics so measurements, object labels, relationships, and image outputs are compared through typed runtime records instead of ad hoc file checks.
  • Adds source-schema workspace and source matching improvements so CellProfiler setup-module semantics map into OpenHCS components without filename smell heuristics.
  • Extends execution validation and runtime cache behavior to separate OpenHCS execution from external equivalence/materialization work.

CellProfiler module compatibility

  • Expands generated .cppipe conversion 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.
  • Adds typed settings modules for newly covered converter surfaces.
  • Improves module execution handling for object-measurement rows, source-image provenance, object-label domains, stack/slice alignment, and relationship payloads.
  • Fixes per-object measurement semantics where aggregate rows should not be padded as object rows, while preserving dense object-domain completion where required.

Explicit accelerated backends

  • Adds openhcs.processing.backends.cellprofiler modules 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.
  • Adds shared analysis-region-properties backend support.
  • Makes numba a required dependency and declares CellProfiler compatibility extras separately.
  • Keeps backend selection explicit through OpenHCS registry patterns; no silent backend fallback is introduced.

Benchmark tracking and tests

  • Adds a parity runner script for CellProfiler .cppipe suites.
  • Adds tracker docs for full-pass status, parity evidence, and backend optimization work.
  • Expands unit coverage for CP adapters, generated pipeline execution, library loading, module execution, runtime adapter behavior, source schema, symbol table/settings binding, runtime equivalence, artifact queries, runtime values, materialization, morphology, track objects, expand/shrink, measure granularity, intensity distribution, and backend strategy registries.

Verification

Ran with the sibling OpenHCS virtualenv:

../openhcs/.venv/bin/python -m pytest \
  tests/unit/test_cellprofiler_adapter.py \
  tests/unit/test_cellprofiler_generated_pipeline_execution.py \
  tests/unit/test_cellprofiler_library_loading.py \
  tests/unit/test_cellprofiler_module_execution.py \
  tests/unit/test_cellprofiler_runtime_adapter.py \
  tests/unit/test_cellprofiler_source_schema.py \
  tests/unit/test_cellprofiler_symbol_table.py \
  tests/unit/test_cppipe_execution_validation.py \
  tests/unit/test_cppipe_parser.py \
  tests/unit/test_image_file_serialization.py \
  tests/unit/test_materialization_core.py \
  tests/unit/test_runner_cellprofiler_compatibility.py \
  tests/unit/test_runtime_artifact_queries.py \
  tests/unit/test_runtime_equivalence.py \
  tests/unit/test_runtime_execution_validation.py \
  tests/unit/test_runtime_exports.py \
  tests/unit/test_runtime_values.py \
  tests/unit/test_settings_binder.py \
  tests/unit/test_source_matching.py \
  tests/unit/test_source_schema_workspace.py \
  tests/unit/test_cellprofiler_morphology.py \
  tests/unit/test_cellprofiler_processing_backend.py \
  tests/unit/test_cellprofiler_strategy_registries.py \
  tests/unit/test_cellprofiler_trackobjects.py \
  tests/unit/test_expandorshrinkobjects.py \
  tests/unit/test_measuregranularity.py \
  tests/unit/test_measureobjectintensitydistribution.py \
  tests/unit/test_runtime_semantics.py \
  -q

Result:

645 passed, 1 warning in 21.73s

Follow-up Work

  • Extract the .cppipe dialect compiler out of benchmark ownership into a product-facing OpenHCS interop/dialect package so benchmark, CLI, and PyQt consume the same canonical conversion service.
  • Integrate PyQt Code mode with .cppipe loading alongside .py: compile .cppipe into a normal OpenHCS Pipeline, show generated OpenHCS code/form state, and expose source-schema/provenance mapping instead of a black-box CellProfiler runner.
  • Add phase timing records for startup, setup, compile, execute, validation, equivalence, and cache/materialization phases, with graphable long-table output for OpenHCS vs native CellProfiler comparisons.
  • Continue replacing centrosome/scikit-image hot paths with explicit numba/CuPy-capable backend strategies while preserving CellProfiler semantics and avoiding silent fallbacks.

@continue

continue Bot commented Dec 19, 2025

Copy link
Copy Markdown

All Green - Keep your PRs mergeable

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts


Unsubscribe from All Green comments

@trissim trissim changed the title [DRAFT] Benchmark Platform for Nature Methods Paper [DRAFT] Benchmark platform and runtime artifact foundation Apr 25, 2026
@trissim trissim changed the title [DRAFT] Benchmark platform and runtime artifact foundation Promote CellProfiler parity and accelerated backends May 4, 2026
trissim added 30 commits June 17, 2026 22:39
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.
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.

1 participant