cornerstone3D
cornerstone3D copied to clipboard
[Bug] PlanarFreehandROITool fires unnecessary `ANNOTATION_MODIFIED` events when an open contour is drawn
Describe the Bug
Creating an open contour using the PlanarFreehandROITool on a StackViewport will cause extraneous ANNOTATION_MODIFIED
events to be triggered. This can be observed by setting up an event listener that logs to console:
eventTarget.addEventListener(
csToolsEnums.Events.ANNOTATION_MODIFIED,
(event) => {
console.log(`ANNOTATION_MODIFIED: ${event.detail.viewportId} ${event.detail.annotation.annotationUID} ${event.detail.changeType}`);
}
);
This becomes a crippling issue when you have multiple viewports and need to force the other viewports to render so that the annotation is updated. Because of the extraneous ANNOTATION_MODIFIED
event, it ends up causing an infinite feedback loop. I have created a repro that demonstrates this: cornerstone-annotation-spam-repro
This behaviour seems to have only started after #1372 was merged in.
Steps to Reproduce
- Draw an open contour on an image in a StackViewport
The current behavior
Extra ANNOTATION_MODIFIED
events are triggered when the annotation is completed.
The expected behavior
A single ANNOTATION_MODIFIED
event should be triggered once when the annotation is completed.
OS
Windows 11
Node version
18.20.3
Browser
Edge 129.0.2792.52 (Official build) (64-bit)