fix(SegmentationStateManager): fix loading in segmentation labelmaps #1871
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.
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
semantic-release format and guidelines.
Code
etc.)
Public Documentation Updates
additions or removals.
Tested Environment