Repository navigation
Conversation
…unction Labelmap import, session restore, config and processing results now choose a segment by exact name through seatSegment, each passing its reuse policy, instead of four separate implementations.
Labelmap conversion, decoding and splitting now live in a labelmapImport store under io/, which creates masks through the segmentation store's operations. The mask store keeps records, lookup, lifecycle and voxel access, and the state-file wire no longer receives the decode and split functions.
Each 2D slice view writes the visible masks on its slice into shared Uint8 label planes, one label per mask, and moves a mask to the next plane only where its pixels overlap a claimed pixel. One actor draws each plane with per-label lookup and outline tables, so the actor count follows the overlap depth on the slice instead of the segment count. Label lookup tables use a fixed range with a flat plateau per label so the mapper's texel sampling never blends in a neighboring label.
Each image now holds one segment set: order, selection, display, the segment definitions and a mask per segment, keyed by segment id. Mask ids, Segmentation records and mask order are gone, along with the lookups that translated between them. - the registry owns masks and display through imageStorage.ts; deleting a segment or an image drops its masks directly - store.ts keeps the voxel operations, addressed by segment id - the state file wire is a pair of module functions, which removes the store import cycle and the injected store functions - a segment has a mask, possibly covering nothing, or none: a restored mask with no voxels and no artifact restores nothing, and save no longer writes masks without a labelmap - masks are walked and saved in segment order The 8.0.0 manifest shape is unchanged; a saved mask's id is its segment id.
Manifest 8.0.0 is unreleased, so its segmentation records take the shape of the folded model: - a saved mask names only its segment; mask ids and the mask order are gone, and masks restore in segment order - display settings and the segmentation label sit on the image's segment set - segmentations list only images with masks, and every saved mask has a labelmap The 7.0.0 migration orders masks by their old order and drops their ids, reports the masks that order left out, and moves display onto the segment set. An image with no segment set keeps its display through the migration context, since an empty saved set would stop it from inheriting one.
✅ Deploy Preview for volview-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
PaulHax
marked this pull request as ready for review
November 15, 2026 18:21
This branch has not been deployed
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.
Deleting or renaming a segment while viewing one base image also changed every other image, because all images shared one segment catalog. The first commit gives each image its own segment definitions, order and selection, shared by Paint, rectangles, polygons and rulers on that image. With segments per image, mask ids and the
Segmentationrecord repeat what the segment id and the image's segment set already say, so the remaining commits remove that duplication and stop the slice views from creating one actor per mask.Replaces #1005 and #1015. #1015's commit is the first commit here, unchanged.
Per-image segment sets
"Matched segmentation files" means labelmaps associated with the primary image chosen for the initial load: filename matches such as
scan.seg.nii.gzorscan.seg.nrrdforscan.nrrd(thesegmarker is configurable), or DICOM SEG volumes from the same study. File format alone does not establish the association. See the matching path.Matching names does not merge or overwrite existing voxels. Labelmap import reuses an exact-name segment only if it has no mask; session restore requires no mask or shape. Otherwise the incoming segment gets a numbered name such as
Tumor (2). Configs deliberately reapply names and appearance; removing a config entry only deletes a row that the config created and that has no mask or shape. See segment matching and configuration behavior.One consequence of merging: a session loaded onto an image that is already open keeps that image's existing empty segments beside the restored ones.
Processing results and image removal are scoped to their destination images. Unlike #1005, there is no deferred initialization or loading state.
One segment model
A segment belongs to exactly one image, a segment has at most one mask, and an image has exactly one segmentation. The code carried both the segment set and a parallel mask model: two per-image containers, two orders, two id spaces, and lookups and guards that exist only to keep them in step.
Commits
Each commit builds and can be reviewed on its own.
seatSegmentwith a reuse policy. The rules themselves are unchanged.src/segmentation/io/labelmapImport.ts.ImageSegmentsand removesSegmentMask,Segmentation, mask order, the mask-id render projection and the mask reference hook between the two stores. The state-file wire becomes two module functions, which also removes an import cycle between the store and the wire. The saved manifest shape is unchanged in this commit.Manifest 8.0.0
8.0.0 saves per-image membership, order, selection and defaults. The migration splits older shared catalogs into independent per-image sets without duplicating voxels. When an older manifest's per-file datasets resolve to one image, the copies of each legacy definition resolve to one segment on that image.
The first commit introduces 8.0.0 and the last commit reshapes it, so it ships in its final shape:
imageSegmentSets[]gains optionalnameanddisplay(fillOpacity,outlineOpacity,outlineThickness).segmentations[]becomes{ parentImage, masks: [{ segmentId, representations: { labelmap } }] }, written only for images that have masks. Mask ids andorderare gone, andlabelmapis required.segmentationArtifactsis unchanged.orderare still reported as skipped.Other behavior changes
Not in this PR
Import and restore keep their different reuse rules: import reuses a same-name segment when it has no mask, and restore when it has no mask or shape.