Skip to content

[Sad Catapella B6][Scientific calibration] Reused OME-Zarr copies are not checked for numeric pixel-scale correctness #92

Closed

Description

@guijacquemet

Scope and classification

Sad Catapella Batch 6; pinned main commit d7a538e56d41ac1093ba79adcad397c21b3dfd32. Confirmed source-path omission, with a concrete metadata-only counterexample; end-to-end tests were not run. Distinct from #87 (integrity of converted pixel chunks) and #88 (channel labels).

Evidence

Counterexample

  1. Convert TIFF with X=Y=0.25 µm/pixel to an OME-Zarr copy; save successful run/manifest.
  2. Edit .zattrs multiscales[0].datasets[0].coordinateTransformations[0].scale X from 0.25 to 0.5, retaining axes[*].unit, unknown_scale, source TIFF and channel labels.
  3. On an unchanged rerun with convert_tiffs=True, copy_units_current returns True, so the copy is reused with a false 0.5 µm/pixel scale.

Impact

Downstream physical distances, areas and speeds from the converted image can be wrong even though pixel data and histogram counts are correct. Particularly important because MorphoBricks downstream bricks use calibration for spatial features.

Fix / acceptance criteria

Have the copy validation compare the effective numeric scale on level 0 for every known physical axis to the source PhysicalSizes with an explicit tolerance policy, and validate expected scale factor 2^level on X/Y in all pyramid levels. Respect/verify unknown_scale markers; reject missing/nonfinite/misordered/incorrect transformations instead of guessing. Consider a cryptographic metadata fingerprint/generation marker as part of #87, but do not rely on unit equality. Add altered level-0 and level-1 scale fixtures, unknown units, valid times, mixed X/Y units and no-change control. No Numba role; metadata validation is low-cost.

Activity

  1. guijacquemet commented on Nov 2, 2026

    @guijacquemet
    ContributorAuthor

    Obsolete in v0.4.0: convert_tiffs, zarr_export and OME-Zarr copy reuse were removed in PP-2 (#66, commit 3c2802d; plan question 46). Named-axis copies of images with axis errors are now the OME-TIFF convert step (PP-11, #124, merged as 8db1f4a). Closing as not planned (owner-approved triage, 2026-11-02).

    PP-11's reuse compares the recorded pixel sizes and which sizes are unknown before reusing a copy.


    Generated by Claude Code

  2. guijacquemet commented on Nov 2, 2026

    @guijacquemet
    ContributorAuthor

    Reopening: an independent review of commit 8db1f4a found the closure premature. The planned pixel sizes are compared exactly (value, unit, source), but the persisted copy's calibration is only protected by size + mtime, and _plan() compares only the keys of unknown_sizes, not their recorded reasons. Fix: the copy's content hash (#87) covers the written calibration; compare unknown_sizes fully. Tracked in PR PP-11c.


    Generated by Claude Code

  3. guijacquemet commented on Nov 2, 2026

    @guijacquemet
    ContributorAuthor

    Fixed by PR #126, merged as 6ac81ad (fix commit 4312b5a). I checked in the code before closing:


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions