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

[Bug] CircleROITool fires unnecessary ANNOTATION_MODIFIED events when any part of the annotation is outside the image #1489

Open
ScottShingler opened this issue Oct 2, 2024 · 0 comments

Comments

@ScottShingler
Copy link

ScottShingler commented Oct 2, 2024

Describe the Bug

Positioning a CircleROITool annotation partially or fully outside the image (i.e. in the black border area) in 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}`);
    }
);

The extraneous events have been observed to fire when any part of the annotation is outside the image and any of the following occur:

  • Moving the annotation
  • Resizing the annotation
  • Moving the mouse over the annotation

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

Steps to Reproduce

  1. Draw a circle annotation in a StackViewport
  2. Move the circle partially or fully outside the image

The current behavior

Extra ANNOTATION_MODIFIED events are triggered when the annotation is outside the image.

The extraneous events have been observed to fire when any part of the annotation is outside the image and any of the following occur:

  • Moving the annotation
  • Resizing the annotation
  • Moving the mouse over the annotation

The expected behavior

The ANNOTATION_MODIFIED triggering behaviour when the annotation is outside the image should be the same as how it is when the annotation is completely contained within the image. To put it another way, it should behave more like the EllipticalROITool, which doesn't suffer from this issue.

OS

Windows 11

Node version

18.20.3

Browser

Edge 129.0.2792.52 (Official build) (64-bit)

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

No branches or pull requests

1 participant