dicom-curate 0.40.4 → 0.40.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/applyMappingsWorker.js +11 -5
- package/dist/esm/curateOne.js +11 -5
- package/dist/esm/index.js +11 -5
- package/dist/esm/mappingWorkerPool.js +11 -5
- package/dist/umd/dicom-curate.umd.js +56 -10
- package/dist/umd/dicom-curate.umd.js.map +1 -1
- package/dist/umd/dicom-curate.umd.min.js +2 -2
- package/dist/umd/dicom-curate.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -86801,12 +86801,18 @@ async function curateOne({
|
|
|
86801
86801
|
const reader = new async.AsyncDicomReader();
|
|
86802
86802
|
const parseFeed = cancellableReadableStreamIterable(file.stream());
|
|
86803
86803
|
const feedDone = reader.stream.fromAsyncStream(parseFeed.iterable);
|
|
86804
|
+
const feedErrorSignal = new Promise((_, reject) => {
|
|
86805
|
+
feedDone.catch(reject);
|
|
86806
|
+
});
|
|
86804
86807
|
try {
|
|
86805
|
-
await
|
|
86806
|
-
|
|
86807
|
-
|
|
86808
|
-
|
|
86809
|
-
|
|
86808
|
+
await Promise.race([
|
|
86809
|
+
reader.readFile({
|
|
86810
|
+
ignoreErrors: true,
|
|
86811
|
+
noCopy: true,
|
|
86812
|
+
untilTag: "7FE00010"
|
|
86813
|
+
}),
|
|
86814
|
+
feedErrorSignal
|
|
86815
|
+
]);
|
|
86810
86816
|
} finally {
|
|
86811
86817
|
await parseFeed.cancel();
|
|
86812
86818
|
await feedDone.catch(() => {
|
package/dist/esm/curateOne.js
CHANGED
|
@@ -80510,12 +80510,18 @@ async function curateOne({
|
|
|
80510
80510
|
const reader = new async.AsyncDicomReader();
|
|
80511
80511
|
const parseFeed = cancellableReadableStreamIterable(file.stream());
|
|
80512
80512
|
const feedDone = reader.stream.fromAsyncStream(parseFeed.iterable);
|
|
80513
|
+
const feedErrorSignal = new Promise((_, reject) => {
|
|
80514
|
+
feedDone.catch(reject);
|
|
80515
|
+
});
|
|
80513
80516
|
try {
|
|
80514
|
-
await
|
|
80515
|
-
|
|
80516
|
-
|
|
80517
|
-
|
|
80518
|
-
|
|
80517
|
+
await Promise.race([
|
|
80518
|
+
reader.readFile({
|
|
80519
|
+
ignoreErrors: true,
|
|
80520
|
+
noCopy: true,
|
|
80521
|
+
untilTag: "7FE00010"
|
|
80522
|
+
}),
|
|
80523
|
+
feedErrorSignal
|
|
80524
|
+
]);
|
|
80519
80525
|
} finally {
|
|
80520
80526
|
await parseFeed.cancel();
|
|
80521
80527
|
await feedDone.catch(() => {
|
package/dist/esm/index.js
CHANGED
|
@@ -88404,12 +88404,18 @@ async function curateOne({
|
|
|
88404
88404
|
const reader = new async.AsyncDicomReader();
|
|
88405
88405
|
const parseFeed = cancellableReadableStreamIterable(file.stream());
|
|
88406
88406
|
const feedDone = reader.stream.fromAsyncStream(parseFeed.iterable);
|
|
88407
|
+
const feedErrorSignal = new Promise((_, reject) => {
|
|
88408
|
+
feedDone.catch(reject);
|
|
88409
|
+
});
|
|
88407
88410
|
try {
|
|
88408
|
-
await
|
|
88409
|
-
|
|
88410
|
-
|
|
88411
|
-
|
|
88412
|
-
|
|
88411
|
+
await Promise.race([
|
|
88412
|
+
reader.readFile({
|
|
88413
|
+
ignoreErrors: true,
|
|
88414
|
+
noCopy: true,
|
|
88415
|
+
untilTag: "7FE00010"
|
|
88416
|
+
}),
|
|
88417
|
+
feedErrorSignal
|
|
88418
|
+
]);
|
|
88413
88419
|
} finally {
|
|
88414
88420
|
await parseFeed.cancel();
|
|
88415
88421
|
await feedDone.catch(() => {
|
|
@@ -86801,12 +86801,18 @@ async function curateOne({
|
|
|
86801
86801
|
const reader = new async.AsyncDicomReader();
|
|
86802
86802
|
const parseFeed = cancellableReadableStreamIterable(file.stream());
|
|
86803
86803
|
const feedDone = reader.stream.fromAsyncStream(parseFeed.iterable);
|
|
86804
|
+
const feedErrorSignal = new Promise((_, reject) => {
|
|
86805
|
+
feedDone.catch(reject);
|
|
86806
|
+
});
|
|
86804
86807
|
try {
|
|
86805
|
-
await
|
|
86806
|
-
|
|
86807
|
-
|
|
86808
|
-
|
|
86809
|
-
|
|
86808
|
+
await Promise.race([
|
|
86809
|
+
reader.readFile({
|
|
86810
|
+
ignoreErrors: true,
|
|
86811
|
+
noCopy: true,
|
|
86812
|
+
untilTag: "7FE00010"
|
|
86813
|
+
}),
|
|
86814
|
+
feedErrorSignal
|
|
86815
|
+
]);
|
|
86810
86816
|
} finally {
|
|
86811
86817
|
await parseFeed.cancel();
|
|
86812
86818
|
await feedDone.catch(() => {
|
|
@@ -55110,17 +55110,40 @@
|
|
|
55110
55110
|
const reader = new async.AsyncDicomReader();
|
|
55111
55111
|
const parseFeed = cancellableReadableStreamIterable(file.stream());
|
|
55112
55112
|
const feedDone = reader.stream.fromAsyncStream(parseFeed.iterable);
|
|
55113
|
+
// Build a "never resolves, only rejects" sentinel from feedDone so we can
|
|
55114
|
+
// race it against readFile() without letting a normal feedDone resolution
|
|
55115
|
+
// exit the race too early (fromAsyncStream resolves after setComplete() but
|
|
55116
|
+
// before readFile() finishes parsing the buffered data).
|
|
55117
|
+
//
|
|
55118
|
+
// Attaching .catch() here also prevents "Uncaught (in promise)" in the
|
|
55119
|
+
// failure case: if the underlying ReadableStream fails (e.g. a mode-0000
|
|
55120
|
+
// file that Chrome reads via its network service and reports as
|
|
55121
|
+
// "TypeError: network error"), feedDone rejects while readFile() is still
|
|
55122
|
+
// blocked inside ensureAvailable() — which has no timeout and can only be
|
|
55123
|
+
// woken by addBuffer/setComplete, calls that never come when fromAsyncStream
|
|
55124
|
+
// threw. Without this early .catch() the browser fires "Uncaught (in
|
|
55125
|
+
// promise)" before the finally block ever runs.
|
|
55126
|
+
const feedErrorSignal = new Promise((_, reject) => {
|
|
55127
|
+
feedDone.catch(reject);
|
|
55128
|
+
});
|
|
55113
55129
|
// Stop reading at the PixelData tag. The fixed dcmjs read() loop breaks
|
|
55114
55130
|
// out of the scan when readTagHeader() returns {untilTag: true}, leaving
|
|
55115
55131
|
// stream.offset pointing at the byte immediately after the 4-byte tag
|
|
55116
55132
|
// (i.e. the VR field for explicit-LE). Subtracting 4 gives the start of
|
|
55117
55133
|
// the PixelData tag, which is exactly the offset we need for the slice.
|
|
55118
55134
|
try {
|
|
55119
|
-
|
|
55120
|
-
|
|
55121
|
-
|
|
55122
|
-
|
|
55123
|
-
|
|
55135
|
+
// Race readFile against feedErrorSignal: on a normal run feedErrorSignal
|
|
55136
|
+
// stays pending forever so readFile wins; on stream failure feedErrorSignal
|
|
55137
|
+
// rejects immediately, breaking the deadlock where readFile() would hang
|
|
55138
|
+
// waiting for data that will never arrive.
|
|
55139
|
+
await Promise.race([
|
|
55140
|
+
reader.readFile({
|
|
55141
|
+
ignoreErrors: true,
|
|
55142
|
+
noCopy: true,
|
|
55143
|
+
untilTag: '7FE00010',
|
|
55144
|
+
}),
|
|
55145
|
+
feedErrorSignal,
|
|
55146
|
+
]);
|
|
55124
55147
|
}
|
|
55125
55148
|
finally {
|
|
55126
55149
|
// Do not await feedDone without cancelling first: dcmjs fromAsyncStream
|
|
@@ -126856,17 +126879,40 @@
|
|
|
126856
126879
|
const reader = new async.AsyncDicomReader();
|
|
126857
126880
|
const parseFeed = cancellableReadableStreamIterable(file.stream());
|
|
126858
126881
|
const feedDone = reader.stream.fromAsyncStream(parseFeed.iterable);
|
|
126882
|
+
// Build a "never resolves, only rejects" sentinel from feedDone so we can
|
|
126883
|
+
// race it against readFile() without letting a normal feedDone resolution
|
|
126884
|
+
// exit the race too early (fromAsyncStream resolves after setComplete() but
|
|
126885
|
+
// before readFile() finishes parsing the buffered data).
|
|
126886
|
+
//
|
|
126887
|
+
// Attaching .catch() here also prevents "Uncaught (in promise)" in the
|
|
126888
|
+
// failure case: if the underlying ReadableStream fails (e.g. a mode-0000
|
|
126889
|
+
// file that Chrome reads via its network service and reports as
|
|
126890
|
+
// "TypeError: network error"), feedDone rejects while readFile() is still
|
|
126891
|
+
// blocked inside ensureAvailable() — which has no timeout and can only be
|
|
126892
|
+
// woken by addBuffer/setComplete, calls that never come when fromAsyncStream
|
|
126893
|
+
// threw. Without this early .catch() the browser fires "Uncaught (in
|
|
126894
|
+
// promise)" before the finally block ever runs.
|
|
126895
|
+
const feedErrorSignal = new Promise((_, reject) => {
|
|
126896
|
+
feedDone.catch(reject);
|
|
126897
|
+
});
|
|
126859
126898
|
// Stop reading at the PixelData tag. The fixed dcmjs read() loop breaks
|
|
126860
126899
|
// out of the scan when readTagHeader() returns {untilTag: true}, leaving
|
|
126861
126900
|
// stream.offset pointing at the byte immediately after the 4-byte tag
|
|
126862
126901
|
// (i.e. the VR field for explicit-LE). Subtracting 4 gives the start of
|
|
126863
126902
|
// the PixelData tag, which is exactly the offset we need for the slice.
|
|
126864
126903
|
try {
|
|
126865
|
-
|
|
126866
|
-
|
|
126867
|
-
|
|
126868
|
-
|
|
126869
|
-
|
|
126904
|
+
// Race readFile against feedErrorSignal: on a normal run feedErrorSignal
|
|
126905
|
+
// stays pending forever so readFile wins; on stream failure feedErrorSignal
|
|
126906
|
+
// rejects immediately, breaking the deadlock where readFile() would hang
|
|
126907
|
+
// waiting for data that will never arrive.
|
|
126908
|
+
await Promise.race([
|
|
126909
|
+
reader.readFile({
|
|
126910
|
+
ignoreErrors: true,
|
|
126911
|
+
noCopy: true,
|
|
126912
|
+
untilTag: '7FE00010',
|
|
126913
|
+
}),
|
|
126914
|
+
feedErrorSignal,
|
|
126915
|
+
]);
|
|
126870
126916
|
}
|
|
126871
126917
|
finally {
|
|
126872
126918
|
// Do not await feedDone without cancelling first: dcmjs fromAsyncStream
|