Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(SegmentationStateManager): fix loading in segmentation labelmaps #1871

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tye-shanklin
Copy link

Context

Fixes loading segmentation labelmaps. Before this fix, when loading in segmentation data from a DICOM SEG file, the Segmentation State Manager would always use the last overlay image, even though that would not correspond to most of the images in a Stack viewport. After this fix, the Segmentation State Manager uses the overlay for slice 1 when viewing slice 1 of a stack viewport, overlay slice 2 for slice 2 of the viewport, etc.

For more context and to see an example of what's broken, please refer to OHIF/Viewers#4789.

Changes & Results

I updated the Segmentation State Manager to reference the overlay image based on a slice's index when loading a segmentation DICOM file and populating the segmentation state. Since the overlay images are stored in-order based on the order of the slices, this appears to be a safe approach.

An example video of the fixes in action are attached to this PR.

Segmentation.Fixes.mp4

Testing

To test these changes, you can open the segmentation mode for a study in the OHIF Viewers project and mark up the stack with different labels, then export the segmentation as a DICOM SEG file and save it to a backing PACS server. When reopening the study and selecting the segmentation structured report, it should load the segmentations in order.

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
  • "Node version: 23.5.0
  • "Browser: Edge 133.0.3065.69

Copy link

netlify bot commented Mar 3, 2025

Deploy Preview for cornerstone-3d-docs ready!

Name Link
🔨 Latest commit 4917aeb
🔍 Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/67c6183d598c620008d7cf39
😎 Deploy Preview https://deploy-preview-1871--cornerstone-3d-docs.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 site configuration.

Comment on lines +462 to +463
const labelForImageIndex = labelmapImageIds[currentImageIndex];
if (labelForImageIndex) {
Copy link
Contributor

Choose a reason for hiding this comment

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

i always wondered why we don't do this instead of looping over the labelmapImageIds and finding the match.

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