Electron integration advise

I’m working on integrating ohif into a standalone app using electron and ran into some issues I figured id ask about. I’m new to developing with OHIF and im still getting familiar with the codebase so its quite likely something simple im overlooking.

I’m using the current master of ohif and electron v24.3.0

Ive been using the PR Add Desktop Electron client by swederik · Pull Request #1781 · OHIF/Viewers · GitHub as an initial reference. I’ve managed to to get the build process working and based on the console logs, cornerstone is loading.

When i launch electron though im presented with a blank page. Its likely its not starting on the correct page as i haven’t handled that yet… though, i would expect something to load.

I’m also given an error on page load

“Cross Origin Isolation
Cross Origin Isolation is not enabled, volume rendering will not work (e.g., MPR)”

I’ve been digging in to try to determine what could cause that but so far ive been unsuccessful. I turned off websecurity for electron and made sure CORS was being handled but same result.

If i launch the viewer in dev mode and have electron load that url rather then the built distribution, it works perfectly.

Based on the console log, the only thing that looks potentially strange is a warning
part of the UINotificationService

Any help or advise would be greatly appreciated!

Hi @xploited and welcome to the community forum.

Not sure how much I can help you regarding the Electron integration itself, but the ‘Cross Origin Isolation’ problem is likely caused by OHIF’s use of SharedArrayBuffer. There is this PR that will allow one to use OHIF and view non-MPR studies/images over HTTP with an non-secure context (i.e. non localhost). However, to view MPR, you will have to deploy OHIF via HTTPS. Note that deploying over HTTPS will also fix the problem without that PR.

You can find more information in the following threads…

I hope this helps.

Hi, did you manage to progress on packaging the viewer using Electron?

If so do you have a public repo “to look” at? Trying to do the same but getting troubles along the way, mostly by being fairly new to the tooling.