Skip to content

Conversation

@sedghi
Copy link
Member

@sedghi sedghi commented Dec 19, 2025

This pull request enhances the segmentation demo tools by improving multi-viewport and multi-segmentation support, refining segmentation clearing logic, and updating the RegionSegmentTool for more configurable and robust behavior. The changes focus on supporting multiple viewports and segmentations in the regionSegmentPlus example, ensuring segmentation updates propagate correctly, and making the grow cut algorithm more flexible.

Multi-viewport and multi-segmentation support in regionSegmentPlus:

  • Refactored the example to use two viewports (viewportId1, viewportId2) and two segmentations (segmentationId1, segmentationId2), updating UI layout and logic to instantiate and manage both independently. [1] [2]
  • Updated segmentation state management and initialization to handle multiple image stacks and segmentations, including separate loading, assignment, and rendering for each viewport and segmentation. [1] [2]

Improved segmentation clearing and event handling:

  • Enhanced the "Clear segmentation" toolbar button in both examples to clear all relevant segmentations and trigger segmentation data modified events, ensuring UI and state consistency. [1] [2]

Rendering and interpolation improvements:

  • Set the interpolation type to NEAREST for all viewports in the regionSegment example to improve segmentation visualization consistency. [1] [2]

RegionSegmentTool algorithm improvements:

  • Updated the RegionSegmentTool to use configurable variance and standard deviation multipliers for the grow cut algorithm, allowing for more flexible and robust segmentation behavior. [1] [2]

Copilot AI review requested due to automatic review settings December 19, 2025 23:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the RegionSegmentTool with configurable seed variance and standard deviation multipliers for the grow cut algorithm, improves the segmentation clear functionality, and updates examples to demonstrate dual viewport usage and proper interpolation settings.

  • Added dynamic variance scaling based on standard deviation multipliers in RegionSegmentTool
  • Improved segmentation clearing by accessing imageIds through segmentation state representationData
  • Enhanced examples with dual viewport setup and interpolation type configuration

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/tools/src/tools/annotation/RegionSegmentTool.ts Adds configurable growCut options with variance scaling based on positiveStdDevMultiplier, allowing dynamic adjustment of seed variances
packages/tools/examples/regionSegmentPlus/index.ts Refactors example to support dual viewports with separate segmentation IDs, improves clear functionality using segmentation state API, and removes outdated comments
packages/tools/examples/regionSegment/index.ts Adds InterpolationType.NEAREST for viewports to improve segmentation visualization and enhances clear functionality with proper event triggering

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sedghi sedghi changed the title fix/region segment fix: region segment example Jan 5, 2026
@sedghi sedghi merged commit 42f2d54 into main Jan 5, 2026
16 checks passed
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.

2 participants