Skip to content

Commit 12d23fb

Browse files
authored
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.
1 parent 38d2c83 commit 12d23fb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

packages/dicom/typescript/src/read-image-dicom-file-series.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,17 @@ async function readImageDicomFileSeries(
2727
workerPool = new WorkerPool(numberOfWorkers, readImageDicomFileSeriesWorkerFunction)
2828
}
2929

30-
const inputs: Array<BinaryFile> = [
31-
]
3230
if(options.inputImages.length < 1) {
3331
throw new Error('"input-images" option must have a length > 1')
3432
}
3533

36-
await Promise.all(options.inputImages.map(async (value) => {
34+
const inputs: Array<BinaryFile> = await Promise.all(options.inputImages.map(async (value) => {
3735
let valueFile = value
3836
if (value instanceof File) {
3937
const valueBuffer = await value.arrayBuffer()
4038
valueFile = { path: value.name, data: new Uint8Array(valueBuffer) }
4139
}
42-
inputs.push(valueFile as BinaryFile)
40+
return valueFile as BinaryFile
4341
}))
4442

4543
if (options.singleSortedSeries) {

0 commit comments

Comments
 (0)