Conversation
VTK.js DataArray.getState() calls Array.from() on typed arrays, which OOMs for labelmaps larger than ~180M voxels. Swap each array's data with empty before getState(), then inject the original TypedArrays into the serialized state so structured clone (postMessage) handles them efficiently. Upstream fix in progress: Kitware/vtk-js#3472 — once that lands and is released, this workaround can be removed. Also surface save errors in the UI so they are visible to the user instead of silently failing.
✅ Deploy Preview for volview-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Bump itk-wasm to ^1.0.0-b.197 and @itk-wasm/image-io to 1.6.1. The upstream update fixes a signed-pointer overflow in Emscripten ccall that triggered a RangeError when reading an embedded .nii.gz labelmap from a session zip whose base image had already grown the shared worker's WASM heap past 2GB. Also drop the control-character sanitize patch for itk-wasm's JSON output. The upstream fix in InsightSoftwareConsortium/ITK-Wasm#1457 sanitizes invalid UTF-8 and control characters in metadata at the C++ source, so the JS-side workaround is no longer needed. Verified with the corrupt_dates.dcm fixture from ITK-Wasm#1454 — loads without JSON.parse errors using the plain b.197 build. closes #852
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.
Fixes two failures when working with large labelmaps:
Import (loading a session): bumps
itk-wasmto^1.0.0-b.197and@itk-wasm/image-ioto1.6.1. The upstream release fixes a signed-pointer overflow in Emscriptenccallthat raisedRangeError: Start offset -N is outside the bounds of the bufferwhen reading an embedded.nii.gzlabelmap from a session whose base image had alreadygrown the shared worker's WASM heap past 2GB.
Export (saving a session): works around a VTK.js OOM.
vtkDataArray.getState()callsArray.from()on the underlying typed array, which OOMs for labelmaps largerthan ~180M voxels. Added a helper in
src/io/vtk/async.tsthat temporarily swaps each array's data with an empty buffer beforegetState(), then re-attaches the originalTypedArrays to the serialized state sopostMessage's structured clone handles them efficiently. Upstream fix in flight atKitware/vtk-js#3472 — once released, this workaround can be removed.
Also surfaces save errors in the UI instead of failing silently.
Closes #852