Skip to content

using voxelManager in SegmentSelectTool to fix Inside mode#2702

Open
theoc0702 wants to merge 1 commit intocornerstonejs:mainfrom
theoc0702:fix/segment-select-crash-inside-mode
Open

using voxelManager in SegmentSelectTool to fix Inside mode#2702
theoc0702 wants to merge 1 commit intocornerstonejs:mainfrom
theoc0702:fix/segment-select-crash-inside-mode

Conversation

@theoc0702
Copy link
Copy Markdown
Contributor

Context

Currently, it is problematic to use the SegmentSelectTool configured with SelectMode.Inside in integrated environments (like OHIF). When the tool attempts to evaluate the hovered segment, it can fail to read the underlying data appropriately, resulting in the following TypeError regarding getNumberOfComponents:
Screenshot from 2026-04-16 11-41-09

Changes & Results

  • Refactored the data access logic in getSegmentIndexAtWorldPoint (and associated utilities).
  • Replaced the failing direct imageData evaluation with voxelManager.imageData, utilities.transformWorldToIndex, and voxelManager.getAtIJK().
  • Result: The SelectMode.Inside configuration can now be used safely without throwing data evaluation errors.

Testing

  1. Configure a viewer instance to use the SegmentSelectTool with { mode: SegmentSelectTool.SelectMode.Inside }.
  2. Hover the mouse cursor over the viewport / image area.
  3. Verify that the selection logic evaluates correctly and no TypeError is thrown in the console.

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • "OS: Windows 11 / Ubuntu 22.04"
  • "Node version: 18.16.0"
  • "Browser: Chrome 123.0.6312.122"

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