fix(dicom): preserve slices across incremental imports - #935
Merged
Conversation
✅ Deploy Preview for volview-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
PaulHax
force-pushed
the
dicom-chunk-index
branch
from
September 4, 2026 22:18
0aaa947 to
b9d5241
Compare
Adding chunks to an existing DICOM image re-sorts the list and reallocates the volume buffer. Slices already decoded were zeroed by the reallocation and never rewritten while their status still said Loaded. A decode in flight across that reallocation wrote through the slot it captured before the sort, so its pixels or its error could land on another chunk's slice. Two overlapping additions each awaited a sort of the shared list, and the sort that settled last won, dropping the newer call's chunks. The image cache also starts a load only when it first registers an image, so chunks added on a re-import were allocated for but never asked to load. Redecode every chunk that holds data after a reallocation and report those slices as Loading until the rewrite lands. Resolve a chunk's slot after its decode settles, and discard any result from a previous allocation generation, so completion order cannot overwrite current state. Address failures by chunk rather than by captured index. Serialize additions through a promise queue. Ask an already-registered image to start loading after a re-import adds to it.
PaulHax
force-pushed
the
dicom-chunk-index
branch
2 times, most recently
from
September 4, 2026 22:45
7c45b63 to
6a2c30f
Compare
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.
Builds on #934, which is now merged.
Summary
Importing more files for an already open DICOM series reallocates and re-sorts the volume. The old path could lose loaded pixels, write an in-flight decode into the wrong slice, or leave newly added chunks unloaded.
This change preserves existing slices across reallocation and keeps decode results tied to the current buffer and chunk order.
Import flow
What changed
Reallocation
Before:
Loaded.Now:
Loadingand decoded into the new buffer.Tests
Coverage includes serialized additions, sorted slice placement, stale decode success and failure, loading state during reallocation, and starting newly added chunks.