From 12d23fbd1d4383c08cf76ac50ed422f74d3c6230 Mon Sep 17 00:00:00 2001 From: ruanwenfeng Date: Wed, 16 Jul 2025 10:35:04 +0800 Subject: [PATCH] fix(dicom): image reading error when singleSortedSeries is true Ensure inputs and options.inputImages order consistency to prevent image reading errors when singleSortedSeries flag is enabled. --- .../dicom/typescript/src/read-image-dicom-file-series.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/dicom/typescript/src/read-image-dicom-file-series.ts b/packages/dicom/typescript/src/read-image-dicom-file-series.ts index e7e33bac7..d45bf907d 100644 --- a/packages/dicom/typescript/src/read-image-dicom-file-series.ts +++ b/packages/dicom/typescript/src/read-image-dicom-file-series.ts @@ -27,19 +27,17 @@ async function readImageDicomFileSeries( workerPool = new WorkerPool(numberOfWorkers, readImageDicomFileSeriesWorkerFunction) } - const inputs: Array = [ - ] if(options.inputImages.length < 1) { throw new Error('"input-images" option must have a length > 1') } - await Promise.all(options.inputImages.map(async (value) => { + const inputs: Array = await Promise.all(options.inputImages.map(async (value) => { let valueFile = value if (value instanceof File) { const valueBuffer = await value.arrayBuffer() valueFile = { path: value.name, data: new Uint8Array(valueBuffer) } } - inputs.push(valueFile as BinaryFile) + return valueFile as BinaryFile })) if (options.singleSortedSeries) {