Reorient stitched ViT mosaic canvas before Tiled upload (#50)#56
Draft
Garrett Bischof (gwbischof) wants to merge 1 commit into
Draft
Reorient stitched ViT mosaic canvas before Tiled upload (#50)#56Garrett Bischof (gwbischof) wants to merge 1 commit into
Garrett Bischof (gwbischof) wants to merge 1 commit into
Conversation
The stitched mosaic was uploaded in the raw stitching frame, which doesn't match the beamline display convention (top→bottom, left→right). Reorient the canvas just before the Tiled write. - MosaicWriterOp: apply a D4 (config mosaic_orient, default 'antitranspose' = rot90_ccw then horizontal flip, per the issue) to both the phase and amplitude canvases with ptychoml.apply_d4 right before write_vit_mosaic / write_vit_amp_mosaic. 'identity' short-circuits to a no-op. It's a presentation transform on the final array: pixel_size_m is scalar (transpose-invariant); canvas_origin_um is passed through unchanged. (patch_vit_mosaic is dead — the staircase fix made every write full-canvas — so only the full writes need handling.) - ptycho_holo: wire mosaic_orient from config (validated against D4_NAMES). - config_from_tiled: --mosaic-orient flag (default antitranspose), emitted. - Tests: default antitranspose == rot90_ccw∘hflip (the issue's spec); shape swap; identity no-op; involution; config flag default/override/round-trip. - Docs: AGENTS.md config-field row + orientation note. Closes #50.
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.
Closes #50.
Summary
The stitched ViT mosaic was uploaded to Tiled in the raw stitching frame, which doesn't match the beamline's display convention (top→bottom, left→right). This reorients the canvas just before the upload.
MosaicWriterOpnow applies a D4 (ptychoml.apply_d4) to both the phase and amplitude canvases right beforewrite_vit_mosaic/write_vit_amp_mosaic. The reorientation is a config field,mosaic_orient, defaultantitranspose— which is exactly the issue's "rotate 90° CCW, then horizontal flip" (asserted in a test).identityuploads the canvas in the raw stitching frame.Notes
pixel_size_mis a scalar (transpose-invariant), andcanvas_origin_umis passed through unchanged (it refers to the stitching-frame reference). See the positions/overlay caveat above.patch_vit_mosaic(the incremental bbox path) is dead — the staircase fix made every write a full-canvaswrite_vit_mosaic— so only the full writes needed handling.Behavior change
The default flips the uploaded mosaic orientation. Set
mosaic_orient=identityto keep the old stitching-frame upload.Tests
tests/test_mosaic_orient.py(pure numpy): defaultantitranspose==rot90_ccwthenfliplr(the issue's spec); shape swap;identityno-op; involution;--mosaic-orientflag default/override + JSON round-trip. Full suite: 127 passed (2 pre-existingtest_smoketiled-server failures).