Conversation
✅ Deploy Preview for volview-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
PaulHax
force-pushed
the
segmentation-model
branch
from
September 21, 2026 22:14
895f934 to
a4ba32f
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.
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.