cornerstoneWADOImageLoader
cornerstoneWADOImageLoader copied to clipboard
support web-workers for jpeg-8 color using built-in features 'createImageBitmap' and 'OffscreenCanvas' for enhanced performance
For JPEGBaseline8BitColor images the decoder currently uses the img element and HTML Canvas by converting binary image data to Base64 to support the decoding. https://github.com/cornerstonejs/cornerstoneWADOImageLoader/blob/master/src/imageLoader/decodeJPEGBaseline8BitColor.js#L30
This process:
- Prevent using web-workers as DOM elements can't be used/created there
- May suffer from performance issues when binary data is large and converting to base64
A better approach is using the new native JavaScript features 'createImageBitmap' and 'OffscreenCanvas' -when supported- to decode the image and run it in a web-worker:
- OffscreenCanvas in web-wroker is will improve the performance as suggested by several posts such as: https://developers.google.com/web/updates/2018/08/offscreen-canvas
- No need to convert the image binary data to base64 when using the
createImageBitmapmethod - We can now take advantage of web-workers