cornerstoneWADOImageLoader
cornerstoneWADOImageLoader copied to clipboard
fix: copy buffer to prevent oom in workers
Large uncompressed multiframe data will send the full arraybuffer in a typed view. For large uncompressed data such as tomo these will result in OOM issues. This fix pre-slices the typed array view so only used buffer is sent via worker.postMessage.
Deploy Preview for cornerstone-wado-image-loader ready!
| Name | Link |
|---|---|
| Latest commit | f793009171f33f7cdd73ce2840d9011ffd9173aa |
| Latest deploy log | https://app.netlify.com/sites/cornerstone-wado-image-loader/deploys/62bb2e76b7e57e000a4f031b |
| Deploy Preview | https://deploy-preview-454--cornerstone-wado-image-loader.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
The preview is not loading for me:
Uncaught (in promise) DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'blob:https://deploy-preview-454--cornerstone-wado-image-loader.netlify.app/888.bundle.min.worker.js' failed to load.
at B.f.i (blob:https://deploy-preview-454--cornerstone-wado-image-loader.netlify.app/cc21dc5d-801e-4e29-8d21-aeb5b116536c:1:795575)
at blob:https://deploy-preview-454--cornerstone-wado-image-loader.netlify.app/cc21dc5d-801e-4e29-8d21-aeb5b116536c:1:794747
at Array.reduce (<anonymous>)
at B.e (blob:https://deploy-preview-454--cornerstone-wado-image-loader.netlify.app/cc21dc5d-801e-4e29-8d21-aeb5b116536c:1:794725)
at blob:https://deploy-preview-454--cornerstone-wado-image-loader.netlify.app/cc21dc5d-801e-4e29-8d21-aeb5b116536c:1:807294
at new Promise (<anonymous>)
at new I (blob:https://deploy-preview-454--cornerstone-wado-image-loader.netlify.app/cc21dc5d-801e-4e29-8d21-aeb5b116536c:1:120704)
at yA (blob:https://deploy-preview-454--cornerstone-wado-image-loader.netlify.app/cc21dc5d-801e-4e29-8d21-aeb5b116536c:1:807268)
at blob:https://deploy-preview-454--cornerstone-wado-image-loader.netlify.app/cc21dc5d-801e-4e29-8d21-aeb5b116536c:1:807529
at a (blob:https://deploy-preview-454--cornerstone-wado-image-loader.netlify.app/cc21dc5d-801e-4e29-8d21-aeb5b116536c:1:1528)
How can I use this solution to handle out of memory Problem ?
Thanks @Ouwen! This solves a big problem and we definitely want it merged.
Some feedback before we can merge this, though:
- Add a check if SharedArrayBuffer exists and if the window.crossOriginIsolated is true. If those are true, use a SharedArrayBuffer for the pixel data for WADO-URI. Then it doesn’t need to be transferred to the worker at all. We can run the check once on library initialization.
- If the check is false, use .slice() to copy the buffer. That means this function getUncompressedImageFrame should have a third argument for “copyPixelData” or some other name (default false) which should enable the usage of .slice(). For WADO-RS we do not want this behaviour. We only want it when SharedArrayBuffer is not supported AND it is WADO-URI or a local DICOM file.
Tagging @jmannau because he's asked about this in Slack.
The fix works great for me in the given example with a 293 slice US
Hello, this is a great PR as it solves our problem. Any chance of it to be finished and merged? Thank you!
Hi all, It looks like this fix may solve our memory crash problem in Windows machines. Any chance of merging it soon? Thank you!
:tada: This PR is included in version 4.13.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket: