dicom-curate 0.8.4 → 0.9.0
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/README.md +3 -5
- package/dist/esm/applyMappingsWorker.js +6 -123
- package/dist/esm/collectMappings.js +6 -123
- package/dist/esm/composeSpecs.js +5 -80
- package/dist/esm/config/sample2PassCurationSpecification.js +0 -4
- package/dist/esm/config/sampleCompositeSpecification.js +0 -4
- package/dist/esm/curateDict.js +6 -123
- package/dist/esm/curateOne.js +6 -123
- package/dist/esm/defaultSpec.js +5 -80
- package/dist/esm/deidentifyPS315E.js +6 -82
- package/dist/esm/getParser.js +6 -125
- package/dist/esm/index.js +111 -240
- package/dist/types/getParser.d.ts +0 -3
- package/dist/types/index.d.ts +1 -2
- package/dist/types/types.d.ts +0 -2
- package/dist/umd/dicom-curate.umd.js +127 -344
- package/dist/umd/dicom-curate.umd.js.map +1 -1
- package/dist/umd/dicom-curate.umd.min.js +3 -3
- package/dist/umd/dicom-curate.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/esm/UniqueNumbers.js +0 -15
- package/dist/esm/clearCaches.js +0 -29084
- package/dist/esm/replaceUid.js +0 -12775
- package/dist/types/UniqueNumbers.d.ts +0 -4
- package/dist/types/clearCaches.d.ts +0 -1
- package/dist/types/replaceUid.d.ts +0 -3
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ If `outputDirectory` is omitted, output `Blob`s will be passed to the `onProgres
|
|
|
69
69
|
You can also call `curateOne` directly and receive a promise with the mapped blob:
|
|
70
70
|
|
|
71
71
|
```ts
|
|
72
|
-
import { curateOne, extractColumnMappings
|
|
72
|
+
import { curateOne, extractColumnMappings } from 'dicom-curate'
|
|
73
73
|
|
|
74
74
|
// Data prep responsibility for optional table is with caller
|
|
75
75
|
const columnMappings = extractColumnMappings([
|
|
@@ -81,9 +81,6 @@ curateOne({
|
|
|
81
81
|
fileInfo, // path, name, size, kind, blob
|
|
82
82
|
mappingOptions: { curationSpec, columnMappings },
|
|
83
83
|
})
|
|
84
|
-
|
|
85
|
-
// Cache clean-up responsibility, e.g. for consistent UID mapping in `retainUIDsOption: 'Off'` is with caller
|
|
86
|
-
clearCaches()
|
|
87
84
|
```
|
|
88
85
|
|
|
89
86
|
An example DICOM curation function:
|
|
@@ -229,7 +226,7 @@ dicom-curate
|
|
|
229
226
|
- 'retainLongitudinalTemporalInformationOptions': this considers all temporal attributes (DA, TM, DT), as described as a possible approach in PS3.15E.
|
|
230
227
|
Possible values are 'Full' (keep all temporal info intact), 'Off' (remove all temporal attributes or add defaults per PS3.15E), or 'Offset' (move all temporal attributes by a duration. An ISO-8601 compliant duration `dateOffset` parameter must be passed).
|
|
231
228
|
- 'retainDeviceIdentityOption': true or false. If true, overrides `retainLongitudinalTemporalInformationOptions` for the respective attributes to keep.
|
|
232
|
-
- 'retainUIDsOption': 'On', '
|
|
229
|
+
- 'retainUIDsOption': 'On', 'Hashed'.
|
|
233
230
|
- If 'On', maintain all UIDs.
|
|
234
231
|
- If 'Off', replaces instance UIDs with arbitrary new UIDs, maintaining referential integrity within a single run.
|
|
235
232
|
- maximum protection
|
|
@@ -239,6 +236,7 @@ dicom-curate
|
|
|
239
236
|
- maintains referential integrity even if de-identifying data in separate, or decentralized, batches
|
|
240
237
|
- use if the risk of re-identifying by UID is not bigger than the risk of re-identifying by PixelData
|
|
241
238
|
- do not use if you want to specifically protect UIDs from an auxiliary knowledge attack, e.g. an attacker that knows possible input UIDs
|
|
239
|
+
- For compatibility, the 'Off' option is now treated the same way as 'Hashed'.
|
|
242
240
|
- There are more instance UIDs in part PS3.06 than described in PS3.15E for protection, therefore this option identifies the following uids for protection: 1. All instance UIDs per PS3.15E, 2. Any additional UIDs with a value not well-known in DICOM, per table PS3.06A (Registry of DICOM Unique Identifiers). This protects instance UIDs but also private class UIDs, which is intentional.
|
|
243
241
|
- 'retainSafePrivateOption': 'Quarantine' or 'Off'. If 'Quarantine', keeps all private tags but creates a quarantine log for manual review
|
|
244
242
|
- 'retainInstitutionIdentityOption': true or false
|
|
@@ -4559,17 +4559,17 @@ var require_lodash = __commonJS({
|
|
|
4559
4559
|
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
|
|
4560
4560
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
4561
4561
|
}
|
|
4562
|
-
var
|
|
4563
|
-
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache =
|
|
4562
|
+
var memoized = function() {
|
|
4563
|
+
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
|
|
4564
4564
|
if (cache.has(key)) {
|
|
4565
4565
|
return cache.get(key);
|
|
4566
4566
|
}
|
|
4567
4567
|
var result2 = func.apply(this, args);
|
|
4568
|
-
|
|
4568
|
+
memoized.cache = cache.set(key, result2) || cache;
|
|
4569
4569
|
return result2;
|
|
4570
4570
|
};
|
|
4571
|
-
|
|
4572
|
-
return
|
|
4571
|
+
memoized.cache = new (memoize.Cache || MapCache)();
|
|
4572
|
+
return memoized;
|
|
4573
4573
|
}
|
|
4574
4574
|
memoize.Cache = MapCache;
|
|
4575
4575
|
function negate2(predicate) {
|
|
@@ -25190,82 +25190,6 @@ function hashUid(uid) {
|
|
|
25190
25190
|
return uuidBasedUIDPrefix + hashedString;
|
|
25191
25191
|
}
|
|
25192
25192
|
|
|
25193
|
-
// node_modules/.pnpm/memize@2.1.1/node_modules/memize/dist/index.js
|
|
25194
|
-
function memize(fn, options) {
|
|
25195
|
-
var size = 0;
|
|
25196
|
-
var head;
|
|
25197
|
-
var tail;
|
|
25198
|
-
options = options || {};
|
|
25199
|
-
function memoized2() {
|
|
25200
|
-
var node = head, len2 = arguments.length, args, i;
|
|
25201
|
-
searchCache:
|
|
25202
|
-
while (node) {
|
|
25203
|
-
if (node.args.length !== arguments.length) {
|
|
25204
|
-
node = node.next;
|
|
25205
|
-
continue;
|
|
25206
|
-
}
|
|
25207
|
-
for (i = 0; i < len2; i++) {
|
|
25208
|
-
if (node.args[i] !== arguments[i]) {
|
|
25209
|
-
node = node.next;
|
|
25210
|
-
continue searchCache;
|
|
25211
|
-
}
|
|
25212
|
-
}
|
|
25213
|
-
if (node !== head) {
|
|
25214
|
-
if (node === tail) {
|
|
25215
|
-
tail = node.prev;
|
|
25216
|
-
}
|
|
25217
|
-
node.prev.next = node.next;
|
|
25218
|
-
if (node.next) {
|
|
25219
|
-
node.next.prev = node.prev;
|
|
25220
|
-
}
|
|
25221
|
-
node.next = head;
|
|
25222
|
-
node.prev = null;
|
|
25223
|
-
head.prev = node;
|
|
25224
|
-
head = node;
|
|
25225
|
-
}
|
|
25226
|
-
return node.val;
|
|
25227
|
-
}
|
|
25228
|
-
args = new Array(len2);
|
|
25229
|
-
for (i = 0; i < len2; i++) {
|
|
25230
|
-
args[i] = arguments[i];
|
|
25231
|
-
}
|
|
25232
|
-
node = {
|
|
25233
|
-
args,
|
|
25234
|
-
// Generate the result from original function
|
|
25235
|
-
val: fn.apply(null, args)
|
|
25236
|
-
};
|
|
25237
|
-
if (head) {
|
|
25238
|
-
head.prev = node;
|
|
25239
|
-
node.next = head;
|
|
25240
|
-
} else {
|
|
25241
|
-
tail = node;
|
|
25242
|
-
}
|
|
25243
|
-
if (size === /** @type {MemizeOptions} */
|
|
25244
|
-
options.maxSize) {
|
|
25245
|
-
tail = /** @type {MemizeCacheNode} */
|
|
25246
|
-
tail.prev;
|
|
25247
|
-
tail.next = null;
|
|
25248
|
-
} else {
|
|
25249
|
-
size++;
|
|
25250
|
-
}
|
|
25251
|
-
head = node;
|
|
25252
|
-
return node.val;
|
|
25253
|
-
}
|
|
25254
|
-
memoized2.clear = function() {
|
|
25255
|
-
head = null;
|
|
25256
|
-
tail = null;
|
|
25257
|
-
size = 0;
|
|
25258
|
-
};
|
|
25259
|
-
return memoized2;
|
|
25260
|
-
}
|
|
25261
|
-
|
|
25262
|
-
// src/replaceUid.ts
|
|
25263
|
-
function replaceUid(uid) {
|
|
25264
|
-
return data.DicomMetaDictionary.uid();
|
|
25265
|
-
}
|
|
25266
|
-
var memoized = memize(replaceUid);
|
|
25267
|
-
var replaceUid_default = memoized;
|
|
25268
|
-
|
|
25269
25193
|
// src/config/dicom/elementNamesToAlwaysKeep.ts
|
|
25270
25194
|
var elementNamesToAlwaysKeep = [
|
|
25271
25195
|
"LengthToEnd",
|
|
@@ -36199,7 +36123,7 @@ function removeRetiredPrefix(name) {
|
|
|
36199
36123
|
return name.startsWith("RETIRED_") ? name.slice(8) : name;
|
|
36200
36124
|
}
|
|
36201
36125
|
function protectUid(uid, retainUIDsOption) {
|
|
36202
|
-
return
|
|
36126
|
+
return hashUid(uid);
|
|
36203
36127
|
}
|
|
36204
36128
|
var elementNamesToAlwaysKeepSet = new Set(elementNamesToAlwaysKeep);
|
|
36205
36129
|
var ps315EElements2 = ps315EElements.map((elm) => {
|
|
@@ -36697,43 +36621,9 @@ function getCsvMapping(columnMappings, mapping, mappingKey, value) {
|
|
|
36697
36621
|
return mapping[mappingKey].replace(columnMappings.rows[rowIdx]);
|
|
36698
36622
|
}
|
|
36699
36623
|
|
|
36700
|
-
// src/UniqueNumbers.ts
|
|
36701
|
-
function UniqueNumbers(padding = 5) {
|
|
36702
|
-
let groupCounters = {};
|
|
36703
|
-
function getUniqueNumberInGroup2(groupingId) {
|
|
36704
|
-
groupCounters[groupingId] = groupCounters[groupingId] ? groupCounters[groupingId] + 1 : 1;
|
|
36705
|
-
return groupCounters[groupingId].toString().padStart(padding, "0");
|
|
36706
|
-
}
|
|
36707
|
-
function clearUniqueNumberCache2() {
|
|
36708
|
-
groupCounters = {};
|
|
36709
|
-
}
|
|
36710
|
-
return { getUniqueNumberInGroup: getUniqueNumberInGroup2, clearUniqueNumberCache: clearUniqueNumberCache2 };
|
|
36711
|
-
}
|
|
36712
|
-
|
|
36713
36624
|
// src/getParser.ts
|
|
36714
36625
|
var FILEBASENAME = Symbol("fileBasename");
|
|
36715
36626
|
var FILENAME = Symbol("filename");
|
|
36716
|
-
var { getUniqueNumberInGroup, clearUniqueNumberCache } = UniqueNumbers(6);
|
|
36717
|
-
var { isUniqueInGroup, clearUniqueInGroupCache } = /* @__PURE__ */ function() {
|
|
36718
|
-
let cache = /* @__PURE__ */ new Set();
|
|
36719
|
-
let lastGroupId = "";
|
|
36720
|
-
return {
|
|
36721
|
-
isUniqueInGroup(value, groupId) {
|
|
36722
|
-
if (groupId !== lastGroupId) {
|
|
36723
|
-
cache = /* @__PURE__ */ new Set();
|
|
36724
|
-
lastGroupId = groupId;
|
|
36725
|
-
}
|
|
36726
|
-
if (cache.has(value)) {
|
|
36727
|
-
return false;
|
|
36728
|
-
}
|
|
36729
|
-
cache.add(value);
|
|
36730
|
-
return true;
|
|
36731
|
-
},
|
|
36732
|
-
clearUniqueInGroupCache() {
|
|
36733
|
-
cache = /* @__PURE__ */ new Set();
|
|
36734
|
-
}
|
|
36735
|
-
};
|
|
36736
|
-
}();
|
|
36737
36627
|
function getParser(inputPathPattern, inputFilePath, naturalData, dicomPS315EOptions, columnMappings, additionalData) {
|
|
36738
36628
|
function protectUid2(uid) {
|
|
36739
36629
|
let protectedUid = uid;
|
|
@@ -36783,13 +36673,6 @@ function getParser(inputPathPattern, inputFilePath, naturalData, dicomPS315EOpti
|
|
|
36783
36673
|
return typeof value === "undefined" || value === "";
|
|
36784
36674
|
}
|
|
36785
36675
|
return {
|
|
36786
|
-
// This function enables errors like:
|
|
36787
|
-
// [
|
|
36788
|
-
// 'Duplicate Instance Number(s)',
|
|
36789
|
-
// !parser.isUniqueInGroup(instanceNumber, seriesUid),
|
|
36790
|
-
// ],
|
|
36791
|
-
isUniqueInGroup,
|
|
36792
|
-
getUniqueNumberInGroup,
|
|
36793
36676
|
getFrom,
|
|
36794
36677
|
getFilePathComp,
|
|
36795
36678
|
getMapping,
|
|
@@ -4559,17 +4559,17 @@ var require_lodash = __commonJS({
|
|
|
4559
4559
|
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
|
|
4560
4560
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
4561
4561
|
}
|
|
4562
|
-
var
|
|
4563
|
-
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache =
|
|
4562
|
+
var memoized = function() {
|
|
4563
|
+
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
|
|
4564
4564
|
if (cache.has(key)) {
|
|
4565
4565
|
return cache.get(key);
|
|
4566
4566
|
}
|
|
4567
4567
|
var result2 = func.apply(this, args);
|
|
4568
|
-
|
|
4568
|
+
memoized.cache = cache.set(key, result2) || cache;
|
|
4569
4569
|
return result2;
|
|
4570
4570
|
};
|
|
4571
|
-
|
|
4572
|
-
return
|
|
4571
|
+
memoized.cache = new (memoize.Cache || MapCache)();
|
|
4572
|
+
return memoized;
|
|
4573
4573
|
}
|
|
4574
4574
|
memoize.Cache = MapCache;
|
|
4575
4575
|
function negate2(predicate) {
|
|
@@ -18875,82 +18875,6 @@ function hashUid(uid) {
|
|
|
18875
18875
|
return uuidBasedUIDPrefix + hashedString;
|
|
18876
18876
|
}
|
|
18877
18877
|
|
|
18878
|
-
// node_modules/.pnpm/memize@2.1.1/node_modules/memize/dist/index.js
|
|
18879
|
-
function memize(fn, options) {
|
|
18880
|
-
var size = 0;
|
|
18881
|
-
var head;
|
|
18882
|
-
var tail;
|
|
18883
|
-
options = options || {};
|
|
18884
|
-
function memoized2() {
|
|
18885
|
-
var node = head, len2 = arguments.length, args, i;
|
|
18886
|
-
searchCache:
|
|
18887
|
-
while (node) {
|
|
18888
|
-
if (node.args.length !== arguments.length) {
|
|
18889
|
-
node = node.next;
|
|
18890
|
-
continue;
|
|
18891
|
-
}
|
|
18892
|
-
for (i = 0; i < len2; i++) {
|
|
18893
|
-
if (node.args[i] !== arguments[i]) {
|
|
18894
|
-
node = node.next;
|
|
18895
|
-
continue searchCache;
|
|
18896
|
-
}
|
|
18897
|
-
}
|
|
18898
|
-
if (node !== head) {
|
|
18899
|
-
if (node === tail) {
|
|
18900
|
-
tail = node.prev;
|
|
18901
|
-
}
|
|
18902
|
-
node.prev.next = node.next;
|
|
18903
|
-
if (node.next) {
|
|
18904
|
-
node.next.prev = node.prev;
|
|
18905
|
-
}
|
|
18906
|
-
node.next = head;
|
|
18907
|
-
node.prev = null;
|
|
18908
|
-
head.prev = node;
|
|
18909
|
-
head = node;
|
|
18910
|
-
}
|
|
18911
|
-
return node.val;
|
|
18912
|
-
}
|
|
18913
|
-
args = new Array(len2);
|
|
18914
|
-
for (i = 0; i < len2; i++) {
|
|
18915
|
-
args[i] = arguments[i];
|
|
18916
|
-
}
|
|
18917
|
-
node = {
|
|
18918
|
-
args,
|
|
18919
|
-
// Generate the result from original function
|
|
18920
|
-
val: fn.apply(null, args)
|
|
18921
|
-
};
|
|
18922
|
-
if (head) {
|
|
18923
|
-
head.prev = node;
|
|
18924
|
-
node.next = head;
|
|
18925
|
-
} else {
|
|
18926
|
-
tail = node;
|
|
18927
|
-
}
|
|
18928
|
-
if (size === /** @type {MemizeOptions} */
|
|
18929
|
-
options.maxSize) {
|
|
18930
|
-
tail = /** @type {MemizeCacheNode} */
|
|
18931
|
-
tail.prev;
|
|
18932
|
-
tail.next = null;
|
|
18933
|
-
} else {
|
|
18934
|
-
size++;
|
|
18935
|
-
}
|
|
18936
|
-
head = node;
|
|
18937
|
-
return node.val;
|
|
18938
|
-
}
|
|
18939
|
-
memoized2.clear = function() {
|
|
18940
|
-
head = null;
|
|
18941
|
-
tail = null;
|
|
18942
|
-
size = 0;
|
|
18943
|
-
};
|
|
18944
|
-
return memoized2;
|
|
18945
|
-
}
|
|
18946
|
-
|
|
18947
|
-
// src/replaceUid.ts
|
|
18948
|
-
function replaceUid(uid) {
|
|
18949
|
-
return data.DicomMetaDictionary.uid();
|
|
18950
|
-
}
|
|
18951
|
-
var memoized = memize(replaceUid);
|
|
18952
|
-
var replaceUid_default = memoized;
|
|
18953
|
-
|
|
18954
18878
|
// src/config/dicom/elementNamesToAlwaysKeep.ts
|
|
18955
18879
|
var elementNamesToAlwaysKeep = [
|
|
18956
18880
|
"LengthToEnd",
|
|
@@ -29870,7 +29794,7 @@ function removeRetiredPrefix(name) {
|
|
|
29870
29794
|
return name.startsWith("RETIRED_") ? name.slice(8) : name;
|
|
29871
29795
|
}
|
|
29872
29796
|
function protectUid(uid, retainUIDsOption) {
|
|
29873
|
-
return
|
|
29797
|
+
return hashUid(uid);
|
|
29874
29798
|
}
|
|
29875
29799
|
var elementNamesToAlwaysKeepSet = new Set(elementNamesToAlwaysKeep);
|
|
29876
29800
|
var ps315EElements2 = ps315EElements.map((elm) => {
|
|
@@ -30368,43 +30292,9 @@ function getCsvMapping(columnMappings, mapping, mappingKey, value) {
|
|
|
30368
30292
|
return mapping[mappingKey].replace(columnMappings.rows[rowIdx]);
|
|
30369
30293
|
}
|
|
30370
30294
|
|
|
30371
|
-
// src/UniqueNumbers.ts
|
|
30372
|
-
function UniqueNumbers(padding = 5) {
|
|
30373
|
-
let groupCounters = {};
|
|
30374
|
-
function getUniqueNumberInGroup2(groupingId) {
|
|
30375
|
-
groupCounters[groupingId] = groupCounters[groupingId] ? groupCounters[groupingId] + 1 : 1;
|
|
30376
|
-
return groupCounters[groupingId].toString().padStart(padding, "0");
|
|
30377
|
-
}
|
|
30378
|
-
function clearUniqueNumberCache2() {
|
|
30379
|
-
groupCounters = {};
|
|
30380
|
-
}
|
|
30381
|
-
return { getUniqueNumberInGroup: getUniqueNumberInGroup2, clearUniqueNumberCache: clearUniqueNumberCache2 };
|
|
30382
|
-
}
|
|
30383
|
-
|
|
30384
30295
|
// src/getParser.ts
|
|
30385
30296
|
var FILEBASENAME = Symbol("fileBasename");
|
|
30386
30297
|
var FILENAME = Symbol("filename");
|
|
30387
|
-
var { getUniqueNumberInGroup, clearUniqueNumberCache } = UniqueNumbers(6);
|
|
30388
|
-
var { isUniqueInGroup, clearUniqueInGroupCache } = /* @__PURE__ */ function() {
|
|
30389
|
-
let cache = /* @__PURE__ */ new Set();
|
|
30390
|
-
let lastGroupId = "";
|
|
30391
|
-
return {
|
|
30392
|
-
isUniqueInGroup(value, groupId) {
|
|
30393
|
-
if (groupId !== lastGroupId) {
|
|
30394
|
-
cache = /* @__PURE__ */ new Set();
|
|
30395
|
-
lastGroupId = groupId;
|
|
30396
|
-
}
|
|
30397
|
-
if (cache.has(value)) {
|
|
30398
|
-
return false;
|
|
30399
|
-
}
|
|
30400
|
-
cache.add(value);
|
|
30401
|
-
return true;
|
|
30402
|
-
},
|
|
30403
|
-
clearUniqueInGroupCache() {
|
|
30404
|
-
cache = /* @__PURE__ */ new Set();
|
|
30405
|
-
}
|
|
30406
|
-
};
|
|
30407
|
-
}();
|
|
30408
30298
|
function getParser(inputPathPattern, inputFilePath, naturalData, dicomPS315EOptions, columnMappings, additionalData) {
|
|
30409
30299
|
function protectUid2(uid) {
|
|
30410
30300
|
let protectedUid = uid;
|
|
@@ -30454,13 +30344,6 @@ function getParser(inputPathPattern, inputFilePath, naturalData, dicomPS315EOpti
|
|
|
30454
30344
|
return typeof value === "undefined" || value === "";
|
|
30455
30345
|
}
|
|
30456
30346
|
return {
|
|
30457
|
-
// This function enables errors like:
|
|
30458
|
-
// [
|
|
30459
|
-
// 'Duplicate Instance Number(s)',
|
|
30460
|
-
// !parser.isUniqueInGroup(instanceNumber, seriesUid),
|
|
30461
|
-
// ],
|
|
30462
|
-
isUniqueInGroup,
|
|
30463
|
-
getUniqueNumberInGroup,
|
|
30464
30347
|
getFrom,
|
|
30465
30348
|
getFilePathComp,
|
|
30466
30349
|
getMapping,
|
package/dist/esm/composeSpecs.js
CHANGED
|
@@ -4559,17 +4559,17 @@ var require_lodash = __commonJS({
|
|
|
4559
4559
|
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
|
|
4560
4560
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
4561
4561
|
}
|
|
4562
|
-
var
|
|
4563
|
-
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache =
|
|
4562
|
+
var memoized = function() {
|
|
4563
|
+
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
|
|
4564
4564
|
if (cache.has(key)) {
|
|
4565
4565
|
return cache.get(key);
|
|
4566
4566
|
}
|
|
4567
4567
|
var result2 = func.apply(this, args);
|
|
4568
|
-
|
|
4568
|
+
memoized.cache = cache.set(key, result2) || cache;
|
|
4569
4569
|
return result2;
|
|
4570
4570
|
};
|
|
4571
|
-
|
|
4572
|
-
return
|
|
4571
|
+
memoized.cache = new (memoize.Cache || MapCache)();
|
|
4572
|
+
return memoized;
|
|
4573
4573
|
}
|
|
4574
4574
|
memoize.Cache = MapCache;
|
|
4575
4575
|
function negate2(predicate) {
|
|
@@ -18813,81 +18813,6 @@ Tag.setDicomMessageClass(DicomMessage);
|
|
|
18813
18813
|
// src/hashUid.ts
|
|
18814
18814
|
var import_js_sha256 = __toESM(require_sha256(), 1);
|
|
18815
18815
|
|
|
18816
|
-
// node_modules/.pnpm/memize@2.1.1/node_modules/memize/dist/index.js
|
|
18817
|
-
function memize(fn, options) {
|
|
18818
|
-
var size = 0;
|
|
18819
|
-
var head;
|
|
18820
|
-
var tail;
|
|
18821
|
-
options = options || {};
|
|
18822
|
-
function memoized2() {
|
|
18823
|
-
var node = head, len2 = arguments.length, args, i;
|
|
18824
|
-
searchCache:
|
|
18825
|
-
while (node) {
|
|
18826
|
-
if (node.args.length !== arguments.length) {
|
|
18827
|
-
node = node.next;
|
|
18828
|
-
continue;
|
|
18829
|
-
}
|
|
18830
|
-
for (i = 0; i < len2; i++) {
|
|
18831
|
-
if (node.args[i] !== arguments[i]) {
|
|
18832
|
-
node = node.next;
|
|
18833
|
-
continue searchCache;
|
|
18834
|
-
}
|
|
18835
|
-
}
|
|
18836
|
-
if (node !== head) {
|
|
18837
|
-
if (node === tail) {
|
|
18838
|
-
tail = node.prev;
|
|
18839
|
-
}
|
|
18840
|
-
node.prev.next = node.next;
|
|
18841
|
-
if (node.next) {
|
|
18842
|
-
node.next.prev = node.prev;
|
|
18843
|
-
}
|
|
18844
|
-
node.next = head;
|
|
18845
|
-
node.prev = null;
|
|
18846
|
-
head.prev = node;
|
|
18847
|
-
head = node;
|
|
18848
|
-
}
|
|
18849
|
-
return node.val;
|
|
18850
|
-
}
|
|
18851
|
-
args = new Array(len2);
|
|
18852
|
-
for (i = 0; i < len2; i++) {
|
|
18853
|
-
args[i] = arguments[i];
|
|
18854
|
-
}
|
|
18855
|
-
node = {
|
|
18856
|
-
args,
|
|
18857
|
-
// Generate the result from original function
|
|
18858
|
-
val: fn.apply(null, args)
|
|
18859
|
-
};
|
|
18860
|
-
if (head) {
|
|
18861
|
-
head.prev = node;
|
|
18862
|
-
node.next = head;
|
|
18863
|
-
} else {
|
|
18864
|
-
tail = node;
|
|
18865
|
-
}
|
|
18866
|
-
if (size === /** @type {MemizeOptions} */
|
|
18867
|
-
options.maxSize) {
|
|
18868
|
-
tail = /** @type {MemizeCacheNode} */
|
|
18869
|
-
tail.prev;
|
|
18870
|
-
tail.next = null;
|
|
18871
|
-
} else {
|
|
18872
|
-
size++;
|
|
18873
|
-
}
|
|
18874
|
-
head = node;
|
|
18875
|
-
return node.val;
|
|
18876
|
-
}
|
|
18877
|
-
memoized2.clear = function() {
|
|
18878
|
-
head = null;
|
|
18879
|
-
tail = null;
|
|
18880
|
-
size = 0;
|
|
18881
|
-
};
|
|
18882
|
-
return memoized2;
|
|
18883
|
-
}
|
|
18884
|
-
|
|
18885
|
-
// src/replaceUid.ts
|
|
18886
|
-
function replaceUid(uid) {
|
|
18887
|
-
return data.DicomMetaDictionary.uid();
|
|
18888
|
-
}
|
|
18889
|
-
var memoized = memize(replaceUid);
|
|
18890
|
-
|
|
18891
18816
|
// src/config/dicom/elementNamesToAlwaysKeep.ts
|
|
18892
18817
|
var elementNamesToAlwaysKeep = [
|
|
18893
18818
|
"LengthToEnd",
|
|
@@ -139,10 +139,6 @@ function sample2PassCurationSpecification() {
|
|
|
139
139
|
// DICOM header
|
|
140
140
|
["Missing Modality", parser.missingDicom("Modality")],
|
|
141
141
|
["Missing SOP Class UID", parser.missingDicom("SOPClassUID")],
|
|
142
|
-
[
|
|
143
|
-
"Duplicate File Name(s) in series",
|
|
144
|
-
!parser.isUniqueInGroup(filename, seriesUid)
|
|
145
|
-
],
|
|
146
142
|
[
|
|
147
143
|
"Missing Series Instance UID",
|
|
148
144
|
parser.missingDicom("SeriesInstanceUID")
|
|
@@ -125,10 +125,6 @@ function composedSpec() {
|
|
|
125
125
|
// DICOM header
|
|
126
126
|
["Missing Modality", parser.missingDicom("Modality")],
|
|
127
127
|
["Missing SOP Class UID", parser.missingDicom("SOPClassUID")],
|
|
128
|
-
[
|
|
129
|
-
"Duplicate File Name(s) in series",
|
|
130
|
-
!parser.isUniqueInGroup(filename, seriesUid)
|
|
131
|
-
],
|
|
132
128
|
[
|
|
133
129
|
"Missing Series Instance UID",
|
|
134
130
|
parser.missingDicom("SeriesInstanceUID")
|
package/dist/esm/curateDict.js
CHANGED
|
@@ -4559,17 +4559,17 @@ var require_lodash = __commonJS({
|
|
|
4559
4559
|
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
|
|
4560
4560
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
4561
4561
|
}
|
|
4562
|
-
var
|
|
4563
|
-
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache =
|
|
4562
|
+
var memoized = function() {
|
|
4563
|
+
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
|
|
4564
4564
|
if (cache.has(key)) {
|
|
4565
4565
|
return cache.get(key);
|
|
4566
4566
|
}
|
|
4567
4567
|
var result2 = func.apply(this, args);
|
|
4568
|
-
|
|
4568
|
+
memoized.cache = cache.set(key, result2) || cache;
|
|
4569
4569
|
return result2;
|
|
4570
4570
|
};
|
|
4571
|
-
|
|
4572
|
-
return
|
|
4571
|
+
memoized.cache = new (memoize.Cache || MapCache)();
|
|
4572
|
+
return memoized;
|
|
4573
4573
|
}
|
|
4574
4574
|
memoize.Cache = MapCache;
|
|
4575
4575
|
function negate2(predicate) {
|
|
@@ -18875,82 +18875,6 @@ function hashUid(uid) {
|
|
|
18875
18875
|
return uuidBasedUIDPrefix + hashedString;
|
|
18876
18876
|
}
|
|
18877
18877
|
|
|
18878
|
-
// node_modules/.pnpm/memize@2.1.1/node_modules/memize/dist/index.js
|
|
18879
|
-
function memize(fn, options) {
|
|
18880
|
-
var size = 0;
|
|
18881
|
-
var head;
|
|
18882
|
-
var tail;
|
|
18883
|
-
options = options || {};
|
|
18884
|
-
function memoized2() {
|
|
18885
|
-
var node = head, len2 = arguments.length, args, i;
|
|
18886
|
-
searchCache:
|
|
18887
|
-
while (node) {
|
|
18888
|
-
if (node.args.length !== arguments.length) {
|
|
18889
|
-
node = node.next;
|
|
18890
|
-
continue;
|
|
18891
|
-
}
|
|
18892
|
-
for (i = 0; i < len2; i++) {
|
|
18893
|
-
if (node.args[i] !== arguments[i]) {
|
|
18894
|
-
node = node.next;
|
|
18895
|
-
continue searchCache;
|
|
18896
|
-
}
|
|
18897
|
-
}
|
|
18898
|
-
if (node !== head) {
|
|
18899
|
-
if (node === tail) {
|
|
18900
|
-
tail = node.prev;
|
|
18901
|
-
}
|
|
18902
|
-
node.prev.next = node.next;
|
|
18903
|
-
if (node.next) {
|
|
18904
|
-
node.next.prev = node.prev;
|
|
18905
|
-
}
|
|
18906
|
-
node.next = head;
|
|
18907
|
-
node.prev = null;
|
|
18908
|
-
head.prev = node;
|
|
18909
|
-
head = node;
|
|
18910
|
-
}
|
|
18911
|
-
return node.val;
|
|
18912
|
-
}
|
|
18913
|
-
args = new Array(len2);
|
|
18914
|
-
for (i = 0; i < len2; i++) {
|
|
18915
|
-
args[i] = arguments[i];
|
|
18916
|
-
}
|
|
18917
|
-
node = {
|
|
18918
|
-
args,
|
|
18919
|
-
// Generate the result from original function
|
|
18920
|
-
val: fn.apply(null, args)
|
|
18921
|
-
};
|
|
18922
|
-
if (head) {
|
|
18923
|
-
head.prev = node;
|
|
18924
|
-
node.next = head;
|
|
18925
|
-
} else {
|
|
18926
|
-
tail = node;
|
|
18927
|
-
}
|
|
18928
|
-
if (size === /** @type {MemizeOptions} */
|
|
18929
|
-
options.maxSize) {
|
|
18930
|
-
tail = /** @type {MemizeCacheNode} */
|
|
18931
|
-
tail.prev;
|
|
18932
|
-
tail.next = null;
|
|
18933
|
-
} else {
|
|
18934
|
-
size++;
|
|
18935
|
-
}
|
|
18936
|
-
head = node;
|
|
18937
|
-
return node.val;
|
|
18938
|
-
}
|
|
18939
|
-
memoized2.clear = function() {
|
|
18940
|
-
head = null;
|
|
18941
|
-
tail = null;
|
|
18942
|
-
size = 0;
|
|
18943
|
-
};
|
|
18944
|
-
return memoized2;
|
|
18945
|
-
}
|
|
18946
|
-
|
|
18947
|
-
// src/replaceUid.ts
|
|
18948
|
-
function replaceUid(uid) {
|
|
18949
|
-
return data.DicomMetaDictionary.uid();
|
|
18950
|
-
}
|
|
18951
|
-
var memoized = memize(replaceUid);
|
|
18952
|
-
var replaceUid_default = memoized;
|
|
18953
|
-
|
|
18954
18878
|
// src/config/dicom/elementNamesToAlwaysKeep.ts
|
|
18955
18879
|
var elementNamesToAlwaysKeep = [
|
|
18956
18880
|
"LengthToEnd",
|
|
@@ -29884,7 +29808,7 @@ function removeRetiredPrefix(name) {
|
|
|
29884
29808
|
return name.startsWith("RETIRED_") ? name.slice(8) : name;
|
|
29885
29809
|
}
|
|
29886
29810
|
function protectUid(uid, retainUIDsOption) {
|
|
29887
|
-
return
|
|
29811
|
+
return hashUid(uid);
|
|
29888
29812
|
}
|
|
29889
29813
|
var elementNamesToAlwaysKeepSet = new Set(elementNamesToAlwaysKeep);
|
|
29890
29814
|
var ps315EElements2 = ps315EElements.map((elm) => {
|
|
@@ -30382,43 +30306,9 @@ function getCsvMapping(columnMappings, mapping, mappingKey, value) {
|
|
|
30382
30306
|
return mapping[mappingKey].replace(columnMappings.rows[rowIdx]);
|
|
30383
30307
|
}
|
|
30384
30308
|
|
|
30385
|
-
// src/UniqueNumbers.ts
|
|
30386
|
-
function UniqueNumbers(padding = 5) {
|
|
30387
|
-
let groupCounters = {};
|
|
30388
|
-
function getUniqueNumberInGroup2(groupingId) {
|
|
30389
|
-
groupCounters[groupingId] = groupCounters[groupingId] ? groupCounters[groupingId] + 1 : 1;
|
|
30390
|
-
return groupCounters[groupingId].toString().padStart(padding, "0");
|
|
30391
|
-
}
|
|
30392
|
-
function clearUniqueNumberCache2() {
|
|
30393
|
-
groupCounters = {};
|
|
30394
|
-
}
|
|
30395
|
-
return { getUniqueNumberInGroup: getUniqueNumberInGroup2, clearUniqueNumberCache: clearUniqueNumberCache2 };
|
|
30396
|
-
}
|
|
30397
|
-
|
|
30398
30309
|
// src/getParser.ts
|
|
30399
30310
|
var FILEBASENAME = Symbol("fileBasename");
|
|
30400
30311
|
var FILENAME = Symbol("filename");
|
|
30401
|
-
var { getUniqueNumberInGroup, clearUniqueNumberCache } = UniqueNumbers(6);
|
|
30402
|
-
var { isUniqueInGroup, clearUniqueInGroupCache } = /* @__PURE__ */ function() {
|
|
30403
|
-
let cache = /* @__PURE__ */ new Set();
|
|
30404
|
-
let lastGroupId = "";
|
|
30405
|
-
return {
|
|
30406
|
-
isUniqueInGroup(value, groupId) {
|
|
30407
|
-
if (groupId !== lastGroupId) {
|
|
30408
|
-
cache = /* @__PURE__ */ new Set();
|
|
30409
|
-
lastGroupId = groupId;
|
|
30410
|
-
}
|
|
30411
|
-
if (cache.has(value)) {
|
|
30412
|
-
return false;
|
|
30413
|
-
}
|
|
30414
|
-
cache.add(value);
|
|
30415
|
-
return true;
|
|
30416
|
-
},
|
|
30417
|
-
clearUniqueInGroupCache() {
|
|
30418
|
-
cache = /* @__PURE__ */ new Set();
|
|
30419
|
-
}
|
|
30420
|
-
};
|
|
30421
|
-
}();
|
|
30422
30312
|
function getParser(inputPathPattern, inputFilePath, naturalData, dicomPS315EOptions, columnMappings, additionalData) {
|
|
30423
30313
|
function protectUid2(uid) {
|
|
30424
30314
|
let protectedUid = uid;
|
|
@@ -30468,13 +30358,6 @@ function getParser(inputPathPattern, inputFilePath, naturalData, dicomPS315EOpti
|
|
|
30468
30358
|
return typeof value === "undefined" || value === "";
|
|
30469
30359
|
}
|
|
30470
30360
|
return {
|
|
30471
|
-
// This function enables errors like:
|
|
30472
|
-
// [
|
|
30473
|
-
// 'Duplicate Instance Number(s)',
|
|
30474
|
-
// !parser.isUniqueInGroup(instanceNumber, seriesUid),
|
|
30475
|
-
// ],
|
|
30476
|
-
isUniqueInGroup,
|
|
30477
|
-
getUniqueNumberInGroup,
|
|
30478
30361
|
getFrom,
|
|
30479
30362
|
getFilePathComp,
|
|
30480
30363
|
getMapping,
|