Repository navigation
PP-1: the axis check (swaps and contradictions are errors; plain stacks confirmed) - #64
Merged
Merged
Conversation
…radict_header review_axes now compares every TIFF's confirmed roles with the axes its own header names (header_axis_issue / axis_disagreements on named_axes). A plain stack whose metadata does not name an axis longer than 1, roles that swap the named Y and X, and roles that otherwise contradict the header are errors that name every file with its header and confirmed axes and recommend saving the images as OME-Zarr. Nothing is read transposed or under a contradicted declaration; OME-Zarr images take their NGFF roles and never fail. Masks are compared with their image's Y and X by the confirmed roles (mask_size_issues; find_masks compared with the header's letters), and the mask size and plane checks skip images with an axis error (B1). The notebook marks each role that disagrees with the header before confirmation and shows "Axes checked" on success; check and run print the same. check_declared_axes and declared_axes_transposed are deprecated (removed in v0.5.0). Contract §2/§8/§15/§16, user guide, plan §12 Q45. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
…rors Revised design after the audit (owner decision of 1 November 2026): - axes_not_named is a warning, not an error. A plain stack is read with the roles the user confirms, and AxisReview.axes_from records each file as "confirmed" (plain stack) or "header". The warning recommends named-axis copies before segmenting in other tools. - axes_yx_swapped and axes_contradict_header stay errors. They now name the likely cause (likely_axis_cause: tifffile's CYX default for 3-D stacks saved with imagej=True or ome=True, an ImageJ slice stack read as Z, or rows and columns exchanged) and give two fixes: correct the axes, or convert to named-axis copies. - The notebook shows the three codes as one "Axis check" card. A role on an unnamed axis is marked as "recorded as yours" rather than as an error. The success message stays and names the confirmed plain stacks. - AXIS_ERROR_CODES now holds the two errors; AXIS_CHECK_CODES holds all three. - B1 is kept: mask sizes are compared by the confirmed roles, which still matters for plain stacks. Docs: contract §2/§8, user guide, plan §12 Q45, AGENTS.md, notebook text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
…o modules The code quality rules for v0.4 are focused modules, no growth of oversized files, and NumPy docstrings on every function. So: - axis_check.py: the axis-check codes, header_axis_issue, axis_disagreements, likely_axis_cause, axis_check_issues and check_header_axes (axes.review_axes calls it). - notebook_axes.py: axis_check_html and header_marks. - mask_checks.py: mask_size_issues and mask_issues (moved from masks.py and run.py). No behaviour change. The names stay exported from the package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
The axis errors told users to run `morphobricks-preprocessing convert`, a command that does not exist yet (conversion is design v0.4 §5, PP-11), and the contract cited a §17 that does not exist. The plain-stack warning, the notebook and the user guide said the run manifest records the roles as confirmed, but manifest version 1 has no axes_from field (manifest v2 is PP-4). The messages now name only what exists; tests check both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
check_declared_axes and declared_axes_transposed are removed in v0.4.0 (design v0.4 revision 4, §6 and PP-2), so the deprecation warning, the docstrings, AGENTS.md, the contract, the user guide and plan Q45 no longer promise them until v0.5.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
guijacquemet
pushed a commit
that referenced
this pull request
Nov 1, 2026
PP-0 now merges after #64 (PP-1). Its baseline covers the combined code, so main stays green whichever PR is reviewed first. It adds layers for #64's modules: axis_check and mask_checks are pure, notebook_axes is ui. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
guijacquemet
marked this pull request as ready for review
November 1, 2026 11:59
Contributor
Author
|
Independent review against design v0.4 revision 4 (§3 Axes, §9), merged as d7a538e (merge commit). Fixes made during review:
Not fixed here, left to PP-4: audit-2 B-1. Roles are still applied by arrangement, so one plain-stack confirmation covers every file of that arrangement, and The gate at
Generated by Claude Code |
guijacquemet
pushed a commit
that referenced
this pull request
Nov 1, 2026
The baseline is regenerated on the new main: the review commit 5f9b015 adds a line to axes.py. PP-0 creates the baseline, so it records main as it is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
guijacquemet
pushed a commit
that referenced
this pull request
Nov 1, 2026
Conflicts in the docs, axes.py and the header-axes tests were resolved hunk by hunk with this PR's removals. The review commits' other edits are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
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.
PP-1 of the v0.4.0 preprocessing plan (
preprocessing-design-v0.4.md, revision 4, frozen; §3 "Axes" and §8). It covers the axis check only. The removals, manifest v2, per-file confirmation, masks, modes and conversion come in PP-2 onward.Summary
axis_check.py(new module, pure):header_axis_issue,axis_disagreements,likely_axis_causeandcheck_header_axescompare each TIFF's confirmed roles with the axes its header names (named_axes), position by position.axes_yx_swappedandaxes_contradict_headerare errors. Each error names every file with its header axes and confirmed roles, plus the likely cause. The causes it can name are:CYXdefault for 3-D stacks saved withimagej=True/ome=True;Each error offers two fixes: correct the axes, or save named-axis copies (OME-TIFF) with your roles. Such an image is never read, either transposed or under a contradicted declaration.
axes_not_namedis a warning. A plain stack (IYX,QYX) is read with the confirmed roles and recorded asAxisReview.axes_from[path] == "confirmed"; every other image is"header". The warning recommends named copies before segmenting.These are not errors: S→C, length-1 axes without a role, and OME-Zarr images (they take their NGFF roles).
AXIS_ERROR_CODESholds the two errors andAXIS_CHECK_CODESholds all three.axes.py:review_axesruns the check.AxisReviewgainsaxes_from,axis_errors,axis_check,axis_error_files,confirmed_filesandonly_axis_errors.POSITION_AXESmoved toaxis_check.mask_checks.py(new module):mask_size_issuescompares a mask's Y/X with its image's Y/X by the confirmed roles, not the header letters (this matters for plain stacks).mask_issuesgathers a run's mask issues and skips images with an axis error.masks.mask_plane_issues(skip=)supports that skip.find_maskscompares sizes only when the header names Y and X.notebook_axes.py(new module): shows the three codes as one "Axis check" card. Before confirmation, each role that disagrees with the header is marked, and an unnamed axis is marked "recorded as yours". On success the notebook says "Axes checked: they are correct for every image". Confirmation is disabled while there are errors.checkandrunprintaxis_check_summary("Axes checked: …") or the axis-check issues.checkexits 1 on axis errors.check_declared_axesanddeclared_axes_transposedraise aDeprecationWarning. They are removed before the v0.4.0 release (PP-2, design §6).Scope note: audit-2 B-1 is not fixed here
Roles are still applied by arrangement:
review_axesandfile_mapping_forgive every file with the same axes the one experiment mapping. So a confirmation for a plain-stack arrangement covers every file of that arrangement, including files added later.axes_fromis kept only inAxisReviewand is not yet written to the run manifest (still version 1). Both are PP-4: manifest v2 with per-fileroles/axes_from, plus per-file plain-stack confirmation.Decisions
unassigned_axis.Notes for review
Review (independent agent)
Two review commits:
5f9b015: the axis errors named amorphobricks-preprocessing convertcommand that does not exist yet (PP-11), and the contract cited a non-existent §17. The plain-stack warning, the notebook and the user guide claimed the run manifest recordsaxes_from, but manifest v1 has no such field. The messages now name only what exists, and the tests assert both points.b284034: the deprecation text promised removal in v0.5.0. Spec revision 4 removes the functions in v0.4.0 (PP-2).§9 metrics:
axis_check.pyis 300 lines,mask_checks.py102 andnotebook_axes.py99.axis_check_issues, with 45 non-blank lines and complexity 8.axes.py: 777 → 867 lines;review_axesbody 97 → 108 lines (complexity 14).cli._check: 46 → 52 lines;notebook_ui._toggle_confirmation: 25 → 48 lines.Tests
tests/test_axis_check.pywith 60 tests. Against old main it fails at import. With the new names stubbed:test_the_codes, which passes only because of the stub, and 2 controls of unchanged behaviour.ruff check .,ruff format --check .,pytestwith.[dev,notebook,zarr]) atb284034:🤖 Generated with Claude Code
https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a