Skip to content

Show3D playback cost and touch control for every viewer - #252

Closed
bobleesj wants to merge 4 commits into
electronmicroscopy:mainfrom
bobleesj:sep/touch-resize-playback
Closed

bobleesj wants to merge 4 commits into
electronmicroscopy:mainfrom
bobleesj:sep/touch-resize-playback

Conversation

@bobleesj

Copy link
Copy Markdown
Collaborator

What problem does it solve?

Turning images into a page people can share or embed needed Python. This adds quantem-widget show2d / show3d (one lossless HTML page from files, a stack or a folder) and an agent recipe for it. It also adds a Show3D frame thumbnail strip for watching a recording (mode="stream"), Show2D color export, and true color on WebGPU in Show3D and Show2D.

Four commits:

  1. feat: CLI, thumbnail strip, color export, Export fixes
    • The console script is quantem-widget (was quantem; no alias). show2d and show3d take --save-dir, --encoding, --image-bin, --max-mb and --no-link-contrast.
    • Show3D thumbnails: thumbnails=, thumbnail_columns=1|2|3, or mode="stream", which Show3D.stream() opens in.
      • Square thumbnails touch, with no gaps.
      • They are drawn on the GPU from the resident frames, with no second full-size copy.
      • Hover shows a frame, click selects it, and the highlight follows playback.
    • Show2D exports color panels as true color (encoding="full").
    • An exported page re-saved from its Export menu kept no offline runtime and opened blank; it now opens. Exported Show2D pages list only the exports they can make.
  2. fix: quantem.gpu pin 2786134a; the ShowPtycho launch-table tests expect the Value and Source columns.
  3. display: true color on WebGPU. Show3D and Show2D draw true-color frames on WebGPU (they drew on the CPU canvas). Rebased onto the new canvas pooling in colormapEngine.ts: the RGB path now hands its canvas back through transferOffscreen.
  4. test: QUANTEM_WIDGET_WINDOW_POSITION places the headed browser-test window.

What should reviewer(s) do?

  • Check that js/show3d/index.tsx and js/display/colormapEngine.ts still match the WebGPU interactivity commits on main (41f71231..7d084aea). This branch was rebased onto them; only colormapEngine.ts and CHANGELOG.md conflicted, and both were resolved by keeping both sides.
  • Keyword names follow the vocabulary test: mode="stream", thumbnails, thumbnail_columns, --save-dir.

Verification

  • Python: 766 passed, 0 failed (conda env, quantem.gpu at gpu-ref.txt); the ShowPtycho, CLI, Show2D, Show3D and infrastructure tests were re-run after the last rebase.
  • JS: npx vitest run 392 passed; npx tsc --noEmit clean; the bundle builds against quantem.gpu 2786134a.
  • Checks: the public-repo test, the large-file guard and the notebook-size guard pass, and the pre-push private-term guard passed.
  • Real Chrome on Apple metal-3 WebGPU (subgroup size 32, not a software renderer):
    • CLI pages (TIFF/PNG/NPY mixes, a 30-frame stack, color PNGs):
      • they render, and open from file:// and inside an <iframe>;
      • they re-save from their own Export menu and reopen identically;
      • GIF export keeps every frame.
    • Thumbnail strip (2 panels × 10 frames × 2048², and a 240-frame stack):
      • hover changes the image and leaving restores it exactly;
      • click commits the frame, and 1/2/3 columns work;
      • scrolling draws thumbnails near the view;
      • the highlight and scroll follow playback.
    • Color stacks: the badge reads "native true-color display · WebGPU resident".
  • Not run after the final rebase: the opt-in headed browser suite (QUANTEM_WIDGET_BROWSER=1). It was stopped partway on the previous base when main moved.

…w touch and pen

Playback committed React state ten times a second, and each commit rendered the
whole viewer: under a 4x CPU throttle a frame cost 12 ms of main thread for one
512 px panel and 18.7 ms for three, over a 60 Hz budget on a slower laptop or a
phone. Stats, histogram and star state now commit once a second while playing;
the slider, counters and each panel's frame label are written to the page every
frame. Measured: 4.1 ms and 5.3 ms per frame, WebGPU on the Apple adapter.

The resize grips of Show3D, Show2D and Show3DSlices' volume, and Show3D's
profile height, listened to mouse events only, which a finger drag never sends.
They use pointer events with capture, and on touch screens the 16 px grip takes
a 44 px hit area. A touch drag at Galaxy Fold cover size now resizes the panel.
…e ROI and moves the Lens; wider fps slider and larger slider thumbs on touch screens
…Slices axis panels; Show4DSTEM profile bars too; browser test drags every viewer's grip by touch; ROI hint says drag
@bobleesj bobleesj closed this Nov 13, 2026
@bobleesj
bobleesj deleted the sep/touch-resize-playback branch November 13, 2026 01:31
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