Skip to content

fix: isolate segment definitions by image - #1015

Closed
PaulHax wants to merge 1 commit into
Kitware:mainfrom
PaulHax:image-segment-ownership
Closed

PaulHax wants to merge 1 commit into
Kitware:mainfrom
PaulHax:image-segment-ownership

Conversation

@PaulHax

@PaulHax PaulHax commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Deleting or renaming a segment while viewing one base image also changed every other image, because all images shared one segment catalog. Each image now owns its segment definitions, order and selection, shared by Paint, rectangles, polygons and rulers on that image.

The goals are:

  • Keep images independent. Editing one image's segments does not change another image's set.
  • Carry setup forward. A new image copies the last active image's definitions, order and selection, with fresh identities and no masks or shapes. With no previous set, it uses configured defaults.
  • Decide a set once. An image's set is created when the image arrives. Anything that arrives later for that image merges into the set by name; nothing replaces it.
Situation Result
Image loaded with nothing else On first view or edit, copy the previous image's setup, or use configured defaults.
Return to an initialized image Keep its own set; do not copy again.
Image loaded with matched segmentation files Start from configured defaults before the image is shown, then bind incoming labels by name.
Saved session Each restored image gets its saved set before views are assigned. A session that targets an image which already has a set merges into it by name.
Config, loaded alone or with images Apply to every loaded image by name and update starting defaults. A loaded image without a set takes the configured segments as its set. If a config is loaded alongside a session, it applies after restore.

“Matched segmentation files” means labelmaps associated with the primary image chosen for the initial load: filename matches such as scan.seg.nii.gz or scan.seg.nrrd for scan.nrrd (the seg marker 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. Manifest 8.0.0 saves per-image membership, order, selection and defaults, and 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.

This replaces #1005 with the same per-image model but without deferred initialization or a loading state.

@netlify

netlify Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for volview-dev ready!

Name Link
🔨 Latest commit 32da1d9
🔍 Latest deploy log https://app.netlify.com/projects/volview-dev/deploys/6af8cecc4804e03e57339304
😎 Deploy Preview https://deploy-preview-1015--volview-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@PaulHax
PaulHax force-pushed the image-segment-ownership branch 3 times, most recently from e9505e6 to bf32699 Compare November 8, 2026 15:45
@PaulHax
PaulHax force-pushed the image-segment-ownership branch 2 times, most recently from 04f913d to e22fc5c Compare November 13, 2026 00:56
@PaulHax

PaulHax commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator Author

Folded into #1035, which carries this commit unchanged as its first commit along with the segment model simplification built on it.

@PaulHax PaulHax closed this Nov 15, 2026
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