-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Fix/update viewport ds list upon seg delete - OHIF-2425 #5729
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
base: master
Are you sure you want to change the base?
Conversation
-resolves segmentation missing from list (from when PACS) -safety check for missing representation (for when segmentation is deleted)
✅ Deploy Preview for ohif-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Quick note that this only resolves for segmentations, RTStructs are still under investigation (is not able to be loaded a second time after the first delete). |
…ateViewportDSListUponSegDelete
…again in removeDisplaySetLayer)
|
Hi @jbocce, Latest commit for PR now correctly works for both segmentations and RTStructs. removeDisplaySetLayer handles segmentation representation so was not needed to be removed again. As the commands for delete segmentation and removeDisplaySetLayer are pretty close, would it make sense to incorporate the displaySetService.deleteDisplaySet(segmentationid) snippet to removeDisplaySetLayer (this should also fix nothing happening when a segmentation created within the ohif is removed as a layer from overlay menu unless that is desired behaviour)? |
| const spInput = data as cstTypes.SegmentationPublicInput; | ||
| if (!spInput.representation?.type) { | ||
| // Safety check to prevent missing representation field error | ||
| console.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When do we get into this situation? Do we actually have examples where the representation type is not defined? I tried the example for this PR, put a break point here and never hit it.
|
|
||
| // Cleanup segmentation from display set if not from image source | ||
| const seg = segmentationService.getSegmentation(segmentationId); | ||
| if (seg && seg.predecessorImageId === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of things here...
- We still want to do a
segmentationService.remove(segmentationId);always - even when seg.predecessorImageId is defined. I tried the PR deployment, hydrated a SEG via double click but then could not delete it. Likely thisifwas the reason - The display set for the "manually" added display sets are created and added in
setUpSegmentationEventHandlers. Likewise they should be deleted there as well - probably as a result ofSEGMENTATION_REMOVEDevent. - I think it is best to use the
displaySet.madeInClientflag to check if the display set should be deleted or not
So I think it is best to replace this whole if with segmentationService.remove(segmentationId); and do the display set deletion in setUpSegmentationEventHandlers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
segmentationService.remove(segmentationId)
-The reason for the if statement was to resolve an issue with adding RTStructs back in after a deletion (issue resolved after keeping the remove inside if)
-> there may be difference with how SEG/RTstructs are handled/loaded via overlay and double clicking and this if statement may just be hiding some other issue
setUpSegmentationEventHandlers
-I see that the SEGMENTATION_REMOVED event is actually handled by SEGMENTATION_MODIFIED (ultimately by setupSegmentationModifiedHandler under utils\segmentationHandlers.ts), is the recommendation for a check to happen here and then delete the display set? or should the REMOVED event be pulled out and handled differently?
madeInClient
-I had previously attempted to try using this flag but it didn't match my expectations, admittedly I did not spend too much time trying to use it. I can try to look into this a bit more
| } | ||
|
|
||
| // Cleanup segmentation from display set layer | ||
| const viewportId = viewportGridService.getActiveViewportId(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code removes the layer display set only from the active viewport. But what happens if the segmentation were overlaying several viewports? I am also wondering if this is the correct place to do this or not, but I think it will do for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual removal of displaysetlayer was fine for the activeViewport in my testing; however, I can confirm the deleteDisplaySet will cause issues if the segmentation is loaded in another viewport.
segmentations from PACS/Image source should be fine as we should be trying to not delete the display set; however, those madeInClient will run into issues (I've found I needed to add some extra displayset null checks, but this may just be hiding a problem that I'm not handling the delete cleanly).
jbocce
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for this. See my comments. Also as I noted in a private conversation with you please address removing a segmentation from a viewport as well. See the video...
ScreenHunter.Jan.29.10.34.mp4
…ateViewportDSListUponSegDelete
|
Added relevant code within removeSegmentationFromViewport as well; however, after pulling most recent commits (likely Jan. 27 ones) I'm running into a number of new issues with segmentations, will try to work through and apply suggestions noted in comments as well. An example of new issue is I'm sometimes finding segmentations previously removed added back in now (additionally, adding segmentations to one viewport will end up adding it to other viewports with images that share a FoR). |
Context
A potential solution for
#5728
(Also a test noted in #5498)
Overlay UI is missing segmentations when they are added then removed from the segmentation panel as it is still contained in the viewport's display set list.
Changes & Results
Segmentation displayset layer is removed as part of the segmentation delete routine. Additionally, for segmentations created within viewer and not from an image source, it is cleaned up from the overall display set list (so as not to clutter the UI).
Testing
User is now able to add segmentation via overlay UI, delete (whether by accident or on purpose), and still add it back to same viewport via overlay UI without refreshing page.
Checklist
PR
semantic-release format and guidelines.
Code
etc.)
Public Documentation Updates
additions or removals.
Tested Environment
System:
OS: Windows 11 10.0.26200
CPU: (16) x64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz
Memory: 2.85 GB / 15.72 GB
Binaries:
Node: 22.16.0
Yarn: 1.22.22
npm: 10.9.2
Browsers:
Chrome: 144.0.7559.59
Edge: Chromium (143.0.3650.66)