OHIF / Viewers

OHIF zero-footprint DICOM viewer and oncology specific Lesion Tracker, plus shared extension packages
https://docs.ohif.org/
MIT License
3.08k stars 3.25k forks source link

[Bug]: Null cached_data values when rendering annotations on multi-series cases with OHIF3 viewer #3582

Closed shirula closed 10 months ago

shirula commented 1 year ago

Describe the Bug

Hello, We are currently using the OHIF3 viewer and have encountered some unexpected behavior that we are trying to understand. To reproduce the issue, we have observed that while attempting to add raw measurements using the provided OHIF functionality, the behavior becomes problematic when dealing with multi-series cases that contain annotations on series other than the first one. In such cases, the cached_data is failing to be calculated - the values are initiated to null value and remain with this value, resulting in rendering errors and buggy behavior - We have attached a video demonstrating this behavior for reference. Upon further investigation, we found that the issue arises when Cornerstone attempts to call _calculateCachedStats, where it fails to retrieve the targetImage due to a null value returned by the this.getDefaultActor() function in the

`stackViewport` class.
// Tool file for example - node_modules/@cornerstonejs/tools/dist/esm/tools/annotation/RectangleROITool.js
const image = this.getTargetIdImage(targetId, renderingEngine)

// webpack:///node_modules/@cornerstonejs/core/dist/esm/RenderingEngine/StackViewport.js

getImageDataGPU() {
        const defaultActor = this.getDefaultActor();
        if (!defaultActor) {
            return;
        }
……
}

We managed to mitigate this behavior by adding an event listener to ANNOTATION_MODIFIED and setting the annotation as invalidated. This ensures that in the next render round(s), the cached_stats will be calculated, resolving the issue since getTargetIdImage is then no longer undefined - we can also see in the attached video the selecting annotations for rendering on different order effects the behavior, such that annotation that was selected first wasn’t rendered correctly, but when selected second it did managed to rendered. As part of our research, we have noticed that for multi-series studies, we are missing FrameOfReferenceUID DICOM tags, could this be causing the problem?is it a must have data for adding raw annotations? Are there any other necessary data to provide that cause such an issue? We will really appreciate your assistance :pray:

Steps to Reproduce

  1. Open multi-series study while loading raw measurements on multi-series
  2. Choose measurements on series other than the first one (upper series)
  3. Observe that the chechdata is not calculated as expected

The current behavior

cached_data values are null when annotation is rendering

https://cornerstonejs.slack.com/files/U050A090MNH/F05M79PGTS4/multi_series.mov

The expected behavior

cached_data values are according to the annotation

OS

macOS Ventura 13.5

Node version

v20.2.0

Browser

Chrome Version 115.0.5790.114

jbocce commented 11 months ago

This might have been fixed by PR #3696. @shirula please have a look.

sedghi commented 10 months ago

@jbocce What do you mean? is it fixed? can you reproduce it anymore?

jbocce commented 10 months ago

I think this is fixed by #3696 in master. @shirula if you consider it not fixed, please let us know or reopen the issue.