Skip to content

fix: prevent dark Show3D panels during playback - #224

Merged
bobleesj merged 2 commits into
electronmicroscopy:mainfrom
bobleesj:aug-12-show3d-color-playback
Aug 13, 2026
Merged

fix: prevent dark Show3D panels during playback#224
bobleesj merged 2 commits into
electronmicroscopy:mainfrom
bobleesj:aug-12-show3d-color-playback

Conversation

@bobleesj

@bobleesj bobleesj commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

What problem does it solve?

Show3D could apply one absolute stack-wide contrast range to mixed scientific panels such as phase, bright field, and dark field. During playback, temporal averaging, histogram interaction, or layout changes, this made valid panels appear black or white. Panel colormaps and live layout state could also become stale while playback continued.

This change makes multi-panel contrast independent by default. Auto contrast uses each panel's configured percentile range, and optional linked contrast synchronizes only relative handle movement while preserving panel-local numerical ranges.

What should reviewer(s) do?

Review the Show3D contrast and resident WebGPU paths in js/show3d/index.tsx, the per-panel LUT support in js/colormaps.ts, and the stable per-panel percentile ranges generated in src/quantem/widget/show3d.py.

In the browser regression tests, confirm that mixed Phase/BF/DF panels remain textured and unsaturated through play/pause, histogram dragging, moving average, colormap changes, hidden-panel restoration, and column changes.

Verification

  • npm run typecheck — passed.
  • npm run build — passed.
  • PYTHONPATH=src python -m pytest -q tests/show3d — 91 passed, 7 skipped.
  • QT_RUN_BROWSER_TESTS=1 PYTHONPATH=src python -m pytest -q tests/show3d/test_zoom_contrast_browser.py — 6 passed, 1 hardware-dependent headless skip.
  • Private real Phase/BF/DF fixture on macOS Chrome on Apple Metal WebGPU — passed Auto and independent histogram checks, play/pause, average 1→5→1, and columns 3→2→1 with no blank or saturated panels and no page errors.
  • Full PYTHONPATH=src pytest -q was run; three unrelated existing environment failures remain in CLI version provenance, an MPS backend mock, and a source-contract assertion that was updated and then passed independently.

This PR follows the scikit-package workflow for reproducible scientific software.

@bobleesj
bobleesj marked this pull request as ready for review August 13, 2026 04:43
@bobleesj
bobleesj merged commit 0c78fe0 into electronmicroscopy:main Aug 13, 2026
1 check passed
@bobleesj
bobleesj deleted the aug-12-show3d-color-playback branch August 13, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant