Add 3D visualization notebooks (trame-slicer, ipyniivue, Slicer desktop)#104
Add 3D visualization notebooks (trame-slicer, ipyniivue, Slicer desktop)#104fedorov wants to merge 1 commit into
Conversation
Add three advanced-topics notebooks for interactive visualization of IDC images and DICOM SEG overlays in Colab, and link them from the README: - trame-slicer in-browser 3D rendering - ipyniivue WebGL viewer widget - full 3D Slicer desktop streamed via desktopia Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Visualization approach analysis
Three rendering approaches
1. ipyniivue — WebGL rendering in the browserHow it works
Rendering performanceExcellent for the operations NiiVue is designed for: slice scrolling, pan/zoom, opacity changes, and layout switching respond at display-frame rate because no server round-trip is involved. GPU-accelerated volume ray-casting runs in the browser — the Colab VM's hardware does not matter because the GPU doing the work is the user's own machine. Interactivity latencyNear-zero. All interaction is processed locally in the browser. This is the most responsive of the three approaches for typical viewing operations. Browser and platform compatibilityWorks in any browser with WebGL 2 support — Chrome, Firefox, Safari, Edge — on any operating system. No server-side GPU required. No OS-level native libraries. The Rendering capability ceilingNiiVue is a capable viewer but not a VTK-class rendering engine. Its volume rendering, while good, does not match the fidelity of VTK-based transfer functions or the multi-resolution streaming of large datasets. There is no concept of a MRML scene, no support for editing, no module system. For pure viewing tasks on data up to a few hundred MB, the ceiling is unlikely to matter. Robustness to Colab environment changesHigh. The rendering is entirely in the browser — the Colab VM only serves the widget bundle and the data files. The only Colab-specific hook is Tool maturity and maintenanceipyniivue is 5 years old (created 2021), currently at v2.4.4, with 12 contributors and an active release history. The primary maintenance dependency is keeping the bundled NiiVue JS version current as NiiVue adds features; recent history shows this tracking is done manually but consistently (v0.67.0 bundled as of Feb 2026). Anticipated maintenance effortLow. No server processes, no native binaries, no platform-specific wheels. 2. trame-slicer — VTK rendering on the server, frame-streamed to browserHow it works
Rendering performanceVTK-grade: accurate MPR resampling, physically-based volume rendering with proper transfer functions, precise segmentation overlay compositing — identical quality to 3D Slicer on the desktop. The tradeoff is that rendering happens on a CPU-only VM (Mesa/llvmpipe on Colab's CPU runtime), so complex volume renders take longer to produce than on a GPU workstation, but output quality is authoritative. Interactivity latencyModerate. Every user interaction triggers a server render and a JPEG frame delivery. On a good Colab network connection this round-trip is typically under 500 ms — usable but perceptible. Slice scrolling is noticeably laggier than ipyniivue. Latency scales with network conditions between the user and the Colab datacenter. Browser and platform compatibilityNo browser restriction — the RCA stream is standard HTTP/WebSocket JPEG frames. Significant platform restriction on the server side: Robustness to Colab environment changesMedium. The rendering stack depends on Mesa OpenGL system libraries installed via apt. The The notebook sets Tool maturity and maintenancev1.11.0, 29 releases in 13 months, 9 contributors, monthly cadence, CI with coverage, commercially backed by Kitware. However: the README explicitly states the API has not been reviewed by 3D Slicer core developers. The API is evolving, and the notebook's pinned version will need updating over time. Anticipated maintenance effortMedium. Periodic re-testing and version-pin updates as trame-slicer releases. Platform wheel availability requires monitoring. 3. desktopia — Full Slicer desktop, H.264 video streamHow it worksThe notebook launches the complete 3D Slicer desktop application inside a headless virtual X display ( Rendering performanceSame VTK-based Slicer engine as trame-slicer on the same software OpenGL stack, with an additional layer of H.264 video compression artifacts — the image the user sees is a lossy-compressed version of what Slicer renders. Streaming is capped at 15 fps. Interactivity latencyHigh. The interaction chain is: user input → WebSocket → VM → Slicer → VTK render → GStreamer H.264 encode → WebSocket → browser H.264 decode → canvas. Software encoding adds significant latency. This is a distinctly remote-desktop-like experience. Browser and platform compatibilityThe primary desktopia architecture (QUIC/WebTransport + WebCodecs) requires Chromium. The Colab notebook uses a software-only WebSocket path that bypasses this — so in Colab any browser works. But the notebook is entirely dependent on Colab's internal port-proxying mechanism ( Robustness to Colab environment changesVery low. The failure surface is large:
Tool maturity and maintenancedesktopia was created on 2026-05-31 — 9 days before this PR was filed. Zero formal releases, no semantic versioning, no CI, one contributor (Steve Pieper, a respected Slicer core developer). It is explicitly an experimental proof-of-concept. Anticipated maintenance effortVery high. This notebook will require active testing and fixes after essentially every Colab infrastructure change, every desktopia commit, and every new Slicer release. There is no practical CI path for catching regressions before users encounter them. Comparative summary
Recommendationipyniivue is the right default for IDC tutorials. It is the most portable, most robust, lowest-latency, and lowest-maintenance option. Its rendering quality is sufficient for the core IDC use case of exploring volumetric images and segmentation overlays. It should be the primary recommended notebook for users who want interactive 3D viewing in Colab. trame-slicer is a valuable complementary notebook for users who need VTK-quality rendering or who want to work with the Slicer MRML pipeline. It should be clearly scoped as a Linux/Colab-only tool, and the IDC team should establish a periodic testing cadence against new trame-slicer releases to keep the pinned version current. desktopia should not be published as a supported IDC tutorial in its current state. Depending at runtime on a 9-day-old, single-contributor, unversioned experimental repository that is cloned from a branch is too fragile for a public tutorial the IDC team will be asked to support. As a developer demo or community showcase — clearly labeled experimental, not linked from the main README — it could be appropriate. It should be reconsidered for promotion to a supported tutorial once desktopia publishes versioned releases and has demonstrated stability over several months. |
Add three advanced-topics notebooks for interactive visualization of IDC images and DICOM SEG overlays in Colab, and link them from the README: