cornerstonejs / cornerstone3D

Cornerstone is a set of JavaScript libraries that can be used to build web-based medical imaging applications. It provides a framework to build radiology applications such as the OHIF Viewer.
https://cornerstonejs.org
MIT License
577 stars 299 forks source link

[Bug] Annotation property "isVisible" becomes undefined with Custom Annotation Manager #1317

Open wadevs opened 5 months ago

wadevs commented 5 months ago

Describe the Bug

When loading annotations (EllipticalROITool) to be displayed in a viewport :

This may be related to the existing issue : https://github.com/cornerstonejs/cornerstone3D/issues/569 The issue appears to stem from checkAndDefineIsVisibleProperty in annotationVisibility

Steps to Reproduce

  1. Create a CustomAnnotationManager which is a copy of FrameOfReferenceSpecificAnnotationManager
  2. expose it like this:
    
    const defaultCustomAnnotationManager = new CustomAnnotationManager('DEFAULT')

export { defaultCustomAnnotationManager } export default CustomAnnotationManager


3. use it, by calling `annotation.state.setAnnotationManager(defaultCustomAnnotationManager)`
4. Use an EllipticalROITool to add annotations
5. Notice they are interactable but hidden

### The current behavior

Invisible annotations while using a CustomAnnotationManager

### The expected behavior

Visible annotations while using a CustomAnnotationManager

### OS

Windows 10

### Node version

16.16.0

### Browser

Chrome 126.0.6478.57
shikamu commented 5 months ago

@sedghi Hello! Have you got any idea why we are facing this strange behaviour ? Are there any examples that use a custom annotation manager ( we weren't able to find any, but if there were it's likely they would suffer from the same issue) ? Do you know anyone who might know more about this ? We have come issue 569 which may be related, but it hasn't received a lot of attention either.

Thanks!

sedghi commented 5 months ago

first, why do you need a separate annotation manager?

shikamu commented 5 months ago

because we are working with dicom images that don't always have a FrameOfReferenceUID set and we therefore have to adapt the default behaviour so that annotations can be used regardless.

sedghi commented 5 months ago

We have support for that in the same manager, like what exactly the data and your use case? What are the requirements? Ultrasound?

wadevs commented 4 months ago

Hello, the use case is as follows : a user should be able to display a mammograph in a viewport and be able to draw annotations using the EllipticalROITool. These annotations are then stored in a database and retrieved at a later point in time to be displayed again on the mammograph. We achieved the expected behavior as long as the mammograph possesses a FrameOfReferenceUID tag. We couldn't find how to handle this case in the documentation and the closest we have come across was mentioning using a custom annotation manager. Is this possible using the default annotation manager ?

sedghi commented 4 months ago

I'm working on revamping the annotation manager very soon in the next version of cornerstone

wadevs commented 4 months ago

OK, thank you for the heads up. Is there a rough approximation for the release date of the next version including the revamped annotation manager ? Would it be possible to have a reply here on this issue when the revamped manager is live ? Is there a workaround we could use in the meantime ?

sedghi commented 4 months ago

I'm working on it in the beta branch, i expect in couple of weeks

sedghi commented 3 days ago

Can you check the latest OHIF viewer, which now includes Cornerstone 3D 2.0?

Here are the migration guides:

Try OHIF locally: https://viewer-dev.ohif.org/localbasic
Try Cornerstone3D 2.0 locally: https://www.cornerstonejs.org/live-examples/local.html

https://docs.ohif.org/migration-guide/3p8-to-3p9/