ivmartel / dwv

DICOM Web Viewer: open source zero footprint medical image library.
https://ivmartel.github.io/dwv/
GNU General Public License v3.0
1.64k stars 588 forks source link

Window Dicom Element Freezes Webpage On iOS Devices (Blazor) #1568

Open allanhitch opened 9 months ago

allanhitch commented 9 months ago

When displaying any dicom our webpage becomes unresponsive on all iOS devices (tested with an iPad10 and iPhone14pro) until the popup is closed. The viewer is responsive on android and desktop devices. This is being rendered on a Blazor window popup.

Code to display the dicom:

<div id="@($"dwv:{_fileName}{Index}")">
    <div id='layerGroup0'></div>
</div>

JS Invoke call:

var stream = new DotNetStreamReference(await response.Content.ReadAsStreamAsync());
await JS.InvokeVoidAsync("loadDicomFile", $"dwv:{_fileName}{Index}", stream);

loadDicomFile JS:

const arrayBuffer = await contentStreamRef.arrayBuffer();
const app = new dwv.App();

const viewConfig0 = new dwv.ViewConfig('layerGroup0');
const viewConfigs = { '*': [viewConfig0] };

const options = new dwv.AppOptions(viewConfigs);
options.tools = { WindowLevel: new dwv.ToolConfig() };

app.init(options);

app.addEventListener('load', function () {
    app.setTool('WindowLevel');
});

app.loadImageObject([{ name: "", filename: "", data: arrayBuffer }]);
allanhitch commented 9 months ago

Screenshot 2023-12-11 094303 Screenshot 2023-12-11 094549

ivmartel commented 8 months ago

Windowing can be costly, it gets worse with large data (high number of columns and rows). What size is the data you are loading? I mainly use Firefox and Chrome, it's been some time I did not test with Safari or Edge.

allanhitch commented 8 months ago

I just tested Firefox on the iPhone with the same results. The DCM files are all around 8-9 MB in size.