Simplify overlay_segmentations using MergeLabelMap + LabelMapContourOverlay - #513
Merged
blowekamp merged 2 commits intoSep 23, 2026
Conversation
blowekamp
force-pushed
the
overlay-segmentations-binary-projection
branch
2 times, most recently
from
September 21, 2026 20:43
043e87a to
a44cce3
Compare
blowekamp
marked this pull request as ready for review
September 22, 2026 11:19
…verlay Replace the per-segmentation LabelMapContourOverlay + manual mask compositing (built on BinaryProjectionImageFilter/ToScalarImage) with a single MergeLabelMapFilter + LabelMapContourOverlay call. Each binary segmentation is cast to a label map (all label 1); MergeLabelMapFilter's default KEEP method keeps each input's region distinct despite the shared label value, so overlapping contours are handled correctly in one pass instead of manual per-segmentation compositing.
blowekamp
force-pushed
the
overlay-segmentations-binary-projection
branch
from
September 22, 2026 12:44
a44cce3 to
888bfe1
Compare
zivy
approved these changes
Sep 23, 2026
zivy
force-pushed
the
overlay-segmentations-binary-projection
branch
from
September 23, 2026 03:59
5336840 to
c0380b5
Compare
zivy
force-pushed
the
overlay-segmentations-binary-projection
branch
from
September 23, 2026 04:01
c0380b5 to
e9e3478
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.
Summary
Simplifies
overlay_segmentationsinPython/05_Results_Visualization.ipynb.Replaces the per-segmentation
LabelMapContourOverlaycalls plus manual maskcompositing (built on
BinaryProjectionImageFilter/ToScalarImage) with asingle
MergeLabelMapFilter+LabelMapContourOverlaycall:sitkLabelUInt8,all sharing label value
1).MergeLabelMapFilter's defaultKeepmethod keeps each input's regiondistinct despite the shared label value, so contours for all segmentations
(including overlapping ones) are drawn correctly in a single
LabelMapContourOverlaycall, instead of manually compositing per-segmentationresults with a projection-based mask.
Verified with a standalone reproduction (two overlapping binary masks) that this
produces pixel-identical output to explicitly scaling each segmentation to a
unique label id before merging, and confirmed the notebook re-executes end-to-end
with
jupyter nbconvert --executewith no errors.