Skip to content

feat(segmentation): add the segment model, masks, algorithms and render helpers - #962

Open
PaulHax wants to merge 3 commits into
mainfrom
segmentation-model
Open

PaulHax wants to merge 3 commits into
mainfrom
segmentation-model

Conversation

@PaulHax

@PaulHax PaulHax commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Adds the framework-free layer of the segmentation module: the segment and mask
model, geometry helpers, colour parsing, bounded mask storage with overlap
planning and voxel access, the fill-holes and gaussian smooth algorithms with
their workers, the shared identity registry, the reference coordinator, and
the display, projection and render-mask helpers. Nothing consumes them yet;
the store, persistence, tools and UI that do follow in the next change.

Also adds reorientLabelImage, which ensureSameSpace uses to reorder an
equivalent voxel grid onto its image without interpolating label boundaries.

Two follow-up commits ride along: reorientLabelImage returns a same-grid labelmap without reslicing, and the overlap claim path stops allocating a closure per voxel.

@netlify

netlify Bot commented Sep 21, 2026

Copy link
Copy Markdown

Deploy Preview for volview-dev ready!

Name Link
🔨 Latest commit a4ba32f
🔍 Latest deploy log https://app.netlify.com/projects/volview-dev/deploys/6ab1ac2eca1e82000817221a
😎 Deploy Preview https://deploy-preview-962--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 added this pull request to stack #965 September 21, 2026 20:08
…er helpers

Adds the framework-free layer of the segmentation module: the segment and mask
model, geometry helpers, colour parsing, bounded mask storage with overlap
planning and voxel access, the fill-holes and gaussian smooth algorithms with
their workers, the shared identity registry, the reference coordinator, and
the display, projection and render-mask helpers. Nothing consumes them yet;
the store, persistence, tools and UI that do follow in the next change.

Also adds reorientLabelImage, which ensureSameSpace uses to reorder an
equivalent voxel grid onto its image without interpolating label boundaries.
The label path of ensureSameSpace only skipped vtkImageReslice when the
product of the source worldToIndex and the target indexToWorld was a
bit-exact identity matrix. Real geometry never satisfies that: with an
origin and spacing such as [-120.1, -98.4, 33.7] and [0.7, 0.7, 3] the
product carries float error of about 1e-5, so a labelmap that already
sat on its parent's grid was copied through a full nearest-neighbour
reslice on the main thread, once per imported or restored mask.

The axis and eight-corner checks just above already prove the two grids
coincide within the function's 1e-3 tolerance, so the identity test now
only asks that the mapping neither permutes nor flips an axis, and the
source image is returned as-is in that case. Permuted, flipped and
genuinely different grids keep going through the reslice.
masksHolding and masksClearing.claim swept the reaching masks with
some/forEach, so every voxel a brush or polygon fill walked allocated a
fresh callback capturing i, j and k.

Both now sweep the reaching masks with a plain indexed loop, so the
per-voxel path allocates nothing. The answers are unchanged.
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