Skip to content

fix(volume-rendering): upload a streamed volume to the GPU once - #1057

Merged
PaulHax merged 2 commits into
Kitware:mainfrom
PaulHax:volume-texture-single-upload
Nov 29, 2026
Merged

PaulHax merged 2 commits into
Kitware:mainfrom
PaulHax:volume-texture-single-upload

Conversation

@PaulHax

@PaulHax PaulHax commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

When a DICOM series streams into the 3D view, vtk.js allocates the volume texture and then patches it slice by slice through the volume property's updated extents. Those partial updates never refreshed the texture's stored hash, so the next time anything else rebuilt the mapper's buffers (a preset fit, a transfer function edit, interaction quality changes), vtk.js reallocated and uploaded the whole volume again. The new texture is allocated before the old one is freed, so GPU memory for the volume briefly doubles, which can exhaust integrated GPUs on large series.

Changes:

  • The vtk.js patch refreshes the stored hash after a partial update.
  • The vtk.js patch also reads partial update extents with the component stride, so streamed multi-component volumes are uploaded correctly. The full re-upload used to hide this.
  • DicomChunkImage reports every frame of a multi-frame file as updated, not just the first. The full re-upload used to hide this too; without it, the 3D view showed a single frame.

The new e2e spec counts full allocations of the volume texture for streamed CT and MR series and checks that a multi-frame file renders all its frames in 3D. syntheticDicom gains a SOP Class UID option for the multi-frame case.

The equivalent upstream vtk.js changes live on PaulHax/vtk-js branches scalar-texture-streamed-hash and texture-partial-upload-components; once they land, the next vtk.js upgrade can drop these hunks.

@netlify

netlify Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for volview-dev failed.

Name Link
🔨 Latest commit 4f1d240
🔍 Latest deploy log https://app.netlify.com/projects/volview-dev/deploys/6b0b905e71fc002332aba04e

@PaulHax
PaulHax force-pushed the volume-texture-single-upload branch 3 times, most recently from 06c10f9 to d5b328c Compare November 28, 2026 20:45
A single DICOM file with several frames fills one slice per frame, but its
chunk load reported only the first slice as updated. The 3D view patches its
volume texture with the reported slices, so it showed a single frame until
something uploaded the whole volume again.
The vtk.js volume mapper keys its scalar texture on the scalars' modified
time. Streamed DICOM chunks patch that texture through updated extents, but
the cached hash kept the time of the first, empty upload. The first rebuild
after loading, such as the preset fit once the image statistics arrive or
the first 3D rotation, then reallocated and uploaded the whole volume while
the old texture was still alive.

Record the current hash after each partial update in the vtk.js patch. That
full upload also hid partial uploads of multi-component scalars, which read
and sized each extent in voxels instead of values, so the patch now strides
them by the component count.
@PaulHax
PaulHax force-pushed the volume-texture-single-upload branch from d5b328c to 4f1d240 Compare November 29, 2026 02:39
@PaulHax
PaulHax merged commit 8ed347b into Kitware:main Nov 29, 2026
13 of 17 checks passed
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