Viewers icon indicating copy to clipboard operation
Viewers copied to clipboard

[Bug] OHIF not working on some Android devices

Open ionutdobre opened this issue 1 year ago • 8 comments

Describe the Bug

Hi! We have encountered an issue with the latest OHIF viewer on certain Android devices. Specifically, the viewer fails to display instances correctly, resulting in a fully black or grey image. This problem is reproducible on a Samsung phone but does not occur on a OnePlus phone, suggesting device-specific behavior.

Additional Information:

  • This issue has been reproduced across multiple studies available on the OHIF viewer platform (https://viewer.ohif.org/)
  • Screenshot of the issue on the Samsung device:
Screenshot 2024-07-12 at 12 52 03

Could you please provide guidance or a fix for this issue? Any insights into why this might be happening on specific devices would be greatly appreciated.

Steps to Reproduce

  1. Open the OHIF viewer on a Samsung Android device
  2. Load the following study: Study Link
  3. Observe the display of instances within the study

The current behavior

The instances are displayed as fully black or grey images.

The expected behavior

The instances within the study should display correctly as they do on other devices, including a OnePlus phone and desktop browsers.

OS

Android 12

Node version

Browser

Chrome 126.0.6478.122

ionutdobre avatar Jul 12 '24 10:07 ionutdobre

Have you tried on more recent android os?

sedghi avatar Jul 12 '24 18:07 sedghi

Hello Sedghi, many users do not have the financial capacity to maintain the latest generation equipment.

tonygonzalez811 avatar Jul 14 '24 13:07 tonygonzalez811

Hello @sedghi!

We’ve tested the OHIF viewer on a Samsung device running Android 13 and encountered the same problem with instances not displaying correctly:

IMG_5495 IMG_5493 IMG_5494


Additionally, we’ve tested it on a Pixel device running Android 12, and instances are loaded properly:

IMG_5498 IMG_5496 IMG_5497

ionutdobre avatar Jul 15 '24 09:07 ionutdobre

Same here, we have tested on Honor, Xiaomi and it works, on mid and low range Samsung it fails

image

image

image

image

tonygonzalez811 avatar Jul 15 '24 09:07 tonygonzalez811

Hi @sedghi! I wanted to follow up on this issue to see if there have been any updates or if there’s any guidance you could provide to help resolve it. Thanks!

ionutdobre avatar Jul 25 '24 20:07 ionutdobre

I think you need to find the configuration that works best for you. You can force CPU rendering, which might be suitable for some use cases, but you won't get MPR, segmentation, and 3D rendering. Take a look at the cornerstone.init function and set the useCPURendering option to true.

https://github.com/cornerstonejs/cornerstone3D/blob/main/packages/core/src/init.ts

// TODO: Change config into a class with methods to better control get/set
const defaultConfig = {
  gpuTier: undefined,
  detectGPUConfig: {},
  isMobile: false, // Is mobile device
  rendering: {
    useCPURendering: false,
    // GPU rendering options
    preferSizeOverAccuracy: false,
    useNorm16Texture: false,
    strictZSpacingForVolumeViewport: true,
  },
  // Cache
  enableCacheOptimization: true,
  /**
   * Imports peer modules.
   * This may just fallback to the default import, but many packaging
   * systems don't deal with peer imports properly.
   */
  peerImport: (moduleId) => null,
};
```origin/m

sedghi avatar Jul 26 '24 16:07 sedghi

I’ve tested it, and yes, it will resolve the issue.

However, the following problems remain: • How do I know when to enable software rendering and when not to (which devices have this problem)? • In an older version of OHIF v3, hardware acceleration worked even on older devices.

ionutdobre avatar Jul 29 '24 14:07 ionutdobre

I also have this problem. Is there a way to define useCPURendering only on Android devices?

arturojain avatar Jul 30 '24 13:07 arturojain

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/

sedghi avatar Nov 14 '24 21:11 sedghi

@ionutdobre @sedghi

I got report about this issue, and today I tested it at Samsung A35, android 14.

It's working on both, a bit old OHIF and latest OHIF. IMG_5008

@ionutdobre Which Samsung phone did you test? mid, low-range.. specifically? still persist?

Joeycho avatar Nov 21 '24 13:11 Joeycho

@ionutdobre can you try on the latest release and let us know?

sedghi avatar Nov 21 '24 15:11 sedghi

https://github.com/cornerstonejs/cornerstone3D/issues/978

Relevant issue at Cornerstone repo as well

Joeycho avatar Nov 21 '24 17:11 Joeycho

https://github.com/cornerstonejs/cornerstone3D/issues/978#issuecomment-2492333616

At least, at Samsung Galaxy S23 Ultra, it works, just change config setup. Thank you for your suggestion @sedghi

Joeycho avatar Nov 21 '24 21:11 Joeycho

@sedghi We’ve just tested the study - https://viewer.ohif.org/viewer?StudyInstanceUIDs=2.16.840.1.114362.1.11972228.22789312658.616067305.306.2 - on a Samsung Galaxy A13 (https://en.wikipedia.org/wiki/Samsung_Galaxy_A13), and the error still persists.

We've detected that the issue originates from a bug in the VTK library, as described here: https://github.com/Kitware/vtk-js/pull/3117

IMG_8551 IMG_8552 IMG_8553

ionutdobre avatar Nov 22 '24 09:11 ionutdobre

I'm not really sure. How did you conclude that the VTK PR is causing it? That actually makes a lot of sense.

Could you share the results from webglreport.com, especially the supported extensions? You might need to scroll down a bit.

CCing @slak44 too

sedghi avatar Nov 22 '24 13:11 sedghi

The VTK PR is not the cause, rather a solution to this issue. To be precise, it's the solution for studies whose texture data fits in 16 bit floats. For studies where it doesn't fit, you can enable preferSizeOverAccuracy which "fixes" them as well, at the cost of accuracy.

Unfortunately OHIF master is on the last vtk version that doesn't include the PR (32.1.0 vs 32.1.1), which is probably why viewer.ohif.org still has the issues mentioned in the comment above.

As I mentioned in the PR, the combination of having webgl2 available, but not OES_texture_float_linear is what triggers the problem, and we found this most often occurs on Androids with Mali GPUs. If you really want that webgl report, @ionutdobre (we work together) can track down a device like this to get that list of supported extensions.


And if anyone else is interested in using preferSizeOverAccuracy, something like this in your OHIF config would do it:

const testCanvas = document.createElement('canvas');
const context = testCanvas.getContext('webgl2');
const hasWebGL2 = context !== null;
const hasOESTextureFloatLinear = !!context?.getExtension('OES_texture_float_linear');

const config = {
  // ...
  preferSizeOverAccuracy: hasWebGL2 && !hasOESTextureFloatLinear
  // ...
};

slak44 avatar Nov 22 '24 15:11 slak44

Thanks @slak44 i will update our version then

sedghi avatar Nov 22 '24 15:11 sedghi

Can you check in 10 mins or so https://viewer-dev.ohif.org/ ?

sedghi avatar Nov 22 '24 20:11 sedghi

Any update here?

sedghi avatar Nov 25 '24 21:11 sedghi

I got a device to test. It works on viewer-dev now, and it doesn't on the regular viewer, so something has definitely changed: image image

https://viewer-dev.ohif.org/viewer?StudyInstanceUIDs=2.16.840.1.114362.1.11972228.22789312658.616067305.306.2 https://viewer.ohif.org/viewer?StudyInstanceUIDs=2.16.840.1.114362.1.11972228.22789312658.616067305.306.2

slak44 avatar Nov 26 '24 08:11 slak44

viewer.ohif.org has not been updated yet. So great news. Thanks @slak44 I'm updating the viewer.ohif.org this week

sedghi avatar Nov 26 '24 14:11 sedghi

Image (1)

@sedghi I tested it and it keeps happening. also tested it in https://viewer-dev.ohif.org/viewer?StudyInstanceUIDs=2.16.840.1.114362.1.11972228.22789312658.616067305.306.2 and it keeps happening. tested in 2 Android (13 & 14) (Snapdragon 732G Octa-core & Snapdragon 7S gen2)

ivogomes78 avatar Nov 27 '24 10:11 ivogomes78

related https://github.com/Kitware/vtk-js/pull/3194

sedghi avatar Dec 20 '24 13:12 sedghi

can you guys check again? since we recently upgraded cs3d (hence vtk.js)

sedghi avatar Jan 15 '25 23:01 sedghi

Provide the result of https://debug.ohif.org here

sedghi avatar Jan 20 '25 21:01 sedghi

Hello! We’ve tested this on 3 devices, and on 2 of them, we still have some issues. Here are the screenshots (application + device info):

Image Image


Image Image


on this device everything is fine

Image Image

ionutdobre avatar Jan 21 '25 10:01 ionutdobre

Please post debug.ohif.org result for each of them

sedghi avatar Jan 21 '25 12:01 sedghi

Sure, here are the results

Image Image Image

ionutdobre avatar Jan 23 '25 08:01 ionutdobre

@ionutdobre How about now? Is this issue really resolved? by the #4762 PR? @sedghi

Or should it be fixed from vtk-js? https://github.com/Kitware/vtk-js/issues/3206 https://github.com/cornerstonejs/cornerstone3D/issues/978

Joeycho avatar Mar 06 '25 11:03 Joeycho

I’m still experiencing the same issues. Here are some screenshots for reference; let me know if you need any additional details!

Image Image

ionutdobre avatar Mar 10 '25 15:03 ionutdobre