From b2277956f7d7100aa6aa8479f1d82db736b62bc8 Mon Sep 17 00:00:00 2001 From: Alireza Date: Thu, 5 Jan 2023 16:02:24 -0500 Subject: [PATCH] feat: add option to skipi image creation (#504) Looks good to me - simply change to allow skipping the image creation. --- src/imageLoader/createImage.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/imageLoader/createImage.js b/src/imageLoader/createImage.js index 83df325b..decfe61d 100644 --- a/src/imageLoader/createImage.js +++ b/src/imageLoader/createImage.js @@ -150,6 +150,12 @@ function createImage(imageId, pixelData, transferSyntax, options = {}) { return new Promise((resolve, reject) => { // eslint-disable-next-line complexity decodePromise.then(function (imageFrame) { + // if it is desired to skip creating image, return the imageFrame + // after the decode. This might be useful for some applications + // that only need the decoded pixel data and not the image object + if (options.skipCreateImage) { + return resolve(imageFrame); + } // If we have a target buffer that was written to in the // Decode task, point the image to it here. // We can't have done it within the thread incase it was a SharedArrayBuffer.