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
473 stars 249 forks source link

[Bug] Some low-resolution devices cannot render big images #978

Open makinox opened 6 months ago

makinox commented 6 months ago

Describe the Bug

In current versions of cornerstone I've found that in some cases some phones are presenting a behavior that the viewport, instead of showing the image instance, are just showing a white square.

image (1)

My investigation leads towards to a resolution problem since the image has a big resolution (4280x3520) and the phone that is rendering the page has a resolution of 720x1600 This is the following message from WebGL image

A possible solution for this that I have found is to transform the image instance into a low-resolution version, for example a 2140x1760 version of the same image.

Steps to Reproduce

  1. Have a low-resolution phone, for example a moto g9 play (720x1600)
  2. Load a simple cornerstone example in the phone
  3. Load an image instance with a resolution bigger than 4000x2000
  4. At this point, you are going to see a white screen rendered

The current behavior

Currently, rendering big images on some devices is resulting in white screens. WebGL is sharing a message that it cannot render out of range images. image

The expected behavior

The expected behavior is to render the image instance correctly, since in previous versions of cornerstone (2.3.0) this was working.

Devices tested

Moto G9 play

Samsung Galaxy S23 Ultra

Samsung Galaxy A52

OS

Android 12

Node version

18.16.0

Browser

Google Chrome mobile 117.0.5938.61

Bug DICOM file

01.dcm.zip

sedghi commented 2 months ago

Resolution is proportional to the GPU memory and texture size, so it is not just the LED/LCD resolution of the phone, it is the actual hardware.

There are some solutions, you can try setting the

try these flags

if this works it is great useNorm16Texture: true

preferSizeOverAccuracy: true,

or

useCPURendering: true,

syed-qure commented 1 month ago

useCPURendering: true this works but makes the text on the dicom unreadable. the rest two flags did not work for me.