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] OHIF not working on some Android devices #4286

Open
ionutdobre opened this issue Jul 12, 2024 · 23 comments
Open

[Bug] OHIF not working on some Android devices #4286

ionutdobre opened this issue Jul 12, 2024 · 23 comments
Assignees
Labels
Awaiting Reproduction Can we reproduce the reported bug?

Comments

@ionutdobre
Copy link

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 ionutdobre added the Awaiting Reproduction Can we reproduce the reported bug? label Jul 12, 2024
@sedghi
Copy link
Member

sedghi commented Jul 12, 2024

Have you tried on more recent android os?

@tonygonzalez811
Copy link

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

@ionutdobre
Copy link
Author

ionutdobre commented Jul 15, 2024

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

@tonygonzalez811
Copy link

tonygonzalez811 commented Jul 15, 2024

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

image

image

image

image

@ionutdobre
Copy link
Author

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!

@sedghi
Copy link
Member

sedghi commented Jul 26, 2024

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

@ionutdobre
Copy link
Author

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.

@arturojain
Copy link

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

Copy link
Member

sedghi commented Nov 14, 2024

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/

@Joeycho
Copy link
Contributor

Joeycho commented Nov 21, 2024

@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?

@sedghi
Copy link
Member

sedghi commented Nov 21, 2024

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

@Joeycho
Copy link
Contributor

Joeycho commented Nov 21, 2024

cornerstonejs/cornerstone3D#978

Relevant issue at Cornerstone repo as well

@Joeycho
Copy link
Contributor

Joeycho commented Nov 21, 2024

cornerstonejs/cornerstone3D#978 (comment)

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

@ionutdobre
Copy link
Author

@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: Kitware/vtk-js#3117

IMG_8551
IMG_8552
IMG_8553

@sedghi
Copy link
Member

sedghi commented Nov 22, 2024

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

@slak44
Copy link
Contributor

slak44 commented Nov 22, 2024

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
  // ...
};

@sedghi
Copy link
Member

sedghi commented Nov 22, 2024

Thanks @slak44 i will update our version then

@sedghi
Copy link
Member

sedghi commented Nov 22, 2024

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

Copy link
Member

sedghi commented Nov 25, 2024

Any update here?

@slak44
Copy link
Contributor

slak44 commented Nov 26, 2024

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

@sedghi
Copy link
Member

sedghi commented Nov 26, 2024

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

@sedghi sedghi closed this as completed Nov 26, 2024
@ivogomes78
Copy link

ivogomes78 commented Nov 27, 2024

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)

@sedghi sedghi reopened this Dec 19, 2024
@sedghi
Copy link
Member

sedghi commented Dec 20, 2024

related Kitware/vtk-js#3194

@sedghi sedghi self-assigned this Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Reproduction Can we reproduce the reported bug?
Projects
None yet
Development

No branches or pull requests

7 participants