Enhance image processing and orientation detection in holoptycho#37
Draft
Himanshu Goel (himanshugoel2797) wants to merge 3 commits into
Draft
Enhance image processing and orientation detection in holoptycho#37Himanshu Goel (himanshugoel2797) wants to merge 3 commits into
Himanshu Goel (himanshugoel2797) wants to merge 3 commits into
Conversation
- Updated ImagePreprocessorOp to include configurable geometry and normalization parameters for output branches. - Introduced auto-detection of dp_orient in the new detect_orientation.py script. - Modified PtychoApp to support new orientation parameters and normalization settings. - Improved handling of patch flipping in SaveViTResult for better output consistency.
- Added h5py dependency to pixi.toml for HDF5 file handling. - Introduced `dump_scan_h5.py` script to export Tiled scans to HDF5 format, including preprocessing steps and metadata attributes. - Updated `config_from_tiled.py` to auto-detect `panda_upsample` and `vit_normalization`, enhancing scan configuration. - Enhanced argument parsing in `replay_from_tiled.py` to allow configuration of parallel fetch workers for improved performance. - Improved error handling during frame fetching to retry on transient HTTP timeouts. - Adjusted default number of workers for tiled fetches to optimize throughput and prevent connection timeouts.
Garrett Bischof (gwbischof)
added a commit
to NSLS2/ptychoml
that referenced
this pull request
Jun 5, 2026
Move the generic ViT patch-placement algorithms out of holoptycho/mosaic_stitch.py into a new ptychoml.stitch module so they can be shared instead of duplicated. Three placement strategies: - place_patches_fourier_shift / stitch_batch_into: sub-pixel Fourier-shift - stitch_batch_livestitch_into: nearest-integer + touched bounding box - stitch_batch_nearest: plain nearest-integer, edge-clamped Pure numpy + scipy.fft; depends only on fourier_shift from preprocess. Exported via __init__ __all__, covered by tests/test_stitch.py (12 cases: placement, accumulation, counts footprint, livestitch bbox, edge clamping, up-down flip, fourier-vs-nearest parity, per-batch associativity), and documented in README + AGENTS.md. First step of breaking NSLS2/holoptycho#37 into focused PRs: holoptycho will re-export these under their original names (zero behavior change). Co-authored-by: Himanshu Goel <4122621+himanshugoel2797@users.noreply.github.com>
This was referenced Jun 5, 2026
Garrett Bischof (gwbischof)
added a commit
that referenced
this pull request
Jun 8, 2026
ptychoml renamed PtychoViTInference's 'data_is_shifted' parameter to 'fftshift' (None = auto-detect DC via detect_dc_at_corner). holoptycho main still called PtychoViTInference(data_is_shifted=...), which raises TypeError against the pinned ptychoml (the bump in #38 crossed the rename) — the ViT op would crash on its first batch. Smoke tests missed it: the vit_inference import dies earlier on TILED_BASE_URL, and CI envs skip holoscan entirely. Rename PtychoViTInferenceOp's param data_is_shifted -> fftshift and pass fftshift= to the session; drop data_is_shifted=True in ptycho_holo.py and let it default to None (auto-detect), matching PR #37's end-to-end DC handling that pairs with this PR's preprocess_diffraction(fftshift=fftshift_dp=None). Adds tests/test_vit_session_contract.py to pin the holoptycho<->ptychoml call contract so a future rename fails in CI instead of on the beamline. Co-authored-by: Himanshu Goel <4122621+himanshugoel2797@users.noreply.github.com>
This was referenced Jun 8, 2026
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.
Very preliminary developments.