Viewers
Viewers copied to clipboard
[Bug] OHIF not working on some Android devices
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:
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
- Open the OHIF viewer on a Samsung Android device
- Load the following study: Study Link
- 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
Have you tried on more recent android os?
Hello Sedghi, many users do not have the financial capacity to maintain the latest generation equipment.
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:
Additionally, we’ve tested it on a Pixel device running Android 12, and instances are loaded properly:
Same here, we have tested on Honor, Xiaomi and it works, on mid and low range Samsung it fails
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!
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
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.
I also have this problem. Is there a way to define useCPURendering only on Android devices?
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
@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.
@ionutdobre Which Samsung phone did you test? mid, low-range.. specifically? still persist?
@ionutdobre can you try on the latest release and let us know?
https://github.com/cornerstonejs/cornerstone3D/issues/978
Relevant issue at Cornerstone repo as well
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
@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
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
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
// ...
};
Thanks @slak44 i will update our version then
Can you check in 10 mins or so https://viewer-dev.ohif.org/ ?
Any update here?
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:
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
viewer.ohif.org has not been updated yet. So great news. Thanks @slak44 I'm updating the viewer.ohif.org this week
@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)
related https://github.com/Kitware/vtk-js/pull/3194
can you guys check again? since we recently upgraded cs3d (hence vtk.js)
Provide the result of https://debug.ohif.org here
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):
on this device everything is fine
Please post debug.ohif.org result for each of them
Sure, here are the results
@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
I’m still experiencing the same issues. Here are some screenshots for reference; let me know if you need any additional details!