Skip to content

[Audit/Correctness] Dataset size/plane-count warnings ignore confirmed axes of plain TIFF stacks #74

Closed

Description

@guijacquemet

Scope

Sad Catapella adversarial audit, Batch 2, main at d7a538e. Confirmed source-level consistency defect; synthetic end-to-end test not executed.

Evidence

  • named_axes() correctly acknowledges that Y and X letters in an unnamed multi-page TIFF QYX/IYX are not scientifically binding.
  • But _check_image_sizes() always compares the raw header's Y and X dimensions, and _plane_counts() counts Q/I as extra planes.
  • AxisReview.combined_issues() only replaces missing_axes, inconsistent_dimensions and different_channel_counts from metadata. It keeps the old different_sizes and different_plane_counts warnings after roles are confirmed; run_experiment() uses that merged report.
  • Existing tests explicitly permit an unnamed QYX TIFF to be confirmed as YXC, but size tests only exercise header-named axes.

Concrete failing scenario

Two plain TIFF arrays, stored without axes metadata, have shapes (16,16,3) and (32,16,3); tifffile may expose them as QYX (as tested for plain 3D stacks). The user legitimately confirms AxisMapping('QYX','YXC'). The real images differ in confirmed Y height (16 versus 32) and have the same X width and C=3. _check_image_sizes instead compares the header positions as (Y=16, X=3) in both, missing the real size discrepancy. _plane_counts reports a change in 'planes along Q' (16 versus 32) even though Q now means Y, not an independent plane axis.

Impact

Scientific QC messages can be absent or falsely classified after legitimate role confirmation, especially in microscope exports with unspecified axes. Histograms still use confirmed mapping; the immediate defect is inaccurate experimental validation and misleading advice, not proven pixel misreading.

Fix and acceptance

Run the size and plane-count checks again against each file's confirmed role mapping during review_axes or as a post-review dataset check, superseding preflight-only raw-header versions. Use per-file Y/X, Z/T and C roles; retain explicit warnings for genuinely unknown/unconfirmed axes, and never guess. Add cases for QYX→YXC, IYX→TYX, different X/Y/T/Z lengths, and mixed TIFF/Zarr order. Assert warnings include the correct dimensions and image paths, with no duplicated stale messages.

Performance: cache per-file role resolution rather than recomputing metadata statistics repeatedly. Numba does not help.

Activity

  1. added 2 commits that reference this issue on Nov 2, 2026
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