@ohif/app 3.14.0-beta.89 → 3.14.0-beta.90
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/{1153.bundle.efd8a415.js → 1153.bundle.3b9c4b75.js} +4046 -1908
- package/dist/{1645.bundle.a8ee81ea.js → 1645.bundle.c61d372a.js} +3 -3
- package/dist/{2478.bundle.e3049512.js → 2478.bundle.fc6ab30b.js} +2 -2
- package/dist/{2717.bundle.8f4ace99.js → 2717.bundle.d5f58443.js} +17 -26
- package/dist/{2991.bundle.ac7aa56c.js → 2991.bundle.f94892fb.js} +2 -2
- package/dist/{3004.bundle.9a8ed0cd.js → 3004.bundle.51919fdc.js} +4 -4
- package/dist/{3366.bundle.d2ab8b38.js → 3366.bundle.b225ae72.js} +34 -13
- package/dist/{3468.bundle.6a84fef1.js → 3468.bundle.f5dc5e44.js} +2 -2
- package/dist/{347.bundle.cfec20c2.js → 347.bundle.397bb252.js} +2 -2
- package/dist/{3771.bundle.6cb07c14.js → 3771.bundle.aba09bd7.js} +2 -2
- package/dist/{4449.bundle.3e4b07e6.js → 4449.bundle.aaa4ab92.js} +6 -6
- package/dist/{4606.bundle.c270beb3.js → 4606.bundle.9a3f474f.js} +33 -11
- package/dist/{4998.bundle.1112d4f8.js → 4998.bundle.3aedb48d.js} +66 -48
- package/dist/{5143.bundle.2ea0b15d.js → 5143.bundle.95aeb8c5.js} +10 -10
- package/dist/5154.bundle.2f460017.js +171 -0
- package/dist/{5320.bundle.335efd86.js → 5320.bundle.a4e386da.js} +1 -1
- package/dist/{5461.bundle.35119b0c.js → 5461.bundle.6ad37837.js} +1 -1
- package/dist/{5645.bundle.6703c7d2.js → 5645.bundle.b6b3edde.js} +1 -1
- package/dist/{5989.bundle.2999d206.js → 5989.bundle.2d80cbd0.js} +3 -3
- package/dist/{6212.bundle.62bb3701.js → 6212.bundle.e505e123.js} +2 -2
- package/dist/{9777.bundle.f01617e1.js → 6253.bundle.8a7c1171.js} +803 -340
- package/dist/{6507.bundle.1b793bf6.js → 6507.bundle.c8ac9bee.js} +4 -4
- package/dist/{6722.bundle.73421747.js → 6722.bundle.d09a8aad.js} +4 -4
- package/dist/{6847.bundle.5a087332.js → 6847.bundle.b2adb444.js} +2 -2
- package/dist/{6956.bundle.74258d90.js → 6956.bundle.c82fd790.js} +2 -2
- package/dist/{7526.bundle.aa30d7bf.js → 7526.bundle.0685dfeb.js} +62 -22
- package/dist/{7604.bundle.e703a54d.js → 7604.bundle.9eb317c8.js} +1 -1
- package/dist/{7694.bundle.8023fb8f.js → 7694.bundle.35b21d96.js} +2 -2
- package/dist/{6133.bundle.d4f7403f.js → 8029.bundle.40857fb6.js} +415 -2338
- package/dist/{8037.bundle.8b5f4114.js → 8037.bundle.d8f1add3.js} +4052 -1903
- package/dist/{9187.bundle.d5af8665.js → 9187.bundle.c384a9dd.js} +4 -4
- package/dist/{9481.bundle.6fe2a588.js → 9481.bundle.ccb81f53.js} +34 -13
- package/dist/{9517.bundle.951a1d06.js → 9517.bundle.1ae74db3.js} +2 -2
- package/dist/{9620.bundle.234737d0.js → 9620.bundle.c3d1589b.js} +39 -16
- package/dist/{9841.bundle.bcae6196.js → 9841.bundle.0f40f02b.js} +2 -2
- package/dist/{9948.bundle.b4ff610d.js → 9948.bundle.1172ebca.js} +2 -2
- package/dist/{app.bundle.822af85f.js → app.bundle.46f8d9cb.js} +778 -94
- package/dist/{compute.bundle.19cf1283.js → compute.bundle.deb7ad1f.js} +8 -8
- package/dist/customizations/index.html +37 -0
- package/dist/customizations/split/decimation.jsonc +69 -0
- package/dist/customizations/split/enableNewSplit.jsonc +39 -0
- package/dist/customizations/split/optional/byAcquisition.jsonc +31 -0
- package/dist/customizations/split/optional/derivedObjectVersions.jsonc +80 -0
- package/dist/customizations/split/optional/dwiByBValue.jsonc +63 -0
- package/dist/customizations/split/optional/multiEchoByEchoTime.jsonc +55 -0
- package/dist/customizations/split/optional/regularVolume.jsonc +54 -0
- package/dist/customizations/split/optional/singleImageSeriesStack.jsonc +44 -0
- package/dist/customizations/split/optional/usTimeClusters.jsonc +49 -0
- package/dist/customizations/split/optional/volumePositionOrder.jsonc +24 -0
- package/dist/customizations/split/regularVolume.jsonc +85 -0
- package/dist/customizations/split/scoutSeries.jsonc +64 -0
- package/dist/customizations/split/singleImagesBySize.jsonc +53 -0
- package/dist/customizations/split/usTimeClusters.jsonc +63 -0
- package/dist/index.html +1 -1
- package/dist/{interpolation.bundle.7b3850e6.js → interpolation.bundle.16504135.js} +8 -8
- package/dist/{polySeg.bundle.157e1e17.js → polySeg.bundle.7088c2eb.js} +8 -8
- package/dist/sw.js +1 -1
- package/package.json +6 -6
- package/dist/5154.bundle.e4a5adf0.js +0 -150
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis["rspackChunk_ohif_app"] ||= []).push([[
|
|
1
|
+
(globalThis["rspackChunk_ohif_app"] ||= []).push([[8029], {
|
|
2
2
|
80874(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
3
3
|
"use strict";
|
|
4
4
|
/**
|
|
@@ -41054,7 +41054,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
41054
41054
|
|
|
41055
41055
|
|
|
41056
41056
|
},
|
|
41057
|
-
|
|
41057
|
+
69991(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
41058
41058
|
"use strict";
|
|
41059
41059
|
|
|
41060
41060
|
// EXPORTS
|
|
@@ -41149,8 +41149,59 @@ function cssToDevicePixels(point) {
|
|
|
41149
41149
|
return [point[0] * devicePixelRatio, point[1] * devicePixelRatio];
|
|
41150
41150
|
}
|
|
41151
41151
|
|
|
41152
|
-
// EXTERNAL MODULE: ../../node_modules/@cornerstonejs/core/dist/esm/RenderingEngine/helpers/cpuFallback/rendering/
|
|
41153
|
-
var
|
|
41152
|
+
// EXTERNAL MODULE: ../../node_modules/@cornerstonejs/core/dist/esm/RenderingEngine/helpers/cpuFallback/rendering/fitToWindow.js
|
|
41153
|
+
var fitToWindow = __webpack_require__(50136);
|
|
41154
|
+
// EXTERNAL MODULE: ../../node_modules/@cornerstonejs/core/dist/esm/RenderingEngine/helpers/cpuFallback/rendering/getImageSize.js
|
|
41155
|
+
var getImageSize = __webpack_require__(14948);
|
|
41156
|
+
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/core/dist/esm/RenderingEngine/helpers/cpuFallback/rendering/resize.js
|
|
41157
|
+
|
|
41158
|
+
|
|
41159
|
+
function setCanvasSize(enabledElement) {
|
|
41160
|
+
const { canvas } = enabledElement;
|
|
41161
|
+
const { clientWidth, clientHeight } = canvas;
|
|
41162
|
+
if (canvas.width !== clientWidth || canvas.height !== clientHeight) {
|
|
41163
|
+
canvas.width = clientWidth;
|
|
41164
|
+
canvas.height = clientHeight;
|
|
41165
|
+
}
|
|
41166
|
+
}
|
|
41167
|
+
function wasFitToWindow(enabledElement, oldCanvasWidth, oldCanvasHeight) {
|
|
41168
|
+
const scale = enabledElement.viewport.scale;
|
|
41169
|
+
const imageSize = (0,getImageSize/* ["default"] */.A)(enabledElement.image, enabledElement.viewport.rotation);
|
|
41170
|
+
const imageWidth = Math.round(imageSize.width * scale);
|
|
41171
|
+
const imageHeight = Math.round(imageSize.height * scale);
|
|
41172
|
+
const x = enabledElement.viewport.translation.x;
|
|
41173
|
+
const y = enabledElement.viewport.translation.y;
|
|
41174
|
+
return ((imageWidth === oldCanvasWidth && imageHeight <= oldCanvasHeight) ||
|
|
41175
|
+
(imageWidth <= oldCanvasWidth &&
|
|
41176
|
+
imageHeight === oldCanvasHeight &&
|
|
41177
|
+
x === 0 &&
|
|
41178
|
+
y === 0));
|
|
41179
|
+
}
|
|
41180
|
+
function relativeRescale(enabledElement, oldCanvasWidth, oldCanvasHeight) {
|
|
41181
|
+
const scale = enabledElement.viewport.scale;
|
|
41182
|
+
const canvasWidth = enabledElement.canvas.width;
|
|
41183
|
+
const canvasHeight = enabledElement.canvas.height;
|
|
41184
|
+
const relWidthChange = canvasWidth / oldCanvasWidth;
|
|
41185
|
+
const relHeightChange = canvasHeight / oldCanvasHeight;
|
|
41186
|
+
const relChange = Math.sqrt(relWidthChange * relHeightChange);
|
|
41187
|
+
enabledElement.viewport.scale = relChange * scale;
|
|
41188
|
+
}
|
|
41189
|
+
/* export default */ function resize(enabledElement, forceFitToWindow = false) {
|
|
41190
|
+
const oldCanvasWidth = enabledElement.canvas.width;
|
|
41191
|
+
const oldCanvasHeight = enabledElement.canvas.height;
|
|
41192
|
+
setCanvasSize(enabledElement);
|
|
41193
|
+
if (enabledElement.image === undefined) {
|
|
41194
|
+
return;
|
|
41195
|
+
}
|
|
41196
|
+
if (forceFitToWindow ||
|
|
41197
|
+
wasFitToWindow(enabledElement, oldCanvasWidth, oldCanvasHeight)) {
|
|
41198
|
+
(0,fitToWindow/* ["default"] */.A)(enabledElement);
|
|
41199
|
+
}
|
|
41200
|
+
else {
|
|
41201
|
+
relativeRescale(enabledElement, oldCanvasWidth, oldCanvasHeight);
|
|
41202
|
+
}
|
|
41203
|
+
}
|
|
41204
|
+
|
|
41154
41205
|
// EXTERNAL MODULE: ../../node_modules/@cornerstonejs/core/dist/esm/cache/cache.js
|
|
41155
41206
|
var cache = __webpack_require__(73998);
|
|
41156
41207
|
// EXTERNAL MODULE: ../../node_modules/@cornerstonejs/core/dist/esm/init.js + 1 modules
|
|
@@ -41334,7 +41385,7 @@ class StackViewport extends Viewport/* ["default"] */.A {
|
|
|
41334
41385
|
};
|
|
41335
41386
|
this._resizeCPU = () => {
|
|
41336
41387
|
if (this._cpuFallbackEnabledElement.viewport) {
|
|
41337
|
-
|
|
41388
|
+
resize(this._cpuFallbackEnabledElement);
|
|
41338
41389
|
}
|
|
41339
41390
|
};
|
|
41340
41391
|
this.getFrameOfReferenceUID = (sliceIndex) => this.getImagePlaneReferenceData(sliceIndex)?.FrameOfReferenceUID;
|
|
@@ -45842,23 +45893,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
45842
45893
|
});
|
|
45843
45894
|
|
|
45844
45895
|
|
|
45845
|
-
},
|
|
45846
|
-
50136(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
45847
|
-
"use strict";
|
|
45848
|
-
/* import */ var _getImageFitScale_js__rspack_import_0 = __webpack_require__(47082);
|
|
45849
|
-
|
|
45850
|
-
/* export default */ function __rspack_default_export(enabledElement) {
|
|
45851
|
-
const { image } = enabledElement;
|
|
45852
|
-
enabledElement.viewport.scale = (0,_getImageFitScale_js__rspack_import_0/* ["default"] */.A)(enabledElement.canvas, image, enabledElement.viewport.rotation).scaleFactor;
|
|
45853
|
-
enabledElement.viewport.translation.x = 0;
|
|
45854
|
-
enabledElement.viewport.translation.y = 0;
|
|
45855
|
-
}
|
|
45856
|
-
|
|
45857
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
45858
|
-
A: () => (/* export default binding */ __rspack_default_export)
|
|
45859
|
-
});
|
|
45860
|
-
|
|
45861
|
-
|
|
45862
45896
|
},
|
|
45863
45897
|
34158(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
45864
45898
|
"use strict";
|
|
@@ -62113,7 +62147,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
62113
62147
|
},
|
|
62114
62148
|
60465(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
62115
62149
|
"use strict";
|
|
62116
|
-
/* import */ var _cornerstonejs_metadata__rspack_import_0 = __webpack_require__(
|
|
62150
|
+
/* import */ var _cornerstonejs_metadata__rspack_import_0 = __webpack_require__(16080);
|
|
62117
62151
|
|
|
62118
62152
|
/* export default */ __webpack_exports__.A = (_cornerstonejs_metadata__rspack_import_0/* .utilities.imageIdToURI */.BF.YF);
|
|
62119
62153
|
|
|
@@ -62289,7 +62323,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
62289
62323
|
},
|
|
62290
62324
|
15793(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
62291
62325
|
"use strict";
|
|
62292
|
-
/* import */ var _cornerstonejs_metadata__rspack_import_0 = __webpack_require__(
|
|
62326
|
+
/* import */ var _cornerstonejs_metadata__rspack_import_0 = __webpack_require__(16080);
|
|
62293
62327
|
|
|
62294
62328
|
/* export default */ __webpack_exports__.A = (_cornerstonejs_metadata__rspack_import_0/* .utilities.isVideoTransferSyntax */.BF.AR);
|
|
62295
62329
|
const { /* videoUIDs */Le: videoUIDs } = _cornerstonejs_metadata__rspack_import_0/* .utilities */.BF;
|
|
@@ -62961,13 +62995,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
62961
62995
|
|
|
62962
62996
|
|
|
62963
62997
|
},
|
|
62964
|
-
|
|
62998
|
+
4367(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
62965
62999
|
"use strict";
|
|
62966
|
-
|
|
62967
|
-
// UNUSED EXPORTS: BaseDisplaySet, DEFAULT_SPLIT_RULE_PRIORITY_LIMIT, DISPLAY_SET_HANDLER_NAMES, ImageStackDisplaySet, buildSeriesInfo, bulkAnnotationSopClassUids, chartSopClassUids, compare, compareInstanceNumber, compareSOPInstanceUID, compiledDisplaySetRules, createDisplaySetFromGroup, createDisplaySetSplitRules, defaultDisplaySetSplitRules, defaultMetadataContext, displaySetRules, ecgSopClassUids, encapsulatedDocumentSopClassUids, getContextValue, getMetadataContext, groupInstancesBySplitRules, imageSopClassUids, instancesSortCriteria, isEcgInstance, isImageInstance, isReconstructableInstances, isVideoInstance, isWsiInstance, longVideoMinFrames, longVideoSopClassUids, orderInstancesForRule, parametricMapSopClassUids, registerDisplaySetMetadata, registerDisplaySetProviders, resolveInstances, resolveSplitRuleSet, rtStructureSetSopClassUids, segmentationSopClassUids, setMetadataContext, sortByInstanceNumber, sortInstancesCopy, splitImageIdsBySplitRules, structuredReportSopClassUids, videoSopClassUids, videoTransferSyntaxUids, wholeSlideSopClassUids
|
|
62968
|
-
|
|
62969
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/BaseDisplaySet.js
|
|
62970
|
-
class BaseDisplaySet_BaseDisplaySet {
|
|
63000
|
+
class BaseDisplaySet {
|
|
62971
63001
|
constructor(options) {
|
|
62972
63002
|
this.displaySetId = options.displaySetId;
|
|
62973
63003
|
this.isDisplayable = options.isDisplayable ?? true;
|
|
@@ -62977,83 +63007,14 @@ class BaseDisplaySet_BaseDisplaySet {
|
|
|
62977
63007
|
}
|
|
62978
63008
|
}
|
|
62979
63009
|
|
|
62980
|
-
|
|
63010
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
63011
|
+
o: () => (BaseDisplaySet)
|
|
63012
|
+
});
|
|
62981
63013
|
|
|
62982
|
-
function collectUnderlyingImageIds(instances) {
|
|
62983
|
-
const ids = [];
|
|
62984
|
-
for (const instance of instances) {
|
|
62985
|
-
if (instance.imageId) {
|
|
62986
|
-
ids.push(instance.imageId);
|
|
62987
|
-
}
|
|
62988
|
-
}
|
|
62989
|
-
return ids;
|
|
62990
|
-
}
|
|
62991
|
-
function collectImageIds(instances, underlyingImageIds) {
|
|
62992
|
-
const imageIds = [];
|
|
62993
|
-
for (const instance of instances) {
|
|
62994
|
-
if (instance.imageId) {
|
|
62995
|
-
imageIds.push(instance.imageId);
|
|
62996
|
-
}
|
|
62997
|
-
}
|
|
62998
|
-
if (imageIds.length === 0) {
|
|
62999
|
-
return [...underlyingImageIds];
|
|
63000
|
-
}
|
|
63001
|
-
return imageIds;
|
|
63002
|
-
}
|
|
63003
|
-
class ImageStackDisplaySet_ImageStackDisplaySet extends BaseDisplaySet_BaseDisplaySet {
|
|
63004
|
-
constructor(options) {
|
|
63005
|
-
const instances = options.instances ?? [];
|
|
63006
|
-
const underlyingImageIds = options.underlyingImageIds ?? collectUnderlyingImageIds(instances);
|
|
63007
|
-
const underlyingList = [...underlyingImageIds];
|
|
63008
|
-
const imageIds = options.imageIds ?? collectImageIds(instances, underlyingList);
|
|
63009
|
-
super({
|
|
63010
|
-
...options,
|
|
63011
|
-
instances,
|
|
63012
|
-
imageIds,
|
|
63013
|
-
underlyingImageIds: underlyingList,
|
|
63014
|
-
});
|
|
63015
|
-
this.isMultiFrame = instances.some((instance) => Number(instance.NumberOfFrames) > 1);
|
|
63016
|
-
}
|
|
63017
|
-
static fromInstances(instances, options) {
|
|
63018
|
-
const displaySetId = options?.displaySetId ??
|
|
63019
|
-
instances[0]?.SeriesInstanceUID ??
|
|
63020
|
-
`display-set-${instances[0]?.imageId ?? 'unknown'}`;
|
|
63021
|
-
return new ImageStackDisplaySet_ImageStackDisplaySet({
|
|
63022
|
-
displaySetId,
|
|
63023
|
-
instances,
|
|
63024
|
-
imageIds: options?.imageIds,
|
|
63025
|
-
});
|
|
63026
|
-
}
|
|
63027
|
-
static fromImageIds(imageIds, getNaturalizedInstance, options) {
|
|
63028
|
-
const instances = imageIds
|
|
63029
|
-
.map((imageId) => getNaturalizedInstance(imageId))
|
|
63030
|
-
.filter((instance) => instance !== undefined);
|
|
63031
|
-
return ImageStackDisplaySet_ImageStackDisplaySet.fromInstances(instances, {
|
|
63032
|
-
...options,
|
|
63033
|
-
imageIds,
|
|
63034
|
-
});
|
|
63035
|
-
}
|
|
63036
|
-
}
|
|
63037
63014
|
|
|
63038
|
-
|
|
63039
|
-
|
|
63040
|
-
|
|
63041
|
-
const instances = [];
|
|
63042
|
-
for (const imageId of imageIds) {
|
|
63043
|
-
const instance = getNaturalizedInstance(imageId);
|
|
63044
|
-
if (!instance) {
|
|
63045
|
-
if (!skipMissing) {
|
|
63046
|
-
throw new Error(`No naturalized instance for imageId: ${imageId}`);
|
|
63047
|
-
}
|
|
63048
|
-
onMissing?.(imageId);
|
|
63049
|
-
continue;
|
|
63050
|
-
}
|
|
63051
|
-
instances.push(instance);
|
|
63052
|
-
}
|
|
63053
|
-
return instances;
|
|
63054
|
-
}
|
|
63055
|
-
|
|
63056
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/buildSeriesInfo.js
|
|
63015
|
+
},
|
|
63016
|
+
75723() {
|
|
63017
|
+
"use strict";
|
|
63057
63018
|
function buildSeriesInfo(instances) {
|
|
63058
63019
|
const NumberOfSeriesRelatedInstances = instances.length;
|
|
63059
63020
|
let numberOfFrames = 0;
|
|
@@ -63082,432 +63043,326 @@ function buildSeriesInfo(instances) {
|
|
|
63082
63043
|
};
|
|
63083
63044
|
}
|
|
63084
63045
|
|
|
63085
|
-
// EXTERNAL MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/safeFunctions/schema.js
|
|
63086
|
-
var schema = __webpack_require__(7471);
|
|
63087
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/splitRuleSet.js
|
|
63088
63046
|
|
|
63089
|
-
|
|
63090
|
-
|
|
63047
|
+
},
|
|
63048
|
+
8024(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
63049
|
+
"use strict";
|
|
63050
|
+
/* import */ var _cornerstonejs_utils__rspack_import_0 = __webpack_require__(20325);
|
|
63051
|
+
/* import */ var _safeFunctions_index_js__rspack_import_1 = __webpack_require__(45992);
|
|
63052
|
+
/* import */ var _displaySetContext_js__rspack_import_2 = __webpack_require__(53659);
|
|
63053
|
+
/* import */ var _groupInstancesBySplitRules_js__rspack_import_3 = __webpack_require__(1143);
|
|
63054
|
+
/* import */ var _metadataContext_js__rspack_import_4 = __webpack_require__(17718);
|
|
63055
|
+
/* import */ var _splitRuleSet_js__rspack_import_5 = __webpack_require__(22746);
|
|
63056
|
+
/* import */ var _splitRuleSchema_js__rspack_import_6 = __webpack_require__(16243);
|
|
63057
|
+
|
|
63058
|
+
|
|
63059
|
+
|
|
63060
|
+
|
|
63061
|
+
|
|
63062
|
+
|
|
63063
|
+
|
|
63064
|
+
const DEFINITION = 'display set rules';
|
|
63065
|
+
function instanceReader(compile, name, site, place, field) {
|
|
63066
|
+
const read = compile.program.readerAt(compile.layer, name, site, {
|
|
63067
|
+
field,
|
|
63068
|
+
place,
|
|
63069
|
+
});
|
|
63070
|
+
const { program } = compile;
|
|
63071
|
+
return (instance, context) => read(program.runtimeFrom(context, instance), instance);
|
|
63091
63072
|
}
|
|
63092
|
-
function
|
|
63093
|
-
if (
|
|
63094
|
-
|
|
63095
|
-
}
|
|
63096
|
-
if (!entry || typeof entry !== 'object') {
|
|
63097
|
-
invalidEntry(id, 'the entry must be an object');
|
|
63073
|
+
function compileName(value, site, compile) {
|
|
63074
|
+
if (typeof value === 'function') {
|
|
63075
|
+
return value;
|
|
63098
63076
|
}
|
|
63099
|
-
if (
|
|
63100
|
-
|
|
63077
|
+
if (typeof value !== 'string') {
|
|
63078
|
+
return (0,_safeFunctions_index_js__rspack_import_1/* .unrecognized */.YC)(_splitRuleSchema_js__rspack_import_6/* .splitRuleSchema.name */.i.name, value, site);
|
|
63101
63079
|
}
|
|
63102
|
-
|
|
63103
|
-
|
|
63104
|
-
|
|
63080
|
+
return instanceReader(compile, value, site, 'groupBy');
|
|
63081
|
+
}
|
|
63082
|
+
function compareSortValues(a, b) {
|
|
63083
|
+
const x = (0,_cornerstonejs_utils__rspack_import_0/* .toFiniteFirst */.FL)(a);
|
|
63084
|
+
const y = (0,_cornerstonejs_utils__rspack_import_0/* .toFiniteFirst */.FL)(b);
|
|
63085
|
+
if (x !== undefined && y !== undefined) {
|
|
63086
|
+
return x - y;
|
|
63105
63087
|
}
|
|
63106
|
-
if (
|
|
63107
|
-
|
|
63088
|
+
if ((0,_safeFunctions_index_js__rspack_import_1/* .hasNoValue */.Tn)(a) || (0,_safeFunctions_index_js__rspack_import_1/* .hasNoValue */.Tn)(b)) {
|
|
63089
|
+
return Number((0,_safeFunctions_index_js__rspack_import_1/* .hasNoValue */.Tn)(a)) - Number((0,_safeFunctions_index_js__rspack_import_1/* .hasNoValue */.Tn)(b));
|
|
63108
63090
|
}
|
|
63109
|
-
|
|
63091
|
+
const aText = String((0,_cornerstonejs_utils__rspack_import_0/* .asArrayFirst */.mm)(a));
|
|
63092
|
+
const bText = String((0,_cornerstonejs_utils__rspack_import_0/* .asArrayFirst */.mm)(b));
|
|
63093
|
+
return aText < bText ? -1 : aText > bText ? 1 : 0;
|
|
63110
63094
|
}
|
|
63111
|
-
function
|
|
63112
|
-
if (
|
|
63113
|
-
|
|
63095
|
+
function compileSortKey(value, site, compile) {
|
|
63096
|
+
if (typeof value === 'function') {
|
|
63097
|
+
return value;
|
|
63114
63098
|
}
|
|
63115
|
-
|
|
63116
|
-
|
|
63117
|
-
|
|
63118
|
-
|
|
63119
|
-
}
|
|
63099
|
+
if (typeof value === 'string') {
|
|
63100
|
+
const read = compile.program.readerAt(compile.layer, value, site, {
|
|
63101
|
+
place: 'sortBy',
|
|
63102
|
+
});
|
|
63103
|
+
const { program } = compile;
|
|
63104
|
+
return (a, b, context) => {
|
|
63105
|
+
const runtime = program.runtimeFrom(context, [a, b]);
|
|
63106
|
+
return compareSortValues(read(runtime, a), read(runtime, b));
|
|
63107
|
+
};
|
|
63120
63108
|
}
|
|
63121
|
-
|
|
63122
|
-
|
|
63123
|
-
|
|
63124
|
-
|
|
63125
|
-
|
|
63126
|
-
|
|
63127
|
-
|
|
63128
|
-
|
|
63129
|
-
|
|
63130
|
-
|
|
63131
|
-
}
|
|
63132
|
-
function splitRuleSet_resolveSplitRuleSet(ruleSet) {
|
|
63133
|
-
return orderSplitRuleSetEntries(ruleSet);
|
|
63109
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
63110
|
+
return (0,_safeFunctions_index_js__rspack_import_1/* .unrecognized */.YC)(_splitRuleSchema_js__rspack_import_6/* .splitRuleSchema.sortKey */.i.sortKey, value, site);
|
|
63111
|
+
}
|
|
63112
|
+
(0,_safeFunctions_index_js__rspack_import_1/* .matchForm */.WW)(_splitRuleSchema_js__rspack_import_6/* .splitRuleSchema.sortKey */.i.sortKey, value, site);
|
|
63113
|
+
const name = value.sortFunction;
|
|
63114
|
+
const sortFunction = (0,_safeFunctions_index_js__rspack_import_1/* .readOwn */.jU)(compile.sortFunctions, name);
|
|
63115
|
+
if (typeof sortFunction !== 'function') {
|
|
63116
|
+
return (0,_safeFunctions_index_js__rspack_import_1/* .invalidAt */.Hn)((0,_safeFunctions_index_js__rspack_import_1.at)(site, 'sortFunction'), `unknown sort function "${name}"; known: ${Object.keys(compile.sortFunctions).join(', ') || '(none)'}`);
|
|
63117
|
+
}
|
|
63118
|
+
return sortFunction;
|
|
63134
63119
|
}
|
|
63135
|
-
|
|
63136
|
-
|
|
63137
|
-
|
|
63138
|
-
|
|
63139
|
-
|
|
63140
|
-
// EXTERNAL MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/utilities/Tags.js
|
|
63141
|
-
var Tags = __webpack_require__(40327);
|
|
63142
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/sortInstances.js
|
|
63143
|
-
|
|
63144
|
-
function sortInstances_compare(a, b) {
|
|
63145
|
-
if (a == b) {
|
|
63146
|
-
return 0;
|
|
63120
|
+
function compileAttributeValue(value, site, compile) {
|
|
63121
|
+
const { program, layer } = compile;
|
|
63122
|
+
if (typeof value === 'function') {
|
|
63123
|
+
const scope = { key: `#attribute:${site.path}`, deps: new Map(), layer };
|
|
63124
|
+
return (runtime, instances, extras) => value(instances, runtime.env(scope, instances[0], extras));
|
|
63147
63125
|
}
|
|
63148
|
-
if (
|
|
63149
|
-
return
|
|
63126
|
+
if ((0,_displaySetContext_js__rspack_import_2/* .isFixedValue */.S5)(value, false)) {
|
|
63127
|
+
return () => value;
|
|
63150
63128
|
}
|
|
63151
|
-
if (
|
|
63152
|
-
|
|
63129
|
+
if (typeof value === 'string') {
|
|
63130
|
+
const read = program.readerAt(layer, value, site, { place: 'attributes' });
|
|
63131
|
+
return (runtime, instances, extras) => read(runtime, instances[0], extras);
|
|
63153
63132
|
}
|
|
63154
|
-
|
|
63155
|
-
|
|
63156
|
-
function compareSOPInstanceUID(a, b, _context) {
|
|
63157
|
-
return sortInstances_compare(String(a.SOPInstanceUID ?? a.imageId ?? ''), String(b.SOPInstanceUID ?? b.imageId ?? ''));
|
|
63158
|
-
}
|
|
63159
|
-
function compareInstanceNumber(a, b, _context) {
|
|
63160
|
-
const aNumber = toFiniteFirst(a.InstanceNumber);
|
|
63161
|
-
const bNumber = toFiniteFirst(b.InstanceNumber);
|
|
63162
|
-
return aNumber !== undefined && bNumber !== undefined
|
|
63163
|
-
? aNumber - bNumber
|
|
63164
|
-
: Number(aNumber === undefined) - Number(bNumber === undefined);
|
|
63165
|
-
}
|
|
63166
|
-
function sortByInstanceNumber(a, b, context) {
|
|
63167
|
-
return (compareInstanceNumber(a, b, context) || compareSOPInstanceUID(a, b, context));
|
|
63168
|
-
}
|
|
63169
|
-
const instancesSortCriteria = (/* unused pure expression or super */ null && ({
|
|
63170
|
-
default: sortByInstanceNumber,
|
|
63171
|
-
sortByInstanceNumber,
|
|
63172
|
-
}));
|
|
63173
|
-
function sortInstances_sortInstancesCopy(instances, criteria = instancesSortCriteria.default, context) {
|
|
63174
|
-
return [...instances].sort((a, b) => criteria(a, b, context));
|
|
63175
|
-
}
|
|
63176
|
-
|
|
63177
|
-
// EXTERNAL MODULE: ../../node_modules/gl-matrix/esm/index.js
|
|
63178
|
-
var gl_matrix_esm = __webpack_require__(50341);
|
|
63179
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/seriesFunctions.js
|
|
63180
|
-
|
|
63181
|
-
|
|
63182
|
-
|
|
63183
|
-
function seriesFunctions_instanceKey(instance) {
|
|
63184
|
-
const key = instance.SOPInstanceUID ?? instance.imageId;
|
|
63185
|
-
return key === undefined ? undefined : String(key);
|
|
63186
|
-
}
|
|
63187
|
-
function byKey(a, b) {
|
|
63188
|
-
const aKey = seriesFunctions_instanceKey(a) ?? '';
|
|
63189
|
-
const bKey = seriesFunctions_instanceKey(b) ?? '';
|
|
63190
|
-
return aKey < bKey ? -1 : aKey > bKey ? 1 : 0;
|
|
63191
|
-
}
|
|
63192
|
-
function numberArg(args, name, fallback) {
|
|
63193
|
-
return (0,esm/* .toFiniteFirst */.FL)((0,safeFunctions/* .readOwn */.jU)(args, name)) ?? fallback;
|
|
63194
|
-
}
|
|
63195
|
-
function readVector(instance, attribute, length) {
|
|
63196
|
-
return (0,esm/* .toFiniteVector */.w7)((0,safeFunctions/* .readOwn */.jU)(instance, attribute), length);
|
|
63197
|
-
}
|
|
63198
|
-
const round = (value, step) => Math.round(value / step) * step;
|
|
63199
|
-
function searchSorted(values, value, after = false) {
|
|
63200
|
-
let low = 0;
|
|
63201
|
-
let high = values.length;
|
|
63202
|
-
while (low < high) {
|
|
63203
|
-
const mid = (low + high) >> 1;
|
|
63204
|
-
if (values[mid] < value || (after && values[mid] === value)) {
|
|
63205
|
-
low = mid + 1;
|
|
63206
|
-
}
|
|
63207
|
-
else {
|
|
63208
|
-
high = mid;
|
|
63209
|
-
}
|
|
63133
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
63134
|
+
return (0,_safeFunctions_index_js__rspack_import_1/* .unrecognized */.YC)(_splitRuleSchema_js__rspack_import_6/* .splitRuleSchema.attributeValue */.i.attributeValue, value, site);
|
|
63210
63135
|
}
|
|
63211
|
-
|
|
63136
|
+
const [form] = (0,_safeFunctions_index_js__rspack_import_1/* .matchForm */.WW)(_splitRuleSchema_js__rspack_import_6/* .splitRuleSchema.attributeValue */.i.attributeValue, value, site);
|
|
63137
|
+
const fields = value;
|
|
63138
|
+
if (form === 'expression') {
|
|
63139
|
+
return program.attributeExpression(layer, fields.expression, (0,_safeFunctions_index_js__rspack_import_1.at)(site, 'expression'));
|
|
63140
|
+
}
|
|
63141
|
+
const templateSite = (0,_safeFunctions_index_js__rspack_import_1.at)(site, 'template');
|
|
63142
|
+
const parts = (0,_safeFunctions_index_js__rspack_import_1/* .parseTemplate */.QC)(fields.template, templateSite).map((segment) => 'literal' in segment
|
|
63143
|
+
? () => segment.literal
|
|
63144
|
+
: program.readerAt(layer, segment.name, templateSite, {
|
|
63145
|
+
field: segment.field,
|
|
63146
|
+
place: 'attributes',
|
|
63147
|
+
}));
|
|
63148
|
+
return (runtime, instances, extras) => parts
|
|
63149
|
+
.map((part) => {
|
|
63150
|
+
const text = part(runtime, instances[0], extras);
|
|
63151
|
+
return (0,_safeFunctions_index_js__rspack_import_1/* .hasNoValue */.Tn)(text) ? '' : String(text);
|
|
63152
|
+
})
|
|
63153
|
+
.join('');
|
|
63212
63154
|
}
|
|
63213
|
-
function
|
|
63214
|
-
|
|
63215
|
-
|
|
63216
|
-
const countOf = (from, lo, hi, values) => {
|
|
63217
|
-
let count = 0;
|
|
63218
|
-
for (let i = lo; i < hi; i++) {
|
|
63219
|
-
count += offLattice(from, values[i]) ? 0 : 1;
|
|
63220
|
-
}
|
|
63221
|
-
return count;
|
|
63222
|
-
};
|
|
63223
|
-
if (tolerance >= 0.5) {
|
|
63224
|
-
return distinct[0];
|
|
63155
|
+
function compileAttributes(attributes, site, compile) {
|
|
63156
|
+
if (typeof attributes === 'function') {
|
|
63157
|
+
return attributes;
|
|
63225
63158
|
}
|
|
63226
|
-
|
|
63227
|
-
|
|
63228
|
-
|
|
63159
|
+
if (!attributes ||
|
|
63160
|
+
typeof attributes !== 'object' ||
|
|
63161
|
+
Array.isArray(attributes)) {
|
|
63162
|
+
return (0,_safeFunctions_index_js__rspack_import_1/* .invalidAt */.Hn)(site, 'expected an object of attribute values, keyed by attribute name, or a function (attributes, options) => Record<string, unknown>', attributes);
|
|
63229
63163
|
}
|
|
63230
|
-
|
|
63231
|
-
const
|
|
63232
|
-
|
|
63233
|
-
|
|
63234
|
-
}
|
|
63235
|
-
|
|
63236
|
-
|
|
63237
|
-
|
|
63238
|
-
|
|
63239
|
-
const
|
|
63240
|
-
|
|
63241
|
-
|
|
63242
|
-
|
|
63243
|
-
|
|
63244
|
-
|
|
63245
|
-
|
|
63246
|
-
|
|
63247
|
-
const from = distinct[index];
|
|
63248
|
-
const phase = phaseOf(from);
|
|
63249
|
-
const lo = searchSorted(phases, phase - tolerance - EPSILON);
|
|
63250
|
-
const hi = searchSorted(phases, phase + tolerance + EPSILON, true);
|
|
63251
|
-
const innerLo = searchSorted(phases, phase - tolerance + EPSILON);
|
|
63252
|
-
const innerHi = searchSorted(phases, phase + tolerance - EPSILON, true);
|
|
63253
|
-
if (innerLo >= innerHi) {
|
|
63254
|
-
return countOf(from, lo, hi, values);
|
|
63255
|
-
}
|
|
63256
|
-
return (innerHi -
|
|
63257
|
-
innerLo +
|
|
63258
|
-
countOf(from, lo, innerLo, values) +
|
|
63259
|
-
countOf(from, innerHi, hi, values));
|
|
63164
|
+
const readers = Object.entries(attributes).map(([key, value]) => {
|
|
63165
|
+
const valueSite = (0,_safeFunctions_index_js__rspack_import_1.at)(site, key);
|
|
63166
|
+
if ((0,_safeFunctions_index_js__rspack_import_1/* .isUnsafeKey */.ez)(key)) {
|
|
63167
|
+
(0,_safeFunctions_index_js__rspack_import_1/* .invalidAt */.Hn)(valueSite, `the key "${key}" is not allowed`);
|
|
63168
|
+
}
|
|
63169
|
+
return [key, compileAttributeValue(value, valueSite, compile)];
|
|
63170
|
+
});
|
|
63171
|
+
const { program } = compile;
|
|
63172
|
+
return (engine, options) => {
|
|
63173
|
+
const instances = options.instances ?? [];
|
|
63174
|
+
const runtime = program.runtimeFrom({
|
|
63175
|
+
series: options.series,
|
|
63176
|
+
displaySet: (0,_displaySetContext_js__rspack_import_2/* .displaySetContextFor */.r$)(options.series, instances),
|
|
63177
|
+
}, instances);
|
|
63178
|
+
const extras = {
|
|
63179
|
+
splitNumber: options.splitNumber,
|
|
63180
|
+
sopClassUids: engine?.sopClassUids,
|
|
63260
63181
|
};
|
|
63261
|
-
|
|
63262
|
-
|
|
63263
|
-
|
|
63264
|
-
|
|
63265
|
-
|
|
63266
|
-
if (count > bestCount) {
|
|
63267
|
-
bestCount = count;
|
|
63268
|
-
anchor = distinct[index];
|
|
63182
|
+
const result = {};
|
|
63183
|
+
for (const [key, read] of readers) {
|
|
63184
|
+
result[key] = instances.length
|
|
63185
|
+
? read(runtime, instances, extras)
|
|
63186
|
+
: undefined;
|
|
63269
63187
|
}
|
|
63270
|
-
|
|
63271
|
-
return anchor;
|
|
63272
|
-
}
|
|
63273
|
-
const seriesFunctions_planeGeometry = (instances, { args }) => {
|
|
63274
|
-
const tolerance = numberArg(args, 'tolerance', 0.1);
|
|
63275
|
-
const result = {
|
|
63276
|
-
regularCount: 0,
|
|
63277
|
-
irregularCount: 0,
|
|
63278
|
-
positions: 0,
|
|
63279
|
-
complete: false,
|
|
63280
|
-
duplicates: false,
|
|
63281
|
-
distance: {},
|
|
63282
|
-
index: {},
|
|
63188
|
+
return result;
|
|
63283
63189
|
};
|
|
63284
|
-
|
|
63285
|
-
|
|
63286
|
-
|
|
63287
|
-
|
|
63288
|
-
const orientation = readVector(instance, 'ImageOrientationPatient', 6);
|
|
63289
|
-
if (key === undefined || !position || !orientation) {
|
|
63290
|
-
result.irregularCount++;
|
|
63291
|
-
continue;
|
|
63292
|
-
}
|
|
63293
|
-
candidates.push({
|
|
63294
|
-
key,
|
|
63295
|
-
position,
|
|
63296
|
-
orientation,
|
|
63297
|
-
orientationKey: orientation.map((v) => round(v, 1e-3).toFixed(3)).join(),
|
|
63298
|
-
});
|
|
63190
|
+
}
|
|
63191
|
+
function compileList(value, site, compileEntry) {
|
|
63192
|
+
if (!Array.isArray(value)) {
|
|
63193
|
+
return (0,_safeFunctions_index_js__rspack_import_1/* .invalidAt */.Hn)(site, 'expected an array', value);
|
|
63299
63194
|
}
|
|
63300
|
-
|
|
63301
|
-
|
|
63302
|
-
|
|
63195
|
+
return value.map((entry, index) => compileEntry(entry, (0,_safeFunctions_index_js__rspack_import_1.at)(site, index)));
|
|
63196
|
+
}
|
|
63197
|
+
function compileRule(id, rule, site, program, sortFunctions) {
|
|
63198
|
+
(0,_safeFunctions_index_js__rspack_import_1/* .matchForm */.WW)(_splitRuleSchema_js__rspack_import_6/* .splitRuleSchema.rule */.i.rule, rule, site);
|
|
63199
|
+
const layer = program.layer(id, rule.context, (0,_safeFunctions_index_js__rspack_import_1.at)(site, 'context'));
|
|
63200
|
+
const compile = { site, program, layer, sortFunctions };
|
|
63201
|
+
const compiled = { id, series: program.seriesHook };
|
|
63202
|
+
if (rule.groupId !== undefined) {
|
|
63203
|
+
compiled.groupId = rule.groupId;
|
|
63303
63204
|
}
|
|
63304
|
-
|
|
63305
|
-
|
|
63306
|
-
return result;
|
|
63205
|
+
if (rule.viewportTypes !== undefined) {
|
|
63206
|
+
compiled.viewportTypes = rule.viewportTypes;
|
|
63307
63207
|
}
|
|
63308
|
-
|
|
63309
|
-
|
|
63310
|
-
const [row0, row1, row2, col0, col1, col2] = inPlane[0].orientation;
|
|
63311
|
-
const normal = gl_matrix_esm/* .vec3.cross */.eR.$A(gl_matrix_esm/* .vec3.create */.eR.vt(), gl_matrix_esm/* .vec3.fromValues */.eR.fA(row0, row1, row2), gl_matrix_esm/* .vec3.fromValues */.eR.fA(col0, col1, col2));
|
|
63312
|
-
gl_matrix_esm/* .vec3.normalize */.eR.S8(normal, normal);
|
|
63313
|
-
result.normal = Array.from(normal);
|
|
63314
|
-
const projected = inPlane.map((candidate) => ({
|
|
63315
|
-
...candidate,
|
|
63316
|
-
d: gl_matrix_esm/* .vec3.dot */.eR.Om(normal, candidate.position),
|
|
63317
|
-
}));
|
|
63318
|
-
const distinct = [];
|
|
63319
|
-
for (const d of projected.map((p) => p.d).sort((a, b) => a - b)) {
|
|
63320
|
-
if (!distinct.length || d - distinct[distinct.length - 1] >= 0.01) {
|
|
63321
|
-
distinct.push(round(d, 1e-3));
|
|
63322
|
-
}
|
|
63208
|
+
if (rule.handler !== undefined) {
|
|
63209
|
+
compiled.handler = rule.handler;
|
|
63323
63210
|
}
|
|
63324
|
-
|
|
63325
|
-
|
|
63326
|
-
|
|
63327
|
-
|
|
63211
|
+
if (rule.matches !== undefined) {
|
|
63212
|
+
const matchesSite = {
|
|
63213
|
+
...(0,_safeFunctions_index_js__rspack_import_1.at)(site, 'matches'),
|
|
63214
|
+
readName: (name, nameSite, field) => instanceReader(compile, name, nameSite, 'matches', field),
|
|
63215
|
+
};
|
|
63216
|
+
compiled.matches = (0,_safeFunctions_index_js__rspack_import_1/* .compileConditionAt */.IC)(rule.matches, matchesSite);
|
|
63328
63217
|
}
|
|
63329
|
-
|
|
63330
|
-
|
|
63331
|
-
|
|
63332
|
-
|
|
63333
|
-
|
|
63218
|
+
if (rule.groupBy !== undefined) {
|
|
63219
|
+
const groupBy = compileList(rule.groupBy, (0,_safeFunctions_index_js__rspack_import_1.at)(site, 'groupBy'), (entry, s) => compileName(entry, s, compile));
|
|
63220
|
+
if (groupBy.length) {
|
|
63221
|
+
compiled.groupBy = groupBy;
|
|
63222
|
+
}
|
|
63334
63223
|
}
|
|
63335
|
-
|
|
63336
|
-
|
|
63337
|
-
|
|
63338
|
-
|
|
63339
|
-
|
|
63340
|
-
const anchor = latticeAnchor(distinct, spacing, tolerance, offLattice);
|
|
63341
|
-
const regular = projected.filter(({ d }) => !offLattice(anchor, d));
|
|
63342
|
-
result.irregularCount += projected.length - regular.length;
|
|
63343
|
-
result.regularCount = regular.length;
|
|
63344
|
-
const lowest = regular.reduce((low, c) => (c.d < low.d ? c : low));
|
|
63345
|
-
result.origin = [...lowest.position];
|
|
63346
|
-
const occupied = new Map();
|
|
63347
|
-
for (const { key, d } of projected) {
|
|
63348
|
-
result.distance[key] = d - lowest.d;
|
|
63349
|
-
}
|
|
63350
|
-
for (const { key, d } of regular) {
|
|
63351
|
-
const index = Math.round((d - lowest.d) / spacing);
|
|
63352
|
-
result.index[key] = index;
|
|
63353
|
-
occupied.set(index, (occupied.get(index) ?? 0) + 1);
|
|
63354
|
-
}
|
|
63355
|
-
result.positions = occupied.size;
|
|
63356
|
-
result.complete = Math.max(...occupied.keys()) === occupied.size - 1;
|
|
63357
|
-
result.duplicates = [...occupied.values()].some((count) => count > 1);
|
|
63358
|
-
return result;
|
|
63359
|
-
};
|
|
63360
|
-
function dicomDateTimeToSeconds(date, time) {
|
|
63361
|
-
const timeText = time == null ? '' : String(time).replace(/:/g, '').trim();
|
|
63362
|
-
const dateText = date == null ? '' : String(date).replace(/-/g, '').trim();
|
|
63363
|
-
const timeMatch = /^(\d{2})(\d{2})?(\d{2})?(\.\d+)?/.exec(timeText);
|
|
63364
|
-
if (!timeMatch) {
|
|
63365
|
-
return undefined;
|
|
63224
|
+
if (rule.sortBy !== undefined) {
|
|
63225
|
+
const comparators = compileList(rule.sortBy, (0,_safeFunctions_index_js__rspack_import_1.at)(site, 'sortBy'), (entry, s) => compileSortKey(entry, s, compile));
|
|
63226
|
+
if (comparators.length) {
|
|
63227
|
+
compiled.compareInstances = (0,_groupInstancesBySplitRules_js__rspack_import_3/* .chainComparators */.$S)(comparators);
|
|
63228
|
+
}
|
|
63366
63229
|
}
|
|
63367
|
-
|
|
63368
|
-
|
|
63369
|
-
const dateMatch = /^(\d{4})(\d{2})(\d{2})$/.exec(dateText);
|
|
63370
|
-
if (!dateMatch) {
|
|
63371
|
-
return timeOfDay;
|
|
63230
|
+
if (rule.attributes !== undefined) {
|
|
63231
|
+
compiled.customAttributes = compileAttributes(rule.attributes, (0,_safeFunctions_index_js__rspack_import_1.at)(site, 'attributes'), compile);
|
|
63372
63232
|
}
|
|
63373
|
-
|
|
63374
|
-
return (Date.UTC(Number(year), Number(month) - 1, Number(day)) / 1000 + timeOfDay);
|
|
63233
|
+
return compiled;
|
|
63375
63234
|
}
|
|
63376
|
-
function
|
|
63377
|
-
|
|
63378
|
-
|
|
63379
|
-
const text = String(dateTime);
|
|
63380
|
-
return dicomDateTimeToSeconds(text.slice(0, 8), text.slice(8));
|
|
63381
|
-
}
|
|
63382
|
-
for (const [date, time] of [
|
|
63383
|
-
['AcquisitionDate', 'AcquisitionTime'],
|
|
63384
|
-
['ContentDate', 'ContentTime'],
|
|
63385
|
-
]) {
|
|
63386
|
-
const seconds = dicomDateTimeToSeconds((0,safeFunctions/* .readOwn */.jU)(instance, date), (0,safeFunctions/* .readOwn */.jU)(instance, time));
|
|
63387
|
-
if (seconds !== undefined) {
|
|
63388
|
-
return seconds;
|
|
63389
|
-
}
|
|
63235
|
+
function compileDisplaySetSplitRules(rules, options = {}) {
|
|
63236
|
+
if (!Array.isArray(rules)) {
|
|
63237
|
+
throw new Error(`Invalid ${DEFINITION}: the rules must be an array in evaluation order (see materializeSplitRules): ${JSON.stringify(rules)}`);
|
|
63390
63238
|
}
|
|
63391
|
-
|
|
63239
|
+
const program = (0,_metadataContext_js__rspack_import_4/* .getMetadataContextProgram */.xN)(options.context, {
|
|
63240
|
+
seriesFunctions: options.seriesFunctions,
|
|
63241
|
+
deniedNames: options.deniedNames,
|
|
63242
|
+
definition: DEFINITION,
|
|
63243
|
+
});
|
|
63244
|
+
const sortFunctions = options.sortFunctions ?? {};
|
|
63245
|
+
(0,_splitRuleSet_js__rspack_import_5/* .resolveSplitRuleSet */.ds)(rules);
|
|
63246
|
+
return rules.map((rule) => {
|
|
63247
|
+
const id = rule.id;
|
|
63248
|
+
const site = (0,_safeFunctions_index_js__rspack_import_1/* .createSite */.Ae)({ definition: DEFINITION, path: `rule '${id}'` }, _splitRuleSchema_js__rspack_import_6/* .splitRuleSchema */.i, _safeFunctions_index_js__rspack_import_1/* .safeFunctionCompilers */.WX);
|
|
63249
|
+
return compileRule(id, rule, site, program, sortFunctions);
|
|
63250
|
+
});
|
|
63392
63251
|
}
|
|
63393
|
-
|
|
63394
|
-
|
|
63395
|
-
|
|
63396
|
-
|
|
63397
|
-
|
|
63398
|
-
|
|
63399
|
-
|
|
63400
|
-
|
|
63401
|
-
|
|
63402
|
-
|
|
63403
|
-
|
|
63404
|
-
|
|
63405
|
-
|
|
63406
|
-
|
|
63407
|
-
|
|
63252
|
+
|
|
63253
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
63254
|
+
J: () => (compileDisplaySetSplitRules)
|
|
63255
|
+
});
|
|
63256
|
+
|
|
63257
|
+
|
|
63258
|
+
},
|
|
63259
|
+
33738(__unused_rspack___webpack_module__, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
63260
|
+
"use strict";
|
|
63261
|
+
/* import */ var _displaySetRules_js__rspack_import_0 = __webpack_require__(78135);
|
|
63262
|
+
|
|
63263
|
+
const compiledDisplaySetRules = (0,_displaySetRules_js__rspack_import_0/* .createDisplaySetSplitRules */.Ww)();
|
|
63264
|
+
const defaultDisplaySetSplitRules = (/* unused pure expression or super */ null && (compiledDisplaySetRules));
|
|
63265
|
+
|
|
63266
|
+
|
|
63267
|
+
},
|
|
63268
|
+
15564(__unused_rspack___webpack_module__, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
63269
|
+
"use strict";
|
|
63270
|
+
/* import */ var _safeFunctions_values_js__rspack_import_0 = __webpack_require__(92422);
|
|
63271
|
+
/* import */ var _metadataContext_js__rspack_import_1 = __webpack_require__(17718);
|
|
63272
|
+
|
|
63273
|
+
|
|
63274
|
+
function isEcgInstance(instance, context) {
|
|
63275
|
+
return isTrue(getContextValue('isEcg', instance, context));
|
|
63276
|
+
}
|
|
63277
|
+
|
|
63278
|
+
|
|
63279
|
+
},
|
|
63280
|
+
82568(__unused_rspack___webpack_module__, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
63281
|
+
"use strict";
|
|
63282
|
+
/* import */ var _safeFunctions_values_js__rspack_import_0 = __webpack_require__(92422);
|
|
63283
|
+
/* import */ var _metadataContext_js__rspack_import_1 = __webpack_require__(17718);
|
|
63284
|
+
|
|
63285
|
+
|
|
63286
|
+
function isImageInstance(instance, context) {
|
|
63287
|
+
return isTrue(getContextValue('isImage', instance, context));
|
|
63288
|
+
}
|
|
63289
|
+
|
|
63290
|
+
|
|
63291
|
+
},
|
|
63292
|
+
18346(__unused_rspack___webpack_module__, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
63293
|
+
"use strict";
|
|
63294
|
+
/* import */ var _safeFunctions_values_js__rspack_import_0 = __webpack_require__(92422);
|
|
63295
|
+
/* import */ var _metadataContext_js__rspack_import_1 = __webpack_require__(17718);
|
|
63296
|
+
|
|
63297
|
+
|
|
63298
|
+
function isVideoInstance(instance, context) {
|
|
63299
|
+
return isTrue(getContextValue('isVideo', instance, context));
|
|
63300
|
+
}
|
|
63301
|
+
|
|
63302
|
+
|
|
63303
|
+
},
|
|
63304
|
+
93140(__unused_rspack___webpack_module__, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
63305
|
+
"use strict";
|
|
63306
|
+
/* import */ var _safeFunctions_values_js__rspack_import_0 = __webpack_require__(92422);
|
|
63307
|
+
/* import */ var _metadataContext_js__rspack_import_1 = __webpack_require__(17718);
|
|
63308
|
+
|
|
63309
|
+
|
|
63310
|
+
function isWsiInstance(instance, context) {
|
|
63311
|
+
return isTrue(getContextValue('isWsi', instance, context));
|
|
63312
|
+
}
|
|
63313
|
+
|
|
63314
|
+
|
|
63315
|
+
},
|
|
63316
|
+
52022(__unused_rspack___webpack_module__, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
63317
|
+
"use strict";
|
|
63318
|
+
/* import */ var _enums_index_js__rspack_import_0 = __webpack_require__(2610);
|
|
63319
|
+
/* import */ var _metaData_js__rspack_import_1 = __webpack_require__(6482);
|
|
63320
|
+
|
|
63321
|
+
|
|
63322
|
+
function registerDisplaySetMetadata(imageIds, displaySet, options = {}) {
|
|
63323
|
+
const idsToRegister = new Set([displaySet.displaySetId, ...imageIds]);
|
|
63324
|
+
if (options.includeImageIds) {
|
|
63325
|
+
for (const frameId of displaySet.imageIds) {
|
|
63326
|
+
idsToRegister.add(frameId);
|
|
63408
63327
|
}
|
|
63409
|
-
timed.push({ key, seconds });
|
|
63410
|
-
result.time[key] = seconds;
|
|
63411
63328
|
}
|
|
63412
|
-
|
|
63413
|
-
|
|
63414
|
-
let previous;
|
|
63415
|
-
for (const { key, seconds } of timed) {
|
|
63416
|
-
if (previous === undefined || seconds - previous > maxGap) {
|
|
63417
|
-
start = seconds;
|
|
63418
|
-
result.clusters++;
|
|
63419
|
-
}
|
|
63420
|
-
result.start[key] = start;
|
|
63421
|
-
previous = seconds;
|
|
63329
|
+
for (const underlyingId of displaySet.underlyingImageIds) {
|
|
63330
|
+
idsToRegister.add(underlyingId);
|
|
63422
63331
|
}
|
|
63423
|
-
|
|
63424
|
-
|
|
63425
|
-
|
|
63426
|
-
function predecessorUids(instance) {
|
|
63427
|
-
const uids = [];
|
|
63428
|
-
const items = (value) => value == null ? [] : (0,esm/* .asArray */._j)(value);
|
|
63429
|
-
for (const study of items((0,safeFunctions/* .readOwn */.jU)(instance, 'PredecessorDocumentsSequence'))) {
|
|
63430
|
-
for (const series of items((0,safeFunctions/* .readOwn */.jU)(study, 'ReferencedSeriesSequence'))) {
|
|
63431
|
-
for (const sop of items((0,safeFunctions/* .readOwn */.jU)(series, 'ReferencedSOPSequence'))) {
|
|
63432
|
-
const uid = (0,safeFunctions/* .readOwn */.jU)(sop, 'ReferencedSOPInstanceUID');
|
|
63433
|
-
if (typeof uid === 'string' && uid) {
|
|
63434
|
-
uids.push(uid);
|
|
63435
|
-
}
|
|
63436
|
-
}
|
|
63332
|
+
for (const imageId of idsToRegister) {
|
|
63333
|
+
if (!imageId) {
|
|
63334
|
+
continue;
|
|
63437
63335
|
}
|
|
63336
|
+
addTyped(MetadataModules.DISPLAY_SET, imageId, { displaySet });
|
|
63438
63337
|
}
|
|
63439
|
-
return uids;
|
|
63440
63338
|
}
|
|
63441
|
-
|
|
63442
|
-
|
|
63443
|
-
|
|
63444
|
-
|
|
63445
|
-
|
|
63446
|
-
|
|
63447
|
-
|
|
63448
|
-
|
|
63449
|
-
|
|
63450
|
-
|
|
63451
|
-
|
|
63452
|
-
|
|
63453
|
-
|
|
63454
|
-
if (named.has(end)) {
|
|
63455
|
-
return;
|
|
63456
|
-
}
|
|
63457
|
-
const stack = [end];
|
|
63458
|
-
while (stack.length) {
|
|
63459
|
-
const index = stack.pop();
|
|
63460
|
-
if (chainOf[index] !== undefined) {
|
|
63461
|
-
continue;
|
|
63339
|
+
|
|
63340
|
+
|
|
63341
|
+
},
|
|
63342
|
+
47620() {
|
|
63343
|
+
"use strict";
|
|
63344
|
+
function resolveInstances(imageIds, getNaturalizedInstance, options = {}) {
|
|
63345
|
+
const { skipMissing = true, onMissing } = options;
|
|
63346
|
+
const instances = [];
|
|
63347
|
+
for (const imageId of imageIds) {
|
|
63348
|
+
const instance = getNaturalizedInstance(imageId);
|
|
63349
|
+
if (!instance) {
|
|
63350
|
+
if (!skipMissing) {
|
|
63351
|
+
throw new Error(`No naturalized instance for imageId: ${imageId}`);
|
|
63462
63352
|
}
|
|
63463
|
-
|
|
63464
|
-
|
|
63465
|
-
}
|
|
63466
|
-
});
|
|
63467
|
-
const result = { active: {} };
|
|
63468
|
-
keys.forEach((key, index) => {
|
|
63469
|
-
const activeKey = keys[chainOf[index] ?? index];
|
|
63470
|
-
if (key !== undefined && activeKey !== undefined) {
|
|
63471
|
-
result.active[key] = activeKey;
|
|
63353
|
+
onMissing?.(imageId);
|
|
63354
|
+
continue;
|
|
63472
63355
|
}
|
|
63473
|
-
|
|
63474
|
-
|
|
63475
|
-
|
|
63476
|
-
|
|
63477
|
-
|
|
63478
|
-
compute: seriesFunctions_planeGeometry,
|
|
63479
|
-
fields: Object.freeze({
|
|
63480
|
-
normal: 'series',
|
|
63481
|
-
origin: 'series',
|
|
63482
|
-
spacing: 'series',
|
|
63483
|
-
regularCount: 'series',
|
|
63484
|
-
irregularCount: 'series',
|
|
63485
|
-
positions: 'series',
|
|
63486
|
-
complete: 'series',
|
|
63487
|
-
duplicates: 'series',
|
|
63488
|
-
distance: 'instance',
|
|
63489
|
-
index: 'instance',
|
|
63490
|
-
}),
|
|
63491
|
-
}),
|
|
63492
|
-
timeClusters: Object.freeze({
|
|
63493
|
-
compute: timeClusters,
|
|
63494
|
-
fields: Object.freeze({
|
|
63495
|
-
time: 'instance',
|
|
63496
|
-
start: 'instance',
|
|
63497
|
-
first: 'series',
|
|
63498
|
-
clusters: 'series',
|
|
63499
|
-
untimedCount: 'series',
|
|
63500
|
-
}),
|
|
63501
|
-
}),
|
|
63502
|
-
revisionChains: Object.freeze({
|
|
63503
|
-
compute: revisionChains,
|
|
63504
|
-
fields: Object.freeze({ active: 'instance' }),
|
|
63505
|
-
}),
|
|
63506
|
-
});
|
|
63356
|
+
instances.push(instance);
|
|
63357
|
+
}
|
|
63358
|
+
return instances;
|
|
63359
|
+
}
|
|
63360
|
+
|
|
63507
63361
|
|
|
63508
|
-
|
|
63509
|
-
|
|
63510
|
-
|
|
63362
|
+
},
|
|
63363
|
+
1625(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
63364
|
+
"use strict";
|
|
63365
|
+
/* import */ var _utilities_isVideoTransferSyntax_js__rspack_import_0 = __webpack_require__(51915);
|
|
63511
63366
|
|
|
63512
63367
|
const list = (uids) => uids;
|
|
63513
63368
|
const imageSopClassUids = list([
|
|
@@ -63568,7 +63423,7 @@ const videoSopClassUids = list([
|
|
|
63568
63423
|
'1.2.840.10008.5.1.4.1.1.77.1.2.1',
|
|
63569
63424
|
'1.2.840.10008.5.1.4.1.1.77.1.4.1',
|
|
63570
63425
|
]);
|
|
63571
|
-
const videoTransferSyntaxUids = list([...
|
|
63426
|
+
const videoTransferSyntaxUids = list([..._utilities_isVideoTransferSyntax_js__rspack_import_0/* .videoUIDs */.L]);
|
|
63572
63427
|
const longVideoSopClassUids = list([
|
|
63573
63428
|
'1.2.840.10008.5.1.4.1.1.7',
|
|
63574
63429
|
'1.2.840.10008.5.1.4.1.1.7.4',
|
|
@@ -63609,7 +63464,47 @@ const bulkAnnotationSopClassUids = list([
|
|
|
63609
63464
|
]);
|
|
63610
63465
|
const chartSopClassUids = list([]);
|
|
63611
63466
|
|
|
63612
|
-
|
|
63467
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
63468
|
+
}, {
|
|
63469
|
+
$0: imageSopClassUids,
|
|
63470
|
+
BG: videoSopClassUids,
|
|
63471
|
+
CH: chartSopClassUids,
|
|
63472
|
+
Ff: ecgSopClassUids,
|
|
63473
|
+
Py: longVideoSopClassUids,
|
|
63474
|
+
QR: wholeSlideSopClassUids,
|
|
63475
|
+
Rm: structuredReportSopClassUids,
|
|
63476
|
+
S$: parametricMapSopClassUids,
|
|
63477
|
+
TS: videoTransferSyntaxUids,
|
|
63478
|
+
UC: segmentationSopClassUids,
|
|
63479
|
+
_1: encapsulatedDocumentSopClassUids,
|
|
63480
|
+
jP: rtStructureSetSopClassUids,
|
|
63481
|
+
zn: bulkAnnotationSopClassUids
|
|
63482
|
+
});
|
|
63483
|
+
|
|
63484
|
+
|
|
63485
|
+
},
|
|
63486
|
+
63513(__unused_rspack___webpack_module__, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
63487
|
+
"use strict";
|
|
63488
|
+
/* import */ var _groupInstancesBySplitRules_js__rspack_import_0 = __webpack_require__(1143);
|
|
63489
|
+
/* import */ var _resolveInstances_js__rspack_import_1 = __webpack_require__(47620);
|
|
63490
|
+
|
|
63491
|
+
|
|
63492
|
+
function splitImageIdsBySplitRules(imageIds, options) {
|
|
63493
|
+
const { getNaturalizedInstance, splitRules, onMissingImageId, onUnmatchedInstance, sortInstances, compareInstances, } = options;
|
|
63494
|
+
const instances = resolveInstances(imageIds, getNaturalizedInstance, {
|
|
63495
|
+
onMissing: onMissingImageId,
|
|
63496
|
+
});
|
|
63497
|
+
return groupInstancesBySplitRules(instances, splitRules, onUnmatchedInstance, {
|
|
63498
|
+
sortInstances,
|
|
63499
|
+
compareInstances,
|
|
63500
|
+
});
|
|
63501
|
+
}
|
|
63502
|
+
|
|
63503
|
+
|
|
63504
|
+
},
|
|
63505
|
+
16243(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
63506
|
+
"use strict";
|
|
63507
|
+
/* import */ var _safeFunctions_index_js__rspack_import_0 = __webpack_require__(45992);
|
|
63613
63508
|
|
|
63614
63509
|
const ATTRIBUTE_ONLY_NAMES = Object.freeze([
|
|
63615
63510
|
'splitNumber',
|
|
@@ -63624,17 +63519,13 @@ const ruleShape = {
|
|
|
63624
63519
|
id: {
|
|
63625
63520
|
kind: 'string',
|
|
63626
63521
|
optional: true,
|
|
63627
|
-
description: 'The rule id. Optional: the key of the rule in the
|
|
63522
|
+
description: 'The rule id. Optional: the key of the rule in the registry is the id. When present it must equal that key.',
|
|
63628
63523
|
},
|
|
63629
63524
|
groupId: {
|
|
63630
63525
|
kind: 'string',
|
|
63631
63526
|
optional: true,
|
|
63632
63527
|
description: 'The group of rules this rule belongs to, for a reader that must recognize display sets from several related rules (for example every mammography rule). Defaults to the rule id.',
|
|
63633
63528
|
},
|
|
63634
|
-
priority: {
|
|
63635
|
-
kind: 'priority',
|
|
63636
|
-
description: 'Evaluation order: ascending, first match wins. null excludes the rule.',
|
|
63637
|
-
},
|
|
63638
63529
|
description: {
|
|
63639
63530
|
kind: 'string',
|
|
63640
63531
|
optional: true,
|
|
@@ -63744,12 +63635,12 @@ const sortKeyShape = {
|
|
|
63744
63635
|
},
|
|
63745
63636
|
};
|
|
63746
63637
|
const attributeValueShape = {
|
|
63747
|
-
...
|
|
63638
|
+
..._safeFunctions_index_js__rspack_import_0/* .valueShape */.HU,
|
|
63748
63639
|
name: 'attribute value',
|
|
63749
63640
|
forms: {
|
|
63750
|
-
template:
|
|
63641
|
+
template: _safeFunctions_index_js__rspack_import_0/* .valueShape.forms.template */.HU.forms.template,
|
|
63751
63642
|
expression: {
|
|
63752
|
-
...
|
|
63643
|
+
..._safeFunctions_index_js__rspack_import_0/* .valueShape.forms.expression */.HU.forms.expression,
|
|
63753
63644
|
description: 'An expression over the display set: displaySet.instances.max(x) (and min, sum, count) runs over its instances, series.instances.max(x) over the series, and a DICOM keyword reads its first instance.',
|
|
63754
63645
|
},
|
|
63755
63646
|
},
|
|
@@ -63760,1821 +63651,26 @@ const nameShape = {
|
|
|
63760
63651
|
function: true,
|
|
63761
63652
|
forms: {},
|
|
63762
63653
|
};
|
|
63763
|
-
|
|
63764
|
-
if (value && typeof value === 'object' && !Object.isFrozen(value)) {
|
|
63765
|
-
Object.freeze(value);
|
|
63766
|
-
for (const entry of Object.values(value)) {
|
|
63767
|
-
deepFreeze(entry);
|
|
63768
|
-
}
|
|
63769
|
-
}
|
|
63770
|
-
return value;
|
|
63771
|
-
}
|
|
63772
|
-
const splitRuleSchema = deepFreeze({
|
|
63654
|
+
const splitRuleSchema = (0,_safeFunctions_index_js__rspack_import_0/* .deepFreeze */.ol)({
|
|
63773
63655
|
rule: ruleShape,
|
|
63774
63656
|
contextEntry: contextEntryShape,
|
|
63775
|
-
condition:
|
|
63776
|
-
matchTest:
|
|
63657
|
+
condition: _safeFunctions_index_js__rspack_import_0/* .conditionShape */.BX,
|
|
63658
|
+
matchTest: _safeFunctions_index_js__rspack_import_0/* .matchTestShape */.rq,
|
|
63777
63659
|
name: nameShape,
|
|
63778
63660
|
sortKey: sortKeyShape,
|
|
63779
63661
|
attributeValue: attributeValueShape,
|
|
63780
63662
|
});
|
|
63781
63663
|
|
|
63782
|
-
|
|
63783
|
-
|
|
63784
|
-
|
|
63785
|
-
|
|
63786
|
-
|
|
63787
|
-
|
|
63788
|
-
|
|
63789
|
-
|
|
63790
|
-
const log = esm/* .logging.metadataLog.getLogger */.m9.Um.getLogger('displayset', 'displaySetContext');
|
|
63791
|
-
const DISPLAY_SET_CONTEXT_FACT = 'displaySetContext';
|
|
63792
|
-
const displaySetContext_defaultMetadataContext = {
|
|
63793
|
-
timeClustersMaxGap: 30,
|
|
63794
|
-
timeClusters: {
|
|
63795
|
-
function: 'timeClusters',
|
|
63796
|
-
args: { maxGap: 'timeClustersMaxGap' },
|
|
63797
|
-
},
|
|
63798
|
-
longTimeClusters: { function: 'timeClusters', args: { maxGap: 60 } },
|
|
63799
|
-
sweepCount: 'timeClusters.clusters',
|
|
63800
|
-
sweepStart: 'timeClusters.start',
|
|
63801
|
-
acquisitionSeconds: 'timeClusters.time',
|
|
63802
|
-
sweepOffset: 'round(sweepStart - timeClusters.first)',
|
|
63803
|
-
planeGeometryTolerance: 0.1,
|
|
63804
|
-
planeGeometry: {
|
|
63805
|
-
function: 'planeGeometry',
|
|
63806
|
-
args: { tolerance: 'planeGeometryTolerance' },
|
|
63807
|
-
},
|
|
63808
|
-
sliceSpacing: 'planeGeometry.spacing',
|
|
63809
|
-
sliceIndex: 'planeGeometry.index',
|
|
63810
|
-
sliceDistance: 'planeGeometry.distance',
|
|
63811
|
-
revisionChains: { function: 'revisionChains' },
|
|
63812
|
-
revisionChainUid: 'revisionChains.active',
|
|
63813
|
-
isActiveRevision: 'SOPInstanceUID == revisionChainUid',
|
|
63814
|
-
seriesInstanceCount: 'series.instances.count()',
|
|
63815
|
-
isMultiFrame: 'NumberOfFrames > 1',
|
|
63816
|
-
imageId: { attribute: 'imageId' },
|
|
63817
|
-
imageSopClassUids: imageSopClassUids,
|
|
63818
|
-
videoSopClassUids: videoSopClassUids,
|
|
63819
|
-
videoTransferSyntaxUids: videoTransferSyntaxUids,
|
|
63820
|
-
longVideoSopClassUids: longVideoSopClassUids,
|
|
63821
|
-
longVideoMinFrames: (/* inlined export .longVideoMinFrames */90),
|
|
63822
|
-
ecgSopClassUids: ecgSopClassUids,
|
|
63823
|
-
wholeSlideSopClassUids: wholeSlideSopClassUids,
|
|
63824
|
-
segmentationSopClassUids: segmentationSopClassUids,
|
|
63825
|
-
rtStructureSetSopClassUids: rtStructureSetSopClassUids,
|
|
63826
|
-
parametricMapSopClassUids: parametricMapSopClassUids,
|
|
63827
|
-
structuredReportSopClassUids: structuredReportSopClassUids,
|
|
63828
|
-
encapsulatedDocumentSopClassUids: encapsulatedDocumentSopClassUids,
|
|
63829
|
-
bulkAnnotationSopClassUids: bulkAnnotationSopClassUids,
|
|
63830
|
-
chartSopClassUids: chartSopClassUids,
|
|
63831
|
-
isImage: 'SOPClassUID in imageSopClassUids',
|
|
63832
|
-
transferSyntaxKnown: 'AvailableTransferSyntaxUID != null || TransferSyntaxUID != null',
|
|
63833
|
-
isVideo: 'SOPClassUID in videoSopClassUids || ' +
|
|
63834
|
-
'AvailableTransferSyntaxUID in videoTransferSyntaxUids || ' +
|
|
63835
|
-
'TransferSyntaxUID in videoTransferSyntaxUids || ' +
|
|
63836
|
-
'(!transferSyntaxKnown && SOPClassUID in longVideoSopClassUids && ' +
|
|
63837
|
-
'NumberOfFrames >= longVideoMinFrames)',
|
|
63838
|
-
isEcg: 'SOPClassUID in ecgSopClassUids',
|
|
63839
|
-
isWsi: "SOPClassUID in wholeSlideSopClassUids || Modality == 'SM'",
|
|
63840
|
-
isSegmentation: 'SOPClassUID in segmentationSopClassUids',
|
|
63841
|
-
isRtStructureSet: 'SOPClassUID in rtStructureSetSopClassUids',
|
|
63842
|
-
isParametricMap: 'SOPClassUID in parametricMapSopClassUids',
|
|
63843
|
-
isStructuredReport: 'SOPClassUID in structuredReportSopClassUids',
|
|
63844
|
-
isEncapsulatedDocument: 'SOPClassUID in encapsulatedDocumentSopClassUids',
|
|
63845
|
-
isBulkAnnotation: 'SOPClassUID in bulkAnnotationSopClassUids',
|
|
63846
|
-
isChart: 'SOPClassUID in chartSopClassUids',
|
|
63847
|
-
};
|
|
63848
|
-
const CONTEXT_NAME = /^[a-z][A-Za-z0-9_]*$/;
|
|
63849
|
-
const RESERVED_LITERALS = new Set([
|
|
63850
|
-
'true',
|
|
63851
|
-
'false',
|
|
63852
|
-
'null',
|
|
63853
|
-
'undefined',
|
|
63854
|
-
'defined',
|
|
63855
|
-
]);
|
|
63856
|
-
const HEX_TAG = /^[0-9A-Fa-f]{8}$/;
|
|
63857
|
-
function isTagKeyword(name) {
|
|
63858
|
-
return (0,Tags/* .resolveHexFromKeyword */.PM)(name) !== undefined;
|
|
63859
|
-
}
|
|
63860
|
-
const DISPLAY_SETS_RESERVED = 'displaySets aggregates are not available yet; see https://github.com/cornerstonejs/cornerstone3D/issues/3000';
|
|
63861
|
-
const EXPRESSION_SCOPE = Object.freeze({
|
|
63862
|
-
params: Object.freeze(['#values', '#instances']),
|
|
63863
|
-
implicitScope: '#values',
|
|
63864
|
-
receivers: Object.freeze({ series: '#instances' }),
|
|
63865
|
-
unavailableReceivers: Object.freeze({
|
|
63866
|
-
displaySet: 'displaySet.instances aggregates are available only in the { "expression" } form of attributes',
|
|
63867
|
-
displaySets: DISPLAY_SETS_RESERVED,
|
|
63868
|
-
}),
|
|
63869
|
-
});
|
|
63870
|
-
const ATTRIBUTE_EXPRESSION_SCOPE = Object.freeze({
|
|
63871
|
-
params: Object.freeze(['#values', '#instances', '#displaySetInstances']),
|
|
63872
|
-
implicitScope: '#values',
|
|
63873
|
-
receivers: Object.freeze({
|
|
63874
|
-
series: '#instances',
|
|
63875
|
-
displaySet: '#displaySetInstances',
|
|
63876
|
-
}),
|
|
63877
|
-
unavailableReceivers: Object.freeze({ displaySets: DISPLAY_SETS_RESERVED }),
|
|
63878
|
-
});
|
|
63879
|
-
const RESERVED_RECEIVERS = new Set(['series', 'displaySet', 'displaySets']);
|
|
63880
|
-
const DISPLAY_SET_PLACES = new Set(['sortBy', 'attributes']);
|
|
63881
|
-
const DISPLAY_SET_PREFIX_ONLY = "the 'displaySet.' prefix is valid only in sortBy and attributes";
|
|
63882
|
-
let functionCount = 0;
|
|
63883
|
-
const functionIds = new WeakMap();
|
|
63884
|
-
function identityOf(raw) {
|
|
63885
|
-
return JSON.stringify(raw, (_key, value) => {
|
|
63886
|
-
if (typeof value !== 'function') {
|
|
63887
|
-
return value;
|
|
63888
|
-
}
|
|
63889
|
-
let id = functionIds.get(value);
|
|
63890
|
-
if (!id) {
|
|
63891
|
-
id = `#function${++functionCount}`;
|
|
63892
|
-
functionIds.set(value, id);
|
|
63893
|
-
}
|
|
63894
|
-
return id;
|
|
63895
|
-
});
|
|
63896
|
-
}
|
|
63897
|
-
function unknownName(name, place, candidates) {
|
|
63898
|
-
const suggestion = (0,safeFunctions/* .didYouMean */.au)(name, [
|
|
63899
|
-
(0,Tags/* .keywordIgnoringCase */.jX)(name),
|
|
63900
|
-
...candidates,
|
|
63901
|
-
]);
|
|
63902
|
-
if (suggestion) {
|
|
63903
|
-
return `unknown name '${name}'${suggestion}`;
|
|
63904
|
-
}
|
|
63905
|
-
let hint;
|
|
63906
|
-
if (HEX_TAG.test(name)) {
|
|
63907
|
-
hint = `a hex tag needs a declaration in the context, e.g. "myValue": { "attribute": "${name}" }`;
|
|
63908
|
-
}
|
|
63909
|
-
else if (RESERVED_LITERALS.has(name)) {
|
|
63910
|
-
hint = `'${name}' is a literal; write X == ${name} in a context entry`;
|
|
63911
|
-
}
|
|
63912
|
-
else if (/^[a-z]/.test(name)) {
|
|
63913
|
-
hint = 'no context entry has this name';
|
|
63914
|
-
}
|
|
63915
|
-
else {
|
|
63916
|
-
hint = `it is not a keyword of the DICOM dictionary; a private, vendor or synthetic attribute needs a declaration, e.g. "myValue": { "attribute": "${name}" }`;
|
|
63917
|
-
}
|
|
63918
|
-
const fixedText = place === 'attributes'
|
|
63919
|
-
? `; fixed text is { "template": ${JSON.stringify(name)} }`
|
|
63920
|
-
: '';
|
|
63921
|
-
return `unknown name '${name}': ${hint}${fixedText}`;
|
|
63922
|
-
}
|
|
63923
|
-
function checkContextName(name, site) {
|
|
63924
|
-
if ((0,safeFunctions/* .isUnsafeKey */.ez)(name) || safeFunctions/* .FORBIDDEN_PROPERTIES.has */.Ol.has(name)) {
|
|
63925
|
-
(0,safeFunctions/* .invalidAt */.Hn)(site, `the context name "${name}" is not allowed`);
|
|
63926
|
-
}
|
|
63927
|
-
if (RESERVED_LITERALS.has(name) || RESERVED_RECEIVERS.has(name)) {
|
|
63928
|
-
(0,safeFunctions/* .invalidAt */.Hn)(site, `'${name}' is reserved by the expression language, and cannot be a context name`);
|
|
63929
|
-
}
|
|
63930
|
-
if (isTagKeyword(name)) {
|
|
63931
|
-
(0,safeFunctions/* .invalidAt */.Hn)(site, `the context name '${name}' is a DICOM keyword; a context cannot hide a value of the instance`);
|
|
63932
|
-
}
|
|
63933
|
-
if (!CONTEXT_NAME.test(name)) {
|
|
63934
|
-
(0,safeFunctions/* .invalidAt */.Hn)(site, `the context name '${name}' must start with a lowercase letter, and hold only letters, digits and _`);
|
|
63935
|
-
}
|
|
63936
|
-
if (ATTRIBUTE_ONLY_NAMES.includes(name)) {
|
|
63937
|
-
(0,safeFunctions/* .invalidAt */.Hn)(site, `'${name}' is a value of the display set, and cannot be a context name`);
|
|
63938
|
-
}
|
|
63939
|
-
}
|
|
63940
|
-
function parseExpression(source, site, scope = EXPRESSION_SCOPE) {
|
|
63941
|
-
const evaluate = (0,safeFunctions/* .compileExpressionAt */.zd)(source, site, scope);
|
|
63942
|
-
const ast = (0,safeFunctions/* .parseExpressionSource */.fU)(source);
|
|
63943
|
-
return {
|
|
63944
|
-
evaluate,
|
|
63945
|
-
reads: (0,safeFunctions/* .collectReads */.eD)(ast, { aggregates: true }),
|
|
63946
|
-
single: ast.type === 'identifier' ? ast.name : undefined,
|
|
63947
|
-
ast,
|
|
63948
|
-
};
|
|
63949
|
-
}
|
|
63950
|
-
function propertyReads(node) {
|
|
63951
|
-
const found = [];
|
|
63952
|
-
const walk = (current) => {
|
|
63953
|
-
switch (current.type) {
|
|
63954
|
-
case 'member':
|
|
63955
|
-
found.push(current.property);
|
|
63956
|
-
walk(current.object);
|
|
63957
|
-
return;
|
|
63958
|
-
case 'index':
|
|
63959
|
-
if (current.index.type !== 'literal') {
|
|
63960
|
-
found.push(undefined);
|
|
63961
|
-
}
|
|
63962
|
-
else if (typeof current.index.value === 'string') {
|
|
63963
|
-
found.push(current.index.value);
|
|
63964
|
-
}
|
|
63965
|
-
walk(current.object);
|
|
63966
|
-
walk(current.index);
|
|
63967
|
-
return;
|
|
63968
|
-
case 'call':
|
|
63969
|
-
current.args.forEach(walk);
|
|
63970
|
-
return;
|
|
63971
|
-
case 'unary':
|
|
63972
|
-
walk(current.argument);
|
|
63973
|
-
return;
|
|
63974
|
-
case 'binary':
|
|
63975
|
-
case 'logical':
|
|
63976
|
-
walk(current.left);
|
|
63977
|
-
walk(current.right);
|
|
63978
|
-
return;
|
|
63979
|
-
case 'conditional':
|
|
63980
|
-
walk(current.test);
|
|
63981
|
-
walk(current.consequent);
|
|
63982
|
-
walk(current.alternate);
|
|
63983
|
-
return;
|
|
63984
|
-
case 'array':
|
|
63985
|
-
current.elements.forEach(walk);
|
|
63986
|
-
return;
|
|
63987
|
-
case 'template':
|
|
63988
|
-
current.parts.forEach((part) => part.kind === 'expr' && walk(part.node));
|
|
63989
|
-
return;
|
|
63990
|
-
}
|
|
63991
|
-
};
|
|
63992
|
-
walk(node);
|
|
63993
|
-
return found;
|
|
63994
|
-
}
|
|
63995
|
-
function isFixedValue(raw, arrays = true) {
|
|
63996
|
-
return (raw === null ||
|
|
63997
|
-
typeof raw === 'boolean' ||
|
|
63998
|
-
(typeof raw === 'number' && Number.isFinite(raw)) ||
|
|
63999
|
-
(arrays && Array.isArray(raw)));
|
|
64000
|
-
}
|
|
64001
|
-
function copyFixedValue(raw) {
|
|
64002
|
-
return Array.isArray(raw) ? [...raw] : raw;
|
|
64003
|
-
}
|
|
64004
|
-
function loopText(entries) {
|
|
64005
|
-
return entries
|
|
64006
|
-
.map(({ name, ruleId }) => ruleId === undefined ? name : `${name} (rule '${ruleId}')`)
|
|
64007
|
-
.join(' -> ');
|
|
64008
|
-
}
|
|
64009
|
-
function displaySetContext_withInstances(series, instances) {
|
|
64010
|
-
const values = readOwn(series, DISPLAY_SET_CONTEXT_FACT);
|
|
64011
|
-
if (!(values instanceof DisplaySetContextValues)) {
|
|
64012
|
-
return series;
|
|
64013
|
-
}
|
|
64014
|
-
const keyOf = (instance) => instanceKey(instance) ?? instance;
|
|
64015
|
-
const known = new Set(values.instances.map(keyOf));
|
|
64016
|
-
const added = instances.filter((instance) => !known.has(keyOf(instance)));
|
|
64017
|
-
if (!added.length) {
|
|
64018
|
-
return series;
|
|
64019
|
-
}
|
|
64020
|
-
return {
|
|
64021
|
-
...series,
|
|
64022
|
-
[DISPLAY_SET_CONTEXT_FACT]: new DisplaySetContextValues(sortInstancesCopy([...values.instances, ...added])),
|
|
64023
|
-
};
|
|
64024
|
-
}
|
|
64025
|
-
class DisplaySetContextValues {
|
|
64026
|
-
constructor(instances, seriesInstances = instances, split) {
|
|
64027
|
-
this.instances = instances;
|
|
64028
|
-
this.seriesInstances = seriesInstances;
|
|
64029
|
-
this.split = split;
|
|
64030
|
-
this.runtimes = new WeakMap();
|
|
64031
|
-
}
|
|
64032
|
-
runtime(program) {
|
|
64033
|
-
let runtime = this.runtimes.get(program);
|
|
64034
|
-
if (!runtime) {
|
|
64035
|
-
runtime = new ContextRuntime(this.instances, this.seriesInstances, this.split?.runtime(program));
|
|
64036
|
-
this.runtimes.set(program, runtime);
|
|
64037
|
-
}
|
|
64038
|
-
return runtime;
|
|
64039
|
-
}
|
|
64040
|
-
}
|
|
64041
|
-
function displaySetContext_displaySetContextFor(series, instances) {
|
|
64042
|
-
const values = (0,safeFunctions/* .readOwn */.jU)(series, DISPLAY_SET_CONTEXT_FACT);
|
|
64043
|
-
return values instanceof DisplaySetContextValues
|
|
64044
|
-
? new DisplaySetContextValues(instances, values.seriesInstances, values)
|
|
64045
|
-
: new DisplaySetContextValues(instances);
|
|
64046
|
-
}
|
|
64047
|
-
class ContextRuntime {
|
|
64048
|
-
constructor(instances, seriesInstances = instances, split) {
|
|
64049
|
-
this.instances = instances;
|
|
64050
|
-
this.seriesInstances = seriesInstances;
|
|
64051
|
-
this.split = split;
|
|
64052
|
-
this.seriesValues = new Map();
|
|
64053
|
-
this.instanceValues = new Map();
|
|
64054
|
-
this.views = new Map();
|
|
64055
|
-
this.envs = new Map();
|
|
64056
|
-
this.instanceEnvs = new Map();
|
|
64057
|
-
this.inProgress = [];
|
|
64058
|
-
}
|
|
64059
|
-
get seriesRuntime() {
|
|
64060
|
-
return this.split ?? this;
|
|
64061
|
-
}
|
|
64062
|
-
value(bound, instance) {
|
|
64063
|
-
if (bound.scope === 'series') {
|
|
64064
|
-
if (this.split && !bound.perDisplaySet) {
|
|
64065
|
-
return this.split.value(bound, undefined);
|
|
64066
|
-
}
|
|
64067
|
-
if (!this.seriesValues.has(bound.key)) {
|
|
64068
|
-
this.seriesValues.set(bound.key, this.compute(bound, undefined));
|
|
64069
|
-
}
|
|
64070
|
-
return this.seriesValues.get(bound.key);
|
|
64071
|
-
}
|
|
64072
|
-
if (!instance) {
|
|
64073
|
-
return undefined;
|
|
64074
|
-
}
|
|
64075
|
-
let values = this.instanceValues.get(instance);
|
|
64076
|
-
if (!values) {
|
|
64077
|
-
values = new Map();
|
|
64078
|
-
this.instanceValues.set(instance, values);
|
|
64079
|
-
}
|
|
64080
|
-
if (!values.has(bound.key)) {
|
|
64081
|
-
values.set(bound.key, this.compute(bound, instance));
|
|
64082
|
-
}
|
|
64083
|
-
return values.get(bound.key);
|
|
64084
|
-
}
|
|
64085
|
-
compute(bound, instance) {
|
|
64086
|
-
const start = this.inProgress.findIndex((entry) => entry.bound === bound && entry.instance === instance);
|
|
64087
|
-
if (start !== -1) {
|
|
64088
|
-
const loop = [
|
|
64089
|
-
...this.inProgress.slice(start).map((entry) => entry.bound),
|
|
64090
|
-
bound,
|
|
64091
|
-
];
|
|
64092
|
-
throw new safeFunctions/* .RuleCompileError */.w6('display set rules', bound.name, `Invalid display set rules: the context entries form a loop: ${loopText(loop)}`);
|
|
64093
|
-
}
|
|
64094
|
-
this.inProgress.push({ bound, instance });
|
|
64095
|
-
try {
|
|
64096
|
-
return bound.compute(this, instance);
|
|
64097
|
-
}
|
|
64098
|
-
finally {
|
|
64099
|
-
this.inProgress.pop();
|
|
64100
|
-
}
|
|
64101
|
-
}
|
|
64102
|
-
groupView(bound, instance) {
|
|
64103
|
-
const result = this.value(bound, instance);
|
|
64104
|
-
const fields = bound.group?.fields;
|
|
64105
|
-
if (!instance || !fields || !result || typeof result !== 'object') {
|
|
64106
|
-
return result;
|
|
64107
|
-
}
|
|
64108
|
-
let views = this.views.get(instance);
|
|
64109
|
-
if (!views) {
|
|
64110
|
-
views = new Map();
|
|
64111
|
-
this.views.set(instance, views);
|
|
64112
|
-
}
|
|
64113
|
-
if (!views.has(bound.key)) {
|
|
64114
|
-
const key = seriesFunctions_instanceKey(instance);
|
|
64115
|
-
const view = Object.create(null);
|
|
64116
|
-
for (const [field, scope] of Object.entries(fields)) {
|
|
64117
|
-
const value = (0,safeFunctions/* .readOwn */.jU)(result, field);
|
|
64118
|
-
view[field] =
|
|
64119
|
-
scope === 'instance'
|
|
64120
|
-
? key === undefined
|
|
64121
|
-
? undefined
|
|
64122
|
-
: (0,safeFunctions/* .readOwn */.jU)(value, key)
|
|
64123
|
-
: value;
|
|
64124
|
-
}
|
|
64125
|
-
views.set(bound.key, view);
|
|
64126
|
-
}
|
|
64127
|
-
return views.get(bound.key);
|
|
64128
|
-
}
|
|
64129
|
-
read(name, dependency, instance, extras) {
|
|
64130
|
-
if (!dependency) {
|
|
64131
|
-
return undefined;
|
|
64132
|
-
}
|
|
64133
|
-
switch (dependency.kind) {
|
|
64134
|
-
case 'keyword':
|
|
64135
|
-
return instance ? (0,safeFunctions/* .readOwn */.jU)(instance, name) : undefined;
|
|
64136
|
-
case 'attribute':
|
|
64137
|
-
return (0,safeFunctions/* .readOwn */.jU)(extras, name);
|
|
64138
|
-
case 'entry':
|
|
64139
|
-
return dependency.bound.group
|
|
64140
|
-
? this.groupView(dependency.bound, instance)
|
|
64141
|
-
: this.value(dependency.bound, instance);
|
|
64142
|
-
case 'series':
|
|
64143
|
-
return this.seriesRuntime.read(name, dependency.inner, instance, extras);
|
|
64144
|
-
case 'displaySet': {
|
|
64145
|
-
const fields = Object.create(null);
|
|
64146
|
-
dependency.fields.forEach((field, fieldName) => {
|
|
64147
|
-
fields[fieldName] = this.read(fieldName, field, instance, extras);
|
|
64148
|
-
});
|
|
64149
|
-
return fields;
|
|
64150
|
-
}
|
|
64151
|
-
}
|
|
64152
|
-
}
|
|
64153
|
-
env(bound, instance, extras, fresh = false) {
|
|
64154
|
-
const cacheable = !extras && !fresh;
|
|
64155
|
-
let byInstance = cacheable ? this.envs.get(bound.key) : undefined;
|
|
64156
|
-
const cached = byInstance?.get(instance);
|
|
64157
|
-
if (cached) {
|
|
64158
|
-
return cached;
|
|
64159
|
-
}
|
|
64160
|
-
const env = new Proxy(Object.create(null), {
|
|
64161
|
-
has: () => true,
|
|
64162
|
-
get: (_target, name) => {
|
|
64163
|
-
if (typeof name !== 'string') {
|
|
64164
|
-
return undefined;
|
|
64165
|
-
}
|
|
64166
|
-
const dependency = bound.deps.get(name) ??
|
|
64167
|
-
bound.layer?.dynamicDependency(name, bound.definition);
|
|
64168
|
-
return this.read(name, dependency, instance, extras);
|
|
64169
|
-
},
|
|
64170
|
-
});
|
|
64171
|
-
if (cacheable) {
|
|
64172
|
-
if (!byInstance) {
|
|
64173
|
-
byInstance = new Map();
|
|
64174
|
-
this.envs.set(bound.key, byInstance);
|
|
64175
|
-
}
|
|
64176
|
-
byInstance.set(instance, env);
|
|
64177
|
-
}
|
|
64178
|
-
return env;
|
|
64179
|
-
}
|
|
64180
|
-
envsOf(bound, instances = this.seriesInstances, extras) {
|
|
64181
|
-
if (extras || instances !== this.seriesInstances) {
|
|
64182
|
-
return instances.map((instance) => this.env(bound, instance, extras));
|
|
64183
|
-
}
|
|
64184
|
-
if (this.split && !bound.perDisplaySet) {
|
|
64185
|
-
return this.split.envsOf(bound, this.split.seriesInstances);
|
|
64186
|
-
}
|
|
64187
|
-
let envs = this.instanceEnvs.get(bound.key);
|
|
64188
|
-
if (!envs) {
|
|
64189
|
-
envs = instances.map((instance) => this.env(bound, instance));
|
|
64190
|
-
this.instanceEnvs.set(bound.key, envs);
|
|
64191
|
-
}
|
|
64192
|
-
return envs;
|
|
64193
|
-
}
|
|
64194
|
-
}
|
|
64195
|
-
class ContextLayer {
|
|
64196
|
-
constructor(program, ruleId, local) {
|
|
64197
|
-
this.program = program;
|
|
64198
|
-
this.ruleId = ruleId;
|
|
64199
|
-
this.local = local;
|
|
64200
|
-
this.memo = new Map();
|
|
64201
|
-
this.dynamic = new Map();
|
|
64202
|
-
}
|
|
64203
|
-
resolve(name, from) {
|
|
64204
|
-
if (from && from.ruleId !== undefined && from.name === name) {
|
|
64205
|
-
return this.program.global.get(name);
|
|
64206
|
-
}
|
|
64207
|
-
return this.local.get(name) ?? this.program.global.get(name);
|
|
64208
|
-
}
|
|
64209
|
-
dynamicDependency(name, from) {
|
|
64210
|
-
let byName = this.dynamic.get(from);
|
|
64211
|
-
if (!byName) {
|
|
64212
|
-
byName = new Map();
|
|
64213
|
-
this.dynamic.set(from, byName);
|
|
64214
|
-
}
|
|
64215
|
-
if (!byName.has(name)) {
|
|
64216
|
-
let dependency;
|
|
64217
|
-
if (this.program.isDenied(name)) {
|
|
64218
|
-
log.warn(`a code entry of the context read '${name}', which is on the deny list of the host; the read gives undefined`);
|
|
64219
|
-
}
|
|
64220
|
-
else if (isTagKeyword(name)) {
|
|
64221
|
-
dependency = { kind: 'keyword' };
|
|
64222
|
-
}
|
|
64223
|
-
else {
|
|
64224
|
-
const definition = this.resolve(name, from);
|
|
64225
|
-
if (definition) {
|
|
64226
|
-
dependency = {
|
|
64227
|
-
kind: 'entry',
|
|
64228
|
-
bound: this.program.bind(definition, this, []),
|
|
64229
|
-
};
|
|
64230
|
-
}
|
|
64231
|
-
else if (ATTRIBUTE_ONLY_NAMES.includes(name)) {
|
|
64232
|
-
dependency = { kind: 'attribute' };
|
|
64233
|
-
}
|
|
64234
|
-
}
|
|
64235
|
-
byName.set(name, dependency);
|
|
64236
|
-
}
|
|
64237
|
-
return byName.get(name);
|
|
64238
|
-
}
|
|
64239
|
-
}
|
|
64240
|
-
class ContextProgram {
|
|
64241
|
-
constructor(context, options) {
|
|
64242
|
-
this.global = new Map();
|
|
64243
|
-
this.bounds = new Map();
|
|
64244
|
-
this.fallbackLogged = false;
|
|
64245
|
-
this.seriesHook = ({ instances, series }) => (0,safeFunctions/* .hasOwn */.$3)(series, DISPLAY_SET_CONTEXT_FACT)
|
|
64246
|
-
? {}
|
|
64247
|
-
: { [DISPLAY_SET_CONTEXT_FACT]: new DisplaySetContextValues(instances) };
|
|
64248
|
-
this.seriesFunctions = options.seriesFunctions;
|
|
64249
|
-
this.denied = new Set(options.deniedNames ?? []);
|
|
64250
|
-
this.deniedTags = new Set([...this.denied].map(Tags/* .resolveHexFromKeyword */.PM).filter(Boolean));
|
|
64251
|
-
for (const definition of this.parseLayer(context, options.site, undefined)) {
|
|
64252
|
-
this.global.set(definition.name, definition);
|
|
64253
|
-
}
|
|
64254
|
-
this.empty = new ContextLayer(this, undefined, new Map());
|
|
64255
|
-
for (const definition of this.global.values()) {
|
|
64256
|
-
this.bind(definition, this.empty, []);
|
|
64257
|
-
}
|
|
64258
|
-
}
|
|
64259
|
-
isDenied(name) {
|
|
64260
|
-
return this.denied.has(name);
|
|
64261
|
-
}
|
|
64262
|
-
parseExpression(source, site, scope) {
|
|
64263
|
-
const parsed = parseExpression(source, site, scope);
|
|
64264
|
-
if (this.denied.size) {
|
|
64265
|
-
for (const property of propertyReads(parsed.ast)) {
|
|
64266
|
-
if (property === undefined) {
|
|
64267
|
-
(0,safeFunctions/* .invalidAt */.Hn)(site, 'a computed field name is not allowed when the host has a deny list; use a literal index, e.g. ViewCodeSequence[0].CodeValue');
|
|
64268
|
-
}
|
|
64269
|
-
if (this.denied.has(property)) {
|
|
64270
|
-
(0,safeFunctions/* .invalidAt */.Hn)(site, `the name '${property}' is on the deny list of the host, so no rule can read it`);
|
|
64271
|
-
}
|
|
64272
|
-
}
|
|
64273
|
-
}
|
|
64274
|
-
return parsed;
|
|
64275
|
-
}
|
|
64276
|
-
runtimeFrom(context, fallback) {
|
|
64277
|
-
const displaySet = (0,safeFunctions/* .readOwn */.jU)(context, 'displaySet');
|
|
64278
|
-
if (displaySet instanceof DisplaySetContextValues) {
|
|
64279
|
-
return displaySet.runtime(this);
|
|
64280
|
-
}
|
|
64281
|
-
const values = (0,safeFunctions/* .readOwn */.jU)((0,safeFunctions/* .readOwn */.jU)(context, 'series'), DISPLAY_SET_CONTEXT_FACT);
|
|
64282
|
-
if (values instanceof DisplaySetContextValues) {
|
|
64283
|
-
return values.runtime(this);
|
|
64284
|
-
}
|
|
64285
|
-
if (!this.fallbackLogged) {
|
|
64286
|
-
this.fallbackLogged = true;
|
|
64287
|
-
log.debug('a split rule hook was called with no split context; its context values cover only the instances of the call');
|
|
64288
|
-
}
|
|
64289
|
-
return new DisplaySetContextValues(fallback ? (0,esm/* .asArray */._j)(fallback) : []).runtime(this);
|
|
64290
|
-
}
|
|
64291
|
-
instanceValue(name, instance) {
|
|
64292
|
-
const definition = this.global.get(name);
|
|
64293
|
-
if (!definition) {
|
|
64294
|
-
throw new Error(`the metadata context has no entry '${name}'`);
|
|
64295
|
-
}
|
|
64296
|
-
const bound = this.bind(definition, this.empty, []);
|
|
64297
|
-
if (bound.scope !== 'instance') {
|
|
64298
|
-
throw new Error(`the context entry '${name}' has the series scope, so one instance cannot give its value`);
|
|
64299
|
-
}
|
|
64300
|
-
return new DisplaySetContextValues([instance])
|
|
64301
|
-
.runtime(this)
|
|
64302
|
-
.read(name, { kind: 'entry', bound }, instance);
|
|
64303
|
-
}
|
|
64304
|
-
layer(ruleId, context, site) {
|
|
64305
|
-
if (context === undefined) {
|
|
64306
|
-
return this.empty;
|
|
64307
|
-
}
|
|
64308
|
-
const local = new Map();
|
|
64309
|
-
for (const definition of this.parseLayer(context, site, ruleId)) {
|
|
64310
|
-
local.set(definition.name, definition);
|
|
64311
|
-
log.debug(this.global.has(definition.name)
|
|
64312
|
-
? `rule '${ruleId}': the context entry '${definition.name}' replaces the global entry for this rule`
|
|
64313
|
-
: `rule '${ruleId}': the context entry '${definition.name}' defines a new name for this rule`);
|
|
64314
|
-
}
|
|
64315
|
-
const layer = new ContextLayer(this, ruleId, local);
|
|
64316
|
-
for (const definition of local.values()) {
|
|
64317
|
-
this.bind(definition, layer, []);
|
|
64318
|
-
}
|
|
64319
|
-
return layer;
|
|
64320
|
-
}
|
|
64321
|
-
readerAt(layer, name, site, options = {}) {
|
|
64322
|
-
const place = options.place ?? '';
|
|
64323
|
-
let { field } = options;
|
|
64324
|
-
let target = name;
|
|
64325
|
-
const prefixed = name === 'displaySet' || name.startsWith('displaySet.');
|
|
64326
|
-
if (prefixed) {
|
|
64327
|
-
if (!DISPLAY_SET_PLACES.has(place)) {
|
|
64328
|
-
(0,safeFunctions/* .invalidAt */.Hn)(site, DISPLAY_SET_PREFIX_ONLY);
|
|
64329
|
-
}
|
|
64330
|
-
const path = name.split('.').slice(1);
|
|
64331
|
-
if (field !== undefined) {
|
|
64332
|
-
path.push(field);
|
|
64333
|
-
}
|
|
64334
|
-
if (!path.length || path.length > 2 || path.some((part) => !part)) {
|
|
64335
|
-
(0,safeFunctions/* .invalidAt */.Hn)(site, `'${name}' must be displaySet.<name> or displaySet.<name>.<field>, e.g. displaySet.sliceSpacing`);
|
|
64336
|
-
}
|
|
64337
|
-
[target, field] = path;
|
|
64338
|
-
}
|
|
64339
|
-
let dependency = this.dependencyOf({ name: target, field, inAggregate: false }, undefined, layer, [], site, place);
|
|
64340
|
-
if (!prefixed && DISPLAY_SET_PLACES.has(place)) {
|
|
64341
|
-
dependency = { kind: 'series', inner: dependency };
|
|
64342
|
-
}
|
|
64343
|
-
return (runtime, instance, extras) => {
|
|
64344
|
-
const value = runtime.read(target, dependency, instance, extras);
|
|
64345
|
-
return field === undefined ? value : (0,safeFunctions/* .readOwn */.jU)(value, field);
|
|
64346
|
-
};
|
|
64347
|
-
}
|
|
64348
|
-
attributeExpression(layer, source, site) {
|
|
64349
|
-
const { evaluate, reads } = this.parseExpression(source, site, ATTRIBUTE_EXPRESSION_SCOPE);
|
|
64350
|
-
const deps = new Map();
|
|
64351
|
-
const displaySetFields = new Map();
|
|
64352
|
-
for (const read of reads) {
|
|
64353
|
-
if (read.name === 'displaySet') {
|
|
64354
|
-
if (read.field === undefined) {
|
|
64355
|
-
(0,safeFunctions/* .invalidAt */.Hn)(site, "'displaySet' needs a name, e.g. displaySet.sliceSpacing");
|
|
64356
|
-
}
|
|
64357
|
-
displaySetFields.set(read.field, this.dependencyOf({ name: read.field, inAggregate: read.inAggregate }, undefined, layer, [], site, 'attributes'));
|
|
64358
|
-
continue;
|
|
64359
|
-
}
|
|
64360
|
-
const dependency = this.dependencyOf(read, undefined, layer, [], site, 'attributes');
|
|
64361
|
-
deps.set(read.name, { kind: 'series', inner: dependency });
|
|
64362
|
-
}
|
|
64363
|
-
if (displaySetFields.size) {
|
|
64364
|
-
deps.set('displaySet', { kind: 'displaySet', fields: displaySetFields });
|
|
64365
|
-
}
|
|
64366
|
-
const perDisplaySet = displaySetFields.size > 0 ||
|
|
64367
|
-
[...deps.values()].some((dependency) => dependency.kind === 'series' && dependency.inner.kind === 'attribute');
|
|
64368
|
-
const scope = { key: `#attribute:${site.path}`, deps, perDisplaySet };
|
|
64369
|
-
return (runtime, instances, extras) => evaluate(runtime.env(scope, instances[0], extras), perDisplaySet
|
|
64370
|
-
? runtime.envsOf(scope, runtime.seriesInstances, extras)
|
|
64371
|
-
: runtime.envsOf(scope), runtime.envsOf(scope, instances, extras));
|
|
64372
|
-
}
|
|
64373
|
-
bind(definition, layer, stack) {
|
|
64374
|
-
const memo = layer.memo.get(definition);
|
|
64375
|
-
if (memo) {
|
|
64376
|
-
return memo;
|
|
64377
|
-
}
|
|
64378
|
-
const loopStart = stack.indexOf(definition);
|
|
64379
|
-
if (loopStart !== -1) {
|
|
64380
|
-
const loop = [...stack.slice(loopStart), definition]
|
|
64381
|
-
.map(({ name }) => name)
|
|
64382
|
-
.join(' -> ');
|
|
64383
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(definition.site, `the context entries form a loop: ${loop}`);
|
|
64384
|
-
}
|
|
64385
|
-
stack.push(definition);
|
|
64386
|
-
try {
|
|
64387
|
-
const deps = new Map();
|
|
64388
|
-
const closure = new Set();
|
|
64389
|
-
if (definition.ruleId !== undefined) {
|
|
64390
|
-
closure.add(definition.name);
|
|
64391
|
-
}
|
|
64392
|
-
if (definition.kind === 'code') {
|
|
64393
|
-
layer.local.forEach((_entry, name) => closure.add(name));
|
|
64394
|
-
}
|
|
64395
|
-
let scope = definition.kind === 'declaration' || definition.kind === 'code'
|
|
64396
|
-
? 'instance'
|
|
64397
|
-
: 'series';
|
|
64398
|
-
for (const read of definition.reads) {
|
|
64399
|
-
const dependency = this.dependencyOf(read, definition, layer, stack, definition.site, 'context');
|
|
64400
|
-
deps.set(read.name, dependency);
|
|
64401
|
-
if (dependency.kind === 'entry') {
|
|
64402
|
-
dependency.bound.closure.forEach((name) => closure.add(name));
|
|
64403
|
-
}
|
|
64404
|
-
if (!read.inAggregate && readsInstance(read, dependency)) {
|
|
64405
|
-
scope = 'instance';
|
|
64406
|
-
}
|
|
64407
|
-
}
|
|
64408
|
-
if (definition.kind === 'group') {
|
|
64409
|
-
for (const argument of definition.args) {
|
|
64410
|
-
const instanceRead = argument.reads.find((read) => !read.inAggregate && readsInstance(read, deps.get(read.name)));
|
|
64411
|
-
if (instanceRead) {
|
|
64412
|
-
(0,safeFunctions/* .invalidAt */.Hn)((0,safeFunctions.at)((0,safeFunctions.at)(definition.site, 'args'), argument.name), `the argument must have one value for the series, but '${instanceRead.name}' has one value for each instance`);
|
|
64413
|
-
}
|
|
64414
|
-
}
|
|
64415
|
-
scope = 'series';
|
|
64416
|
-
}
|
|
64417
|
-
const replaced = [...closure].sort();
|
|
64418
|
-
const level = definition.ruleId === undefined ? '' : '@';
|
|
64419
|
-
const key = replaced.length
|
|
64420
|
-
? `${level}${definition.name}{${replaced
|
|
64421
|
-
.map((name) => `${name}=${layer.local.get(name)?.identity}`)
|
|
64422
|
-
.join(',')}}`
|
|
64423
|
-
: `${level}${definition.name}`;
|
|
64424
|
-
let bound = this.bounds.get(key);
|
|
64425
|
-
if (!bound) {
|
|
64426
|
-
bound = this.createBound(definition, layer, key, scope, deps, closure);
|
|
64427
|
-
this.bounds.set(key, bound);
|
|
64428
|
-
}
|
|
64429
|
-
layer.memo.set(definition, bound);
|
|
64430
|
-
return bound;
|
|
64431
|
-
}
|
|
64432
|
-
finally {
|
|
64433
|
-
stack.pop();
|
|
64434
|
-
}
|
|
64435
|
-
}
|
|
64436
|
-
dependencyOf(read, from, layer, stack, site, place) {
|
|
64437
|
-
const { name, field } = read;
|
|
64438
|
-
if (this.denied.has(name)) {
|
|
64439
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(site, `the name '${name}' is on the deny list of the host, so no rule can read it`);
|
|
64440
|
-
}
|
|
64441
|
-
if (name === 'displaySet') {
|
|
64442
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(site, DISPLAY_SET_PREFIX_ONLY);
|
|
64443
|
-
}
|
|
64444
|
-
if (isTagKeyword(name)) {
|
|
64445
|
-
if (field !== undefined) {
|
|
64446
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(site, `'${name}' is a DICOM keyword and has no field '${field}'; read an item of a sequence with an index, e.g. ${name}[0].${field}`);
|
|
64447
|
-
}
|
|
64448
|
-
return { kind: 'keyword' };
|
|
64449
|
-
}
|
|
64450
|
-
const definition = layer.resolve(name, from);
|
|
64451
|
-
if (!definition) {
|
|
64452
|
-
if (ATTRIBUTE_ONLY_NAMES.includes(name)) {
|
|
64453
|
-
if (place === 'attributes') {
|
|
64454
|
-
return { kind: 'attribute' };
|
|
64455
|
-
}
|
|
64456
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(site, `'${name}' is a value of the display set, and only attributes can read it`);
|
|
64457
|
-
}
|
|
64458
|
-
if (from && from.ruleId !== undefined && from.name === name) {
|
|
64459
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(site, `the rule entry '${name}' reads its own name, but the global context has no entry '${name}'`);
|
|
64460
|
-
}
|
|
64461
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(site, unknownName(name, place, [
|
|
64462
|
-
...layer.local.keys(),
|
|
64463
|
-
...this.global.keys(),
|
|
64464
|
-
...ATTRIBUTE_ONLY_NAMES,
|
|
64465
|
-
]));
|
|
64466
|
-
}
|
|
64467
|
-
const bound = this.bind(definition, layer, stack);
|
|
64468
|
-
if (read.indexed && bound.group) {
|
|
64469
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(site, `read a field of the group '${name}' by path, e.g. ${name}.${Object.keys(bound.group.fields ?? {})[0] ?? 'field'}`);
|
|
64470
|
-
}
|
|
64471
|
-
if (field !== undefined) {
|
|
64472
|
-
if (!bound.group) {
|
|
64473
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(site, `'${name}' is not a group, so '${name}.${field}' reads nothing`);
|
|
64474
|
-
}
|
|
64475
|
-
const { fields } = bound.group;
|
|
64476
|
-
if (fields && !(0,safeFunctions/* .hasOwn */.$3)(fields, field)) {
|
|
64477
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(site, `the group '${name}' has no field '${field}'${(0,safeFunctions/* .didYouMean */.au)(field, Object.keys(fields))}; fields: ${Object.keys(fields).join(', ')}`);
|
|
64478
|
-
}
|
|
64479
|
-
}
|
|
64480
|
-
return { kind: 'entry', bound };
|
|
64481
|
-
}
|
|
64482
|
-
createBound(definition, layer, key, scope, deps, closure) {
|
|
64483
|
-
const bound = {
|
|
64484
|
-
key,
|
|
64485
|
-
name: definition.name,
|
|
64486
|
-
scope,
|
|
64487
|
-
deps,
|
|
64488
|
-
closure,
|
|
64489
|
-
ruleId: definition.ruleId,
|
|
64490
|
-
perDisplaySet: definition.kind === 'code' ||
|
|
64491
|
-
definition.kind === 'group' ||
|
|
64492
|
-
[...deps.values()].some((dependency) => dependency.kind === 'entry' && dependency.bound.perDisplaySet),
|
|
64493
|
-
compute: () => undefined,
|
|
64494
|
-
};
|
|
64495
|
-
switch (definition.kind) {
|
|
64496
|
-
case 'fixed': {
|
|
64497
|
-
const { value } = definition;
|
|
64498
|
-
bound.compute = () => value;
|
|
64499
|
-
break;
|
|
64500
|
-
}
|
|
64501
|
-
case 'declaration': {
|
|
64502
|
-
const { attribute } = definition;
|
|
64503
|
-
bound.compute = (_runtime, instance) => (0,safeFunctions/* .readOwn */.jU)(instance, attribute);
|
|
64504
|
-
break;
|
|
64505
|
-
}
|
|
64506
|
-
case 'code': {
|
|
64507
|
-
const { fn } = definition;
|
|
64508
|
-
bound.layer = layer;
|
|
64509
|
-
bound.definition = definition;
|
|
64510
|
-
bound.compute = (runtime, instance) => instance
|
|
64511
|
-
? fn(instance, runtime.env(bound, instance, undefined, true))
|
|
64512
|
-
: undefined;
|
|
64513
|
-
break;
|
|
64514
|
-
}
|
|
64515
|
-
case 'expression': {
|
|
64516
|
-
const target = definition.aliasOf !== undefined
|
|
64517
|
-
? deps.get(definition.aliasOf)
|
|
64518
|
-
: undefined;
|
|
64519
|
-
if (target?.kind === 'entry' && target.bound.group) {
|
|
64520
|
-
const group = target.bound;
|
|
64521
|
-
bound.group = group.group;
|
|
64522
|
-
bound.scope = 'series';
|
|
64523
|
-
bound.compute = (runtime) => runtime.value(group, undefined);
|
|
64524
|
-
break;
|
|
64525
|
-
}
|
|
64526
|
-
const { evaluate } = definition;
|
|
64527
|
-
bound.compute = (runtime, instance) => evaluate(runtime.env(bound, instance), runtime.envsOf(bound));
|
|
64528
|
-
break;
|
|
64529
|
-
}
|
|
64530
|
-
case 'template': {
|
|
64531
|
-
const parts = definition.segments.map((segment) => 'literal' in segment
|
|
64532
|
-
? () => segment.literal
|
|
64533
|
-
: (runtime, instance) => {
|
|
64534
|
-
const value = runtime.read(segment.name, deps.get(segment.name), instance);
|
|
64535
|
-
return segment.field === undefined
|
|
64536
|
-
? value
|
|
64537
|
-
: (0,safeFunctions/* .readOwn */.jU)(value, segment.field);
|
|
64538
|
-
});
|
|
64539
|
-
bound.compute = (runtime, instance) => parts
|
|
64540
|
-
.map((part) => {
|
|
64541
|
-
const value = part(runtime, instance);
|
|
64542
|
-
return (0,safeFunctions/* .hasNoValue */.Tn)(value) ? '' : String(value);
|
|
64543
|
-
})
|
|
64544
|
-
.join('');
|
|
64545
|
-
break;
|
|
64546
|
-
}
|
|
64547
|
-
case 'group': {
|
|
64548
|
-
const { compute, args } = definition;
|
|
64549
|
-
bound.group = { fields: definition.fields };
|
|
64550
|
-
bound.compute = (runtime) => {
|
|
64551
|
-
const values = {};
|
|
64552
|
-
for (const argument of args) {
|
|
64553
|
-
values[argument.name] = argument.evaluate
|
|
64554
|
-
? argument.evaluate(runtime.env(bound, undefined), runtime.envsOf(bound))
|
|
64555
|
-
: argument.fixed;
|
|
64556
|
-
}
|
|
64557
|
-
return compute(runtime.instances, {
|
|
64558
|
-
args: Object.freeze(values),
|
|
64559
|
-
});
|
|
64560
|
-
};
|
|
64561
|
-
break;
|
|
64562
|
-
}
|
|
64563
|
-
}
|
|
64564
|
-
return bound;
|
|
64565
|
-
}
|
|
64566
|
-
parseLayer(context, site, ruleId) {
|
|
64567
|
-
if (!context || typeof context !== 'object' || Array.isArray(context)) {
|
|
64568
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(site, 'expected an object of context entries, keyed by context name', context);
|
|
64569
|
-
}
|
|
64570
|
-
return Object.entries(context).map(([name, raw]) => {
|
|
64571
|
-
const entrySite = (0,safeFunctions.at)(site, name);
|
|
64572
|
-
checkContextName(name, entrySite);
|
|
64573
|
-
if (this.denied.has(name)) {
|
|
64574
|
-
(0,safeFunctions/* .invalidAt */.Hn)(entrySite, `the context name '${name}' is on the deny list of the host`);
|
|
64575
|
-
}
|
|
64576
|
-
return this.parseEntry(name, raw, entrySite, ruleId);
|
|
64577
|
-
});
|
|
64578
|
-
}
|
|
64579
|
-
parseEntry(name, raw, site, ruleId) {
|
|
64580
|
-
const base = { name, ruleId, site, identity: identityOf(raw) };
|
|
64581
|
-
if (typeof raw === 'function') {
|
|
64582
|
-
return {
|
|
64583
|
-
...base,
|
|
64584
|
-
kind: 'code',
|
|
64585
|
-
reads: [],
|
|
64586
|
-
fn: raw,
|
|
64587
|
-
};
|
|
64588
|
-
}
|
|
64589
|
-
if (isFixedValue(raw)) {
|
|
64590
|
-
return { ...base, kind: 'fixed', reads: [], value: copyFixedValue(raw) };
|
|
64591
|
-
}
|
|
64592
|
-
if (typeof raw === 'string') {
|
|
64593
|
-
const { evaluate, reads, single } = this.parseExpression(raw, site);
|
|
64594
|
-
return { ...base, kind: 'expression', reads, evaluate, aliasOf: single };
|
|
64595
|
-
}
|
|
64596
|
-
if (!raw || typeof raw !== 'object') {
|
|
64597
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(site, 'expected a fixed value (a number, a boolean, null or an array), an expression string, { attribute }, { template }, { function, args? }, or a function', raw);
|
|
64598
|
-
}
|
|
64599
|
-
const [form] = (0,safeFunctions/* .matchForm */.WW)(splitRuleSchema.contextEntry, raw, site);
|
|
64600
|
-
const fields = raw;
|
|
64601
|
-
if (form === 'declaration') {
|
|
64602
|
-
if (!fields.attribute) {
|
|
64603
|
-
return (0,safeFunctions/* .invalidAt */.Hn)((0,safeFunctions.at)(site, 'attribute'), 'expected a non-empty string');
|
|
64604
|
-
}
|
|
64605
|
-
const attribute = String(fields.attribute);
|
|
64606
|
-
if (this.denied.has(attribute) ||
|
|
64607
|
-
this.deniedTags.has(attribute.replace(/^x/i, '').toUpperCase())) {
|
|
64608
|
-
return (0,safeFunctions/* .invalidAt */.Hn)((0,safeFunctions.at)(site, 'attribute'), `the attribute '${attribute}' is on the deny list of the host, so no rule can read it`);
|
|
64609
|
-
}
|
|
64610
|
-
return {
|
|
64611
|
-
...base,
|
|
64612
|
-
kind: 'declaration',
|
|
64613
|
-
reads: [],
|
|
64614
|
-
attribute: fields.attribute,
|
|
64615
|
-
vr: fields.vr,
|
|
64616
|
-
vm: fields.vm,
|
|
64617
|
-
};
|
|
64618
|
-
}
|
|
64619
|
-
if (form === 'template') {
|
|
64620
|
-
const segments = (0,safeFunctions/* .parseTemplate */.QC)(fields.template, (0,safeFunctions.at)(site, 'template'));
|
|
64621
|
-
const reads = segments.flatMap((segment) => 'literal' in segment
|
|
64622
|
-
? []
|
|
64623
|
-
: [{ name: segment.name, field: segment.field, inAggregate: false }]);
|
|
64624
|
-
return { ...base, kind: 'template', reads, segments };
|
|
64625
|
-
}
|
|
64626
|
-
const definition = this.seriesFunctionOf(fields.function, (0,safeFunctions.at)(site, 'function'));
|
|
64627
|
-
const args = this.parseArguments(fields.args, (0,safeFunctions.at)(site, 'args'));
|
|
64628
|
-
return {
|
|
64629
|
-
...base,
|
|
64630
|
-
kind: 'group',
|
|
64631
|
-
reads: args.flatMap((argument) => argument.reads),
|
|
64632
|
-
compute: definition.compute,
|
|
64633
|
-
fields: definition.fields,
|
|
64634
|
-
args,
|
|
64635
|
-
};
|
|
64636
|
-
}
|
|
64637
|
-
seriesFunctionOf(value, site) {
|
|
64638
|
-
if (typeof value === 'function') {
|
|
64639
|
-
return { compute: value };
|
|
64640
|
-
}
|
|
64641
|
-
if (value &&
|
|
64642
|
-
typeof value === 'object' &&
|
|
64643
|
-
typeof value.compute === 'function') {
|
|
64644
|
-
return value;
|
|
64645
|
-
}
|
|
64646
|
-
if (typeof value === 'string') {
|
|
64647
|
-
const registered = (0,safeFunctions/* .readOwn */.jU)(this.seriesFunctions, value);
|
|
64648
|
-
if (typeof registered === 'function') {
|
|
64649
|
-
return { compute: registered };
|
|
64650
|
-
}
|
|
64651
|
-
if (registered && typeof registered === 'object') {
|
|
64652
|
-
return registered;
|
|
64653
|
-
}
|
|
64654
|
-
}
|
|
64655
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(site, `unknown series function ${JSON.stringify(value)}; known: ${Object.keys(this.seriesFunctions).join(', ') || '(none)'}`);
|
|
64656
|
-
}
|
|
64657
|
-
parseArguments(args, site) {
|
|
64658
|
-
if (args === undefined) {
|
|
64659
|
-
return [];
|
|
64660
|
-
}
|
|
64661
|
-
if (!args || typeof args !== 'object' || Array.isArray(args)) {
|
|
64662
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(site, 'expected an object of arguments', args);
|
|
64663
|
-
}
|
|
64664
|
-
return Object.entries(args).map(([name, raw]) => {
|
|
64665
|
-
const argumentSite = (0,safeFunctions.at)(site, name);
|
|
64666
|
-
if ((0,safeFunctions/* .isUnsafeKey */.ez)(name)) {
|
|
64667
|
-
(0,safeFunctions/* .invalidAt */.Hn)(argumentSite, `the argument name "${name}" is not allowed`);
|
|
64668
|
-
}
|
|
64669
|
-
if (isFixedValue(raw)) {
|
|
64670
|
-
return { name, fixed: copyFixedValue(raw), reads: [] };
|
|
64671
|
-
}
|
|
64672
|
-
if (typeof raw === 'string') {
|
|
64673
|
-
const { evaluate, reads } = this.parseExpression(raw, argumentSite);
|
|
64674
|
-
return { name, evaluate, reads };
|
|
64675
|
-
}
|
|
64676
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(argumentSite, 'an argument is a fixed value (a number, a boolean, null or an array) or an expression string', raw);
|
|
64677
|
-
});
|
|
64678
|
-
}
|
|
64679
|
-
}
|
|
64680
|
-
function readsInstance(read, dependency) {
|
|
64681
|
-
if (!dependency) {
|
|
64682
|
-
return false;
|
|
64683
|
-
}
|
|
64684
|
-
switch (dependency.kind) {
|
|
64685
|
-
case 'keyword':
|
|
64686
|
-
return true;
|
|
64687
|
-
case 'attribute':
|
|
64688
|
-
case 'displaySet':
|
|
64689
|
-
return false;
|
|
64690
|
-
case 'series':
|
|
64691
|
-
return readsInstance(read, dependency.inner);
|
|
64692
|
-
case 'entry': {
|
|
64693
|
-
const { bound } = dependency;
|
|
64694
|
-
if (read.field !== undefined) {
|
|
64695
|
-
return bound.group?.fields?.[read.field] === 'instance';
|
|
64696
|
-
}
|
|
64697
|
-
return bound.scope === 'instance';
|
|
64698
|
-
}
|
|
64699
|
-
}
|
|
64700
|
-
}
|
|
64701
|
-
|
|
64702
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/groupInstancesBySplitRules.js
|
|
64703
|
-
|
|
64704
|
-
|
|
64705
|
-
|
|
64706
|
-
|
|
64707
|
-
function computeSeriesFacts(instances, rules) {
|
|
64708
|
-
const facts = {};
|
|
64709
|
-
for (const rule of rules) {
|
|
64710
|
-
if (!rule.series) {
|
|
64711
|
-
continue;
|
|
64712
|
-
}
|
|
64713
|
-
const computed = rule.series({ instances, series: facts }) ?? {};
|
|
64714
|
-
for (const [name, value] of Object.entries(computed)) {
|
|
64715
|
-
if (!isUnsafeKey(name) &&
|
|
64716
|
-
!Object.prototype.hasOwnProperty.call(facts, name)) {
|
|
64717
|
-
facts[name] = value;
|
|
64718
|
-
}
|
|
64719
|
-
}
|
|
64720
|
-
}
|
|
64721
|
-
return facts;
|
|
64722
|
-
}
|
|
64723
|
-
function chainComparators(comparators) {
|
|
64724
|
-
if (comparators.length === 1) {
|
|
64725
|
-
return comparators[0];
|
|
64726
|
-
}
|
|
64727
|
-
return (a, b, context) => {
|
|
64728
|
-
for (const comparator of comparators) {
|
|
64729
|
-
const order = comparator(a, b, context);
|
|
64730
|
-
if (Number.isFinite(order) && order !== 0) {
|
|
64731
|
-
return order;
|
|
64732
|
-
}
|
|
64733
|
-
}
|
|
64734
|
-
return 0;
|
|
64735
|
-
};
|
|
64736
|
-
}
|
|
64737
|
-
function buildInstanceOrderer(splitRule, context, options) {
|
|
64738
|
-
const comparators = [
|
|
64739
|
-
splitRule.compareInstances,
|
|
64740
|
-
options.compareInstances,
|
|
64741
|
-
].filter((comparator) => typeof comparator === 'function');
|
|
64742
|
-
const baseSort = options.sortInstances;
|
|
64743
|
-
const orderContext = {
|
|
64744
|
-
matchedRule: splitRule,
|
|
64745
|
-
series: context.series,
|
|
64746
|
-
};
|
|
64747
|
-
return (instances) => {
|
|
64748
|
-
let ordered = sortInstancesCopy(instances);
|
|
64749
|
-
if (baseSort) {
|
|
64750
|
-
ordered = [...baseSort(ordered, orderContext)];
|
|
64751
|
-
}
|
|
64752
|
-
if (comparators.length) {
|
|
64753
|
-
const compare = chainComparators(comparators);
|
|
64754
|
-
const sortContext = {
|
|
64755
|
-
...context,
|
|
64756
|
-
displaySet: displaySetContextFor(context.series, ordered),
|
|
64757
|
-
};
|
|
64758
|
-
ordered.sort((a, b) => compare(a, b, sortContext));
|
|
64759
|
-
}
|
|
64760
|
-
return ordered;
|
|
64761
|
-
};
|
|
64762
|
-
}
|
|
64763
|
-
function orderInstancesForRule(instances, splitRule, options = {}) {
|
|
64764
|
-
const context = {
|
|
64765
|
-
series: options.series
|
|
64766
|
-
? withInstances(options.series, instances)
|
|
64767
|
-
: computeSeriesFacts(sortInstancesCopy(instances), [splitRule]),
|
|
64768
|
-
};
|
|
64769
|
-
return buildInstanceOrderer(splitRule, context, options)(instances);
|
|
64770
|
-
}
|
|
64771
|
-
function isDigitAt(value, index) {
|
|
64772
|
-
const code = value.charCodeAt(index);
|
|
64773
|
-
return code >= 0x30 && code <= 0x39;
|
|
64774
|
-
}
|
|
64775
|
-
function digitRunEnd(value, start) {
|
|
64776
|
-
let end = start;
|
|
64777
|
-
while (end < value.length && isDigitAt(value, end)) {
|
|
64778
|
-
end += 1;
|
|
64779
|
-
}
|
|
64780
|
-
return end;
|
|
64781
|
-
}
|
|
64782
|
-
function compareDigitRuns(a, b) {
|
|
64783
|
-
const aValue = a.replace(/^0+/, '');
|
|
64784
|
-
const bValue = b.replace(/^0+/, '');
|
|
64785
|
-
if (aValue.length !== bValue.length) {
|
|
64786
|
-
return aValue.length - bValue.length;
|
|
64787
|
-
}
|
|
64788
|
-
if (aValue !== bValue) {
|
|
64789
|
-
return aValue < bValue ? -1 : 1;
|
|
64790
|
-
}
|
|
64791
|
-
return a.length - b.length;
|
|
64792
|
-
}
|
|
64793
|
-
function compareSplitKeys(a, b) {
|
|
64794
|
-
let aIndex = 0;
|
|
64795
|
-
let bIndex = 0;
|
|
64796
|
-
while (aIndex < a.length && bIndex < b.length) {
|
|
64797
|
-
if (isDigitAt(a, aIndex) && isDigitAt(b, bIndex)) {
|
|
64798
|
-
const aEnd = digitRunEnd(a, aIndex);
|
|
64799
|
-
const bEnd = digitRunEnd(b, bIndex);
|
|
64800
|
-
const byDigits = compareDigitRuns(a.slice(aIndex, aEnd), b.slice(bIndex, bEnd));
|
|
64801
|
-
if (byDigits !== 0) {
|
|
64802
|
-
return byDigits;
|
|
64803
|
-
}
|
|
64804
|
-
aIndex = aEnd;
|
|
64805
|
-
bIndex = bEnd;
|
|
64806
|
-
continue;
|
|
64807
|
-
}
|
|
64808
|
-
const aCode = a.charCodeAt(aIndex);
|
|
64809
|
-
const bCode = b.charCodeAt(bIndex);
|
|
64810
|
-
if (aCode !== bCode) {
|
|
64811
|
-
return aCode - bCode;
|
|
64812
|
-
}
|
|
64813
|
-
aIndex += 1;
|
|
64814
|
-
bIndex += 1;
|
|
64815
|
-
}
|
|
64816
|
-
return a.length - aIndex - (b.length - bIndex);
|
|
64817
|
-
}
|
|
64818
|
-
function normalizeSplitKeyPart(value) {
|
|
64819
|
-
if (hasNoValue(value)) {
|
|
64820
|
-
return null;
|
|
64821
|
-
}
|
|
64822
|
-
if (Array.isArray(value)) {
|
|
64823
|
-
const parts = value.map(normalizeSplitKeyPart);
|
|
64824
|
-
return parts.length === 1 ? parts[0] : parts;
|
|
64825
|
-
}
|
|
64826
|
-
if (typeof value === 'string') {
|
|
64827
|
-
const number = Number(value);
|
|
64828
|
-
return Number.isFinite(number) && String(number) === value ? number : value;
|
|
64829
|
-
}
|
|
64830
|
-
return value;
|
|
64831
|
-
}
|
|
64832
|
-
function buildGroupByParts(instance, context, splitRule) {
|
|
64833
|
-
const groupBy = splitRule.groupBy ?? ['SeriesInstanceUID'];
|
|
64834
|
-
return groupBy.map((key) => normalizeSplitKeyPart(typeof key === 'function' ? key(instance, context) : instance[key]));
|
|
64835
|
-
}
|
|
64836
|
-
function buildSplitKey(ruleDiscriminator, baseKeyParts) {
|
|
64837
|
-
return JSON.stringify([ruleDiscriminator, ...baseKeyParts]);
|
|
64838
|
-
}
|
|
64839
|
-
function groupInstancesBySplitRules_groupInstancesBySplitRules(instances, ruleSet, onUnmatched, options = {}) {
|
|
64840
|
-
const splitRules = resolveSplitRuleSet(ruleSet);
|
|
64841
|
-
if (!instances.length) {
|
|
64842
|
-
return [];
|
|
64843
|
-
}
|
|
64844
|
-
const sorted = sortInstancesCopy(instances);
|
|
64845
|
-
const context = {
|
|
64846
|
-
series: computeSeriesFacts(sorted, splitRules),
|
|
64847
|
-
};
|
|
64848
|
-
const claimedByRule = splitRules.map(() => []);
|
|
64849
|
-
for (const instance of sorted) {
|
|
64850
|
-
let matched = false;
|
|
64851
|
-
for (let ruleIndex = 0; ruleIndex < splitRules.length; ruleIndex++) {
|
|
64852
|
-
const splitRule = splitRules[ruleIndex];
|
|
64853
|
-
if (splitRule.matches && !splitRule.matches(instance, context)) {
|
|
64854
|
-
continue;
|
|
64855
|
-
}
|
|
64856
|
-
claimedByRule[ruleIndex].push(instance);
|
|
64857
|
-
matched = true;
|
|
64858
|
-
break;
|
|
64859
|
-
}
|
|
64860
|
-
if (!matched) {
|
|
64861
|
-
onUnmatched?.(instance);
|
|
64862
|
-
}
|
|
64863
|
-
}
|
|
64864
|
-
const ruleOrderers = splitRules.map((rule) => buildInstanceOrderer(rule, context, options));
|
|
64865
|
-
const instancesMap = new Map();
|
|
64866
|
-
const groupRuleIndex = new Map();
|
|
64867
|
-
for (let ruleIndex = 0; ruleIndex < splitRules.length; ruleIndex++) {
|
|
64868
|
-
const splitRule = splitRules[ruleIndex];
|
|
64869
|
-
for (const instance of claimedByRule[ruleIndex]) {
|
|
64870
|
-
const key = buildSplitKey(splitRule.id, buildGroupByParts(instance, context, splitRule));
|
|
64871
|
-
let group = instancesMap.get(key);
|
|
64872
|
-
if (!group) {
|
|
64873
|
-
group = {
|
|
64874
|
-
instances: [],
|
|
64875
|
-
matchedRule: splitRule,
|
|
64876
|
-
series: context.series,
|
|
64877
|
-
splitKey: key,
|
|
64878
|
-
};
|
|
64879
|
-
instancesMap.set(key, group);
|
|
64880
|
-
groupRuleIndex.set(key, ruleIndex);
|
|
64881
|
-
}
|
|
64882
|
-
group.instances.push(instance);
|
|
64883
|
-
}
|
|
64884
|
-
}
|
|
64885
|
-
const groups = Array.from(instancesMap.values());
|
|
64886
|
-
for (const group of groups) {
|
|
64887
|
-
const ruleIndex = groupRuleIndex.get(group.splitKey ?? '') ?? 0;
|
|
64888
|
-
group.instances = ruleOrderers[ruleIndex](group.instances);
|
|
64889
|
-
}
|
|
64890
|
-
return groups.sort((a, b) => {
|
|
64891
|
-
const aKey = a.splitKey ?? '';
|
|
64892
|
-
const bKey = b.splitKey ?? '';
|
|
64893
|
-
const ruleOrder = (groupRuleIndex.get(aKey) ?? 0) - (groupRuleIndex.get(bKey) ?? 0);
|
|
64894
|
-
return ruleOrder !== 0 ? ruleOrder : compareSplitKeys(aKey, bKey);
|
|
64895
|
-
});
|
|
64896
|
-
}
|
|
64897
|
-
|
|
64898
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/splitImageIdsBySplitRules.js
|
|
64899
|
-
|
|
64900
|
-
|
|
64901
|
-
function splitImageIdsBySplitRules(imageIds, options) {
|
|
64902
|
-
const { getNaturalizedInstance, splitRules, onMissingImageId, onUnmatchedInstance, sortInstances, compareInstances, } = options;
|
|
64903
|
-
const instances = resolveInstances(imageIds, getNaturalizedInstance, {
|
|
64904
|
-
onMissing: onMissingImageId,
|
|
64905
|
-
});
|
|
64906
|
-
return groupInstancesBySplitRules(instances, splitRules, onUnmatchedInstance, {
|
|
64907
|
-
sortInstances,
|
|
64908
|
-
compareInstances,
|
|
64909
|
-
});
|
|
64910
|
-
}
|
|
64911
|
-
|
|
64912
|
-
// EXTERNAL MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/enums/index.js
|
|
64913
|
-
var enums = __webpack_require__(2610);
|
|
64914
|
-
// EXTERNAL MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/metaData.js
|
|
64915
|
-
var metaData = __webpack_require__(6482);
|
|
64916
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/registerDisplaySetMetadata.js
|
|
64917
|
-
|
|
64918
|
-
|
|
64919
|
-
function registerDisplaySetMetadata(imageIds, displaySet, options = {}) {
|
|
64920
|
-
const idsToRegister = new Set([displaySet.displaySetId, ...imageIds]);
|
|
64921
|
-
if (options.includeImageIds) {
|
|
64922
|
-
for (const frameId of displaySet.imageIds) {
|
|
64923
|
-
idsToRegister.add(frameId);
|
|
64924
|
-
}
|
|
64925
|
-
}
|
|
64926
|
-
for (const underlyingId of displaySet.underlyingImageIds) {
|
|
64927
|
-
idsToRegister.add(underlyingId);
|
|
64928
|
-
}
|
|
64929
|
-
for (const imageId of idsToRegister) {
|
|
64930
|
-
if (!imageId) {
|
|
64931
|
-
continue;
|
|
64932
|
-
}
|
|
64933
|
-
addTyped(MetadataModules.DISPLAY_SET, imageId, { displaySet });
|
|
64934
|
-
}
|
|
64935
|
-
}
|
|
64936
|
-
|
|
64937
|
-
// EXTERNAL MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/displaySetProvider.js
|
|
64938
|
-
var displaySetProvider = __webpack_require__(82395);
|
|
64939
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/metadataContext.js
|
|
64940
|
-
|
|
64941
|
-
|
|
64942
|
-
|
|
64943
|
-
|
|
64944
|
-
let activeContext = (/* unused pure expression or super */ null && (defaultMetadataContext));
|
|
64945
|
-
function setMetadataContext(context) {
|
|
64946
|
-
activeContext = context ?? defaultMetadataContext;
|
|
64947
|
-
}
|
|
64948
|
-
function getMetadataContext() {
|
|
64949
|
-
return activeContext;
|
|
64950
|
-
}
|
|
64951
|
-
const programs = new WeakMap();
|
|
64952
|
-
function compileMetadataContext(context, options = {}) {
|
|
64953
|
-
const program = new ContextProgram({ ...displaySetContext_defaultMetadataContext, ...context }, {
|
|
64954
|
-
seriesFunctions: {
|
|
64955
|
-
...BUILT_IN_SERIES_FUNCTIONS,
|
|
64956
|
-
...options.seriesFunctions,
|
|
64957
|
-
},
|
|
64958
|
-
deniedNames: options.deniedNames,
|
|
64959
|
-
site: (0,safeFunctions/* .createSite */.Ae)({
|
|
64960
|
-
definition: options.definition ?? 'metadata context',
|
|
64961
|
-
path: 'context',
|
|
64962
|
-
}, splitRuleSchema, safeFunctions/* .safeFunctionCompilers */.WX),
|
|
64963
|
-
});
|
|
64964
|
-
if (!options.seriesFunctions && !options.deniedNames) {
|
|
64965
|
-
programs.set(context ?? displaySetContext_defaultMetadataContext, program);
|
|
64966
|
-
}
|
|
64967
|
-
return program;
|
|
64968
|
-
}
|
|
64969
|
-
function getMetadataContextProgram(context, options = {}) {
|
|
64970
|
-
const shareable = !options.seriesFunctions && !options.deniedNames;
|
|
64971
|
-
const cached = shareable
|
|
64972
|
-
? programs.get(context ?? displaySetContext_defaultMetadataContext)
|
|
64973
|
-
: undefined;
|
|
64974
|
-
return cached ?? compileMetadataContext(context, options);
|
|
64975
|
-
}
|
|
64976
|
-
function programOf(context) {
|
|
64977
|
-
return getMetadataContextProgram(context);
|
|
64978
|
-
}
|
|
64979
|
-
function metadataContext_getContextValue(name, instance, context) {
|
|
64980
|
-
return programOf(context ?? activeContext).instanceValue(name, instance);
|
|
64981
|
-
}
|
|
64982
|
-
|
|
64983
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/compileSplitRules.js
|
|
64984
|
-
|
|
64985
|
-
|
|
64986
|
-
|
|
64987
|
-
|
|
64988
|
-
|
|
64989
|
-
|
|
64990
|
-
|
|
64991
|
-
const DEFINITION = 'display set rules';
|
|
64992
|
-
function instanceReader(compile, name, site, place, field) {
|
|
64993
|
-
const read = compile.program.readerAt(compile.layer, name, site, {
|
|
64994
|
-
field,
|
|
64995
|
-
place,
|
|
64996
|
-
});
|
|
64997
|
-
const { program } = compile;
|
|
64998
|
-
return (instance, context) => read(program.runtimeFrom(context, instance), instance);
|
|
64999
|
-
}
|
|
65000
|
-
function compileName(value, site, compile) {
|
|
65001
|
-
if (typeof value === 'function') {
|
|
65002
|
-
return value;
|
|
65003
|
-
}
|
|
65004
|
-
if (typeof value !== 'string') {
|
|
65005
|
-
return (0,safeFunctions/* .unrecognized */.YC)(splitRuleSchema.name, value, site);
|
|
65006
|
-
}
|
|
65007
|
-
return instanceReader(compile, value, site, 'groupBy');
|
|
65008
|
-
}
|
|
65009
|
-
function compareSortValues(a, b) {
|
|
65010
|
-
const x = (0,esm/* .toFiniteFirst */.FL)(a);
|
|
65011
|
-
const y = (0,esm/* .toFiniteFirst */.FL)(b);
|
|
65012
|
-
if (x !== undefined && y !== undefined) {
|
|
65013
|
-
return x - y;
|
|
65014
|
-
}
|
|
65015
|
-
if ((0,safeFunctions/* .hasNoValue */.Tn)(a) || (0,safeFunctions/* .hasNoValue */.Tn)(b)) {
|
|
65016
|
-
return Number((0,safeFunctions/* .hasNoValue */.Tn)(a)) - Number((0,safeFunctions/* .hasNoValue */.Tn)(b));
|
|
65017
|
-
}
|
|
65018
|
-
const aText = String((0,esm/* .asArrayFirst */.mm)(a));
|
|
65019
|
-
const bText = String((0,esm/* .asArrayFirst */.mm)(b));
|
|
65020
|
-
return aText < bText ? -1 : aText > bText ? 1 : 0;
|
|
65021
|
-
}
|
|
65022
|
-
function compileSortKey(value, site, compile) {
|
|
65023
|
-
if (typeof value === 'function') {
|
|
65024
|
-
return value;
|
|
65025
|
-
}
|
|
65026
|
-
if (typeof value === 'string') {
|
|
65027
|
-
const read = compile.program.readerAt(compile.layer, value, site, {
|
|
65028
|
-
place: 'sortBy',
|
|
65029
|
-
});
|
|
65030
|
-
const { program } = compile;
|
|
65031
|
-
return (a, b, context) => {
|
|
65032
|
-
const runtime = program.runtimeFrom(context, [a, b]);
|
|
65033
|
-
return compareSortValues(read(runtime, a), read(runtime, b));
|
|
65034
|
-
};
|
|
65035
|
-
}
|
|
65036
|
-
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
65037
|
-
return (0,safeFunctions/* .unrecognized */.YC)(splitRuleSchema.sortKey, value, site);
|
|
65038
|
-
}
|
|
65039
|
-
(0,safeFunctions/* .matchForm */.WW)(splitRuleSchema.sortKey, value, site);
|
|
65040
|
-
const name = value.sortFunction;
|
|
65041
|
-
const sortFunction = (0,safeFunctions/* .readOwn */.jU)(compile.sortFunctions, name);
|
|
65042
|
-
if (typeof sortFunction !== 'function') {
|
|
65043
|
-
return (0,safeFunctions/* .invalidAt */.Hn)((0,safeFunctions.at)(site, 'sortFunction'), `unknown sort function "${name}"; known: ${Object.keys(compile.sortFunctions).join(', ') || '(none)'}`);
|
|
65044
|
-
}
|
|
65045
|
-
return sortFunction;
|
|
65046
|
-
}
|
|
65047
|
-
function compileAttributeValue(value, site, compile) {
|
|
65048
|
-
const { program, layer } = compile;
|
|
65049
|
-
if (typeof value === 'function') {
|
|
65050
|
-
const scope = { key: `#attribute:${site.path}`, deps: new Map(), layer };
|
|
65051
|
-
return (runtime, instances, extras) => value(instances, runtime.env(scope, instances[0], extras));
|
|
65052
|
-
}
|
|
65053
|
-
if (isFixedValue(value, false)) {
|
|
65054
|
-
return () => value;
|
|
65055
|
-
}
|
|
65056
|
-
if (typeof value === 'string') {
|
|
65057
|
-
const read = program.readerAt(layer, value, site, { place: 'attributes' });
|
|
65058
|
-
return (runtime, instances, extras) => read(runtime, instances[0], extras);
|
|
65059
|
-
}
|
|
65060
|
-
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
65061
|
-
return (0,safeFunctions/* .unrecognized */.YC)(splitRuleSchema.attributeValue, value, site);
|
|
65062
|
-
}
|
|
65063
|
-
const [form] = (0,safeFunctions/* .matchForm */.WW)(splitRuleSchema.attributeValue, value, site);
|
|
65064
|
-
const fields = value;
|
|
65065
|
-
if (form === 'expression') {
|
|
65066
|
-
return program.attributeExpression(layer, fields.expression, (0,safeFunctions.at)(site, 'expression'));
|
|
65067
|
-
}
|
|
65068
|
-
const templateSite = (0,safeFunctions.at)(site, 'template');
|
|
65069
|
-
const parts = (0,safeFunctions/* .parseTemplate */.QC)(fields.template, templateSite).map((segment) => 'literal' in segment
|
|
65070
|
-
? () => segment.literal
|
|
65071
|
-
: program.readerAt(layer, segment.name, templateSite, {
|
|
65072
|
-
field: segment.field,
|
|
65073
|
-
place: 'attributes',
|
|
65074
|
-
}));
|
|
65075
|
-
return (runtime, instances, extras) => parts
|
|
65076
|
-
.map((part) => {
|
|
65077
|
-
const text = part(runtime, instances[0], extras);
|
|
65078
|
-
return (0,safeFunctions/* .hasNoValue */.Tn)(text) ? '' : String(text);
|
|
65079
|
-
})
|
|
65080
|
-
.join('');
|
|
65081
|
-
}
|
|
65082
|
-
function compileAttributes(attributes, site, compile) {
|
|
65083
|
-
if (typeof attributes === 'function') {
|
|
65084
|
-
return attributes;
|
|
65085
|
-
}
|
|
65086
|
-
if (!attributes ||
|
|
65087
|
-
typeof attributes !== 'object' ||
|
|
65088
|
-
Array.isArray(attributes)) {
|
|
65089
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(site, 'expected an object of attribute values, keyed by attribute name, or a function (attributes, options) => Record<string, unknown>', attributes);
|
|
65090
|
-
}
|
|
65091
|
-
const readers = Object.entries(attributes).map(([key, value]) => {
|
|
65092
|
-
const valueSite = (0,safeFunctions.at)(site, key);
|
|
65093
|
-
if ((0,safeFunctions/* .isUnsafeKey */.ez)(key)) {
|
|
65094
|
-
(0,safeFunctions/* .invalidAt */.Hn)(valueSite, `the key "${key}" is not allowed`);
|
|
65095
|
-
}
|
|
65096
|
-
return [key, compileAttributeValue(value, valueSite, compile)];
|
|
65097
|
-
});
|
|
65098
|
-
const { program } = compile;
|
|
65099
|
-
return (engine, options) => {
|
|
65100
|
-
const instances = options.instances ?? [];
|
|
65101
|
-
const runtime = program.runtimeFrom({
|
|
65102
|
-
series: options.series,
|
|
65103
|
-
displaySet: displaySetContext_displaySetContextFor(options.series, instances),
|
|
65104
|
-
}, instances);
|
|
65105
|
-
const extras = {
|
|
65106
|
-
splitNumber: options.splitNumber,
|
|
65107
|
-
sopClassUids: engine?.sopClassUids,
|
|
65108
|
-
};
|
|
65109
|
-
const result = {};
|
|
65110
|
-
for (const [key, read] of readers) {
|
|
65111
|
-
result[key] = instances.length
|
|
65112
|
-
? read(runtime, instances, extras)
|
|
65113
|
-
: undefined;
|
|
65114
|
-
}
|
|
65115
|
-
return result;
|
|
65116
|
-
};
|
|
65117
|
-
}
|
|
65118
|
-
function compileList(value, site, compileEntry) {
|
|
65119
|
-
if (!Array.isArray(value)) {
|
|
65120
|
-
return (0,safeFunctions/* .invalidAt */.Hn)(site, 'expected an array', value);
|
|
65121
|
-
}
|
|
65122
|
-
return value.map((entry, index) => compileEntry(entry, (0,safeFunctions.at)(site, index)));
|
|
65123
|
-
}
|
|
65124
|
-
function compileRule(id, rule, site, program, sortFunctions) {
|
|
65125
|
-
(0,safeFunctions/* .matchForm */.WW)(splitRuleSchema.rule, rule, site);
|
|
65126
|
-
const layer = program.layer(id, rule.context, (0,safeFunctions.at)(site, 'context'));
|
|
65127
|
-
const compile = { site, program, layer, sortFunctions };
|
|
65128
|
-
const compiled = { id, series: program.seriesHook };
|
|
65129
|
-
if (rule.groupId !== undefined) {
|
|
65130
|
-
compiled.groupId = rule.groupId;
|
|
65131
|
-
}
|
|
65132
|
-
if (rule.viewportTypes !== undefined) {
|
|
65133
|
-
compiled.viewportTypes = rule.viewportTypes;
|
|
65134
|
-
}
|
|
65135
|
-
if (rule.handler !== undefined) {
|
|
65136
|
-
compiled.handler = rule.handler;
|
|
65137
|
-
}
|
|
65138
|
-
if (rule.matches !== undefined) {
|
|
65139
|
-
const matchesSite = {
|
|
65140
|
-
...(0,safeFunctions.at)(site, 'matches'),
|
|
65141
|
-
readName: (name, nameSite, field) => instanceReader(compile, name, nameSite, 'matches', field),
|
|
65142
|
-
};
|
|
65143
|
-
compiled.matches = (0,safeFunctions/* .compileConditionAt */.IC)(rule.matches, matchesSite);
|
|
65144
|
-
}
|
|
65145
|
-
if (rule.groupBy !== undefined) {
|
|
65146
|
-
const groupBy = compileList(rule.groupBy, (0,safeFunctions.at)(site, 'groupBy'), (entry, s) => compileName(entry, s, compile));
|
|
65147
|
-
if (groupBy.length) {
|
|
65148
|
-
compiled.groupBy = groupBy;
|
|
65149
|
-
}
|
|
65150
|
-
}
|
|
65151
|
-
if (rule.sortBy !== undefined) {
|
|
65152
|
-
const comparators = compileList(rule.sortBy, (0,safeFunctions.at)(site, 'sortBy'), (entry, s) => compileSortKey(entry, s, compile));
|
|
65153
|
-
if (comparators.length) {
|
|
65154
|
-
compiled.compareInstances = chainComparators(comparators);
|
|
65155
|
-
}
|
|
65156
|
-
}
|
|
65157
|
-
if (rule.attributes !== undefined) {
|
|
65158
|
-
compiled.customAttributes = compileAttributes(rule.attributes, (0,safeFunctions.at)(site, 'attributes'), compile);
|
|
65159
|
-
}
|
|
65160
|
-
return compiled;
|
|
65161
|
-
}
|
|
65162
|
-
function compileDisplaySetSplitRules(rules, options = {}) {
|
|
65163
|
-
if (!rules || typeof rules !== 'object' || Array.isArray(rules)) {
|
|
65164
|
-
throw new Error(`Invalid ${DEFINITION}: the rules must be an object keyed by rule id: ${JSON.stringify(rules)}`);
|
|
65165
|
-
}
|
|
65166
|
-
const program = getMetadataContextProgram(options.context, {
|
|
65167
|
-
seriesFunctions: options.seriesFunctions,
|
|
65168
|
-
deniedNames: options.deniedNames,
|
|
65169
|
-
definition: DEFINITION,
|
|
65170
|
-
});
|
|
65171
|
-
const sortFunctions = options.sortFunctions ?? {};
|
|
65172
|
-
const compiledSet = {};
|
|
65173
|
-
for (const [id, rule] of Object.entries(rules)) {
|
|
65174
|
-
validateSplitRuleSetEntry(id, rule);
|
|
65175
|
-
const site = (0,safeFunctions/* .createSite */.Ae)({ definition: DEFINITION, path: `rule '${id}'` }, splitRuleSchema, safeFunctions/* .safeFunctionCompilers */.WX);
|
|
65176
|
-
const { id: _id, ...compiledRule } = compileRule(id, rule, site, program, sortFunctions);
|
|
65177
|
-
compiledSet[id] = { ...compiledRule, priority: rule.priority };
|
|
65178
|
-
}
|
|
65179
|
-
return compiledSet;
|
|
65180
|
-
}
|
|
65181
|
-
|
|
65182
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/displaySetRules.js
|
|
65183
|
-
|
|
65184
|
-
const VOLUME_MODALITIES = ['CT', 'MR', 'PT', 'NM'];
|
|
65185
|
-
const CINE_MODALITIES = ['US', 'XA', 'RF', 'ES', 'XC'];
|
|
65186
|
-
const VOLUME_MULTIFRAME_SOP_CLASSES = [
|
|
65187
|
-
'1.2.840.10008.5.1.4.1.1.6.2',
|
|
65188
|
-
'1.2.840.10008.5.1.4.1.1.13.1.1',
|
|
65189
|
-
'1.2.840.10008.5.1.4.1.1.13.1.2',
|
|
65190
|
-
];
|
|
65191
|
-
const quotedList = (values) => `[${values.map((v) => `'${v}'`).join(', ')}]`;
|
|
65192
|
-
const SINGLE_IMAGE_MODALITIES = ['CR', 'DX', 'MG'];
|
|
65193
|
-
const RENDERABLE_IMAGE = { isImage: true, Rows: { notNull: true } };
|
|
65194
|
-
const REVISION_CHAIN = {
|
|
65195
|
-
groupBy: ['SeriesInstanceUID', 'revisionChainUid'],
|
|
65196
|
-
sortBy: ['isActiveRevision', 'InstanceNumber'],
|
|
65197
|
-
attributes: { activeSopInstanceUid: 'revisionChainUid' },
|
|
65198
|
-
};
|
|
65199
|
-
const objectRule = (priority, kind, handler, description) => ({
|
|
65200
|
-
priority,
|
|
65201
|
-
description,
|
|
65202
|
-
handler,
|
|
65203
|
-
matches: { [kind]: true },
|
|
65204
|
-
groupBy: ['SeriesInstanceUID'],
|
|
63664
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
63665
|
+
}, {
|
|
63666
|
+
i: splitRuleSchema,
|
|
63667
|
+
v: ATTRIBUTE_ONLY_NAMES
|
|
65205
63668
|
});
|
|
65206
|
-
const displaySetRules = {
|
|
65207
|
-
video: {
|
|
65208
|
-
priority: 1,
|
|
65209
|
-
description: 'A video-only SOP class, or a video transfer syntax, or (with no known ' +
|
|
65210
|
-
'transfer syntax) a long multi-frame secondary capture. One display set ' +
|
|
65211
|
-
'per instance, shown on a video viewport.',
|
|
65212
|
-
handler: 'video',
|
|
65213
|
-
matches: { isVideo: true },
|
|
65214
|
-
groupBy: ['SOPInstanceUID'],
|
|
65215
|
-
},
|
|
65216
|
-
ecg: {
|
|
65217
|
-
priority: 2,
|
|
65218
|
-
description: 'ECG / waveform SOP classes. One display set per instance, shown on a ' +
|
|
65219
|
-
'waveform viewport rather than an image viewport.',
|
|
65220
|
-
handler: 'ecg',
|
|
65221
|
-
matches: { isEcg: true },
|
|
65222
|
-
groupBy: ['SOPInstanceUID'],
|
|
65223
|
-
},
|
|
65224
|
-
wholeslide: {
|
|
65225
|
-
priority: 3,
|
|
65226
|
-
description: 'VL Whole Slide Microscopy (or modality SM). All pyramid levels of the ' +
|
|
65227
|
-
'series form a single whole-slide display set.',
|
|
65228
|
-
handler: 'wholeSlide',
|
|
65229
|
-
matches: { isWsi: true },
|
|
65230
|
-
groupBy: ['SeriesInstanceUID'],
|
|
65231
|
-
},
|
|
65232
|
-
singleImageModality: {
|
|
65233
|
-
priority: 4,
|
|
65234
|
-
description: 'CR / DX / MG, which acquire one image per instance. One display set ' +
|
|
65235
|
-
'per instance, so each view of a mammography series is its own display ' +
|
|
65236
|
-
'set.',
|
|
65237
|
-
matches: { Modality: SINGLE_IMAGE_MODALITIES, isImage: true },
|
|
65238
|
-
groupBy: ['SOPInstanceUID'],
|
|
65239
|
-
},
|
|
65240
|
-
multiFrame: {
|
|
65241
|
-
priority: 5,
|
|
65242
|
-
description: 'Multi-frame image instances, one display set per instance. A cine clip ' +
|
|
65243
|
-
'(a slice location, or a US, XA, RF, ES or XC multi-frame that is not a ' +
|
|
65244
|
-
'volume) is flagged isClip. Another multi-frame instance, such as an ' +
|
|
65245
|
-
'enhanced CT, is not a clip.',
|
|
65246
|
-
context: {
|
|
65247
|
-
isCineClip: `SliceLocation != null || (Modality in ${quotedList(CINE_MODALITIES)}` +
|
|
65248
|
-
` && !(SOPClassUID in ${quotedList(VOLUME_MULTIFRAME_SOP_CLASSES)}))`,
|
|
65249
|
-
},
|
|
65250
|
-
matches: { isImage: true, isMultiFrame: true },
|
|
65251
|
-
groupBy: ['SOPInstanceUID'],
|
|
65252
|
-
attributes: {
|
|
65253
|
-
isClip: 'isCineClip',
|
|
65254
|
-
numImageFrames: { expression: 'Number(NumberOfFrames)' },
|
|
65255
|
-
},
|
|
65256
|
-
},
|
|
65257
|
-
mixedDimensionalityBValue: {
|
|
65258
|
-
priority: 6,
|
|
65259
|
-
description: 'Diffusion MR that mixes 4D b-value frames with trailing frames that have ' +
|
|
65260
|
-
'none. The undefined-b-value frames are not part of the 4D set, so they ' +
|
|
65261
|
-
'split off - otherwise 4D rendering is applied to the 3D portion.',
|
|
65262
|
-
context: {
|
|
65263
|
-
isMixedBValue: 'series.instances.count(DiffusionBValue) > 0 && ' +
|
|
65264
|
-
'series.instances.count(DiffusionBValue) < series.instances.count()',
|
|
65265
|
-
hasNoBValue: 'DiffusionBValue == null',
|
|
65266
|
-
},
|
|
65267
|
-
matches: { Modality: 'MR', isMixedBValue: true, ...RENDERABLE_IMAGE },
|
|
65268
|
-
groupBy: ['SeriesInstanceUID', 'hasNoBValue'],
|
|
65269
|
-
},
|
|
65270
|
-
volume3d: {
|
|
65271
|
-
priority: 7,
|
|
65272
|
-
description: 'Multi-slice CT / MR / PT / NM, which reconstruct into a volume.',
|
|
65273
|
-
matches: {
|
|
65274
|
-
Modality: VOLUME_MODALITIES,
|
|
65275
|
-
seriesInstanceCount: { greaterThan: 1 },
|
|
65276
|
-
...RENDERABLE_IMAGE,
|
|
65277
|
-
},
|
|
65278
|
-
groupBy: ['SeriesInstanceUID'],
|
|
65279
|
-
},
|
|
65280
|
-
defaultImageRule: {
|
|
65281
|
-
priority: 8,
|
|
65282
|
-
description: 'Fallback for any remaining image SOP class, also with no Rows in the ' +
|
|
65283
|
-
'metadata. Grouped one display set per series.',
|
|
65284
|
-
matches: { isImage: true },
|
|
65285
|
-
},
|
|
65286
|
-
segmentation: objectRule(9, 'isSegmentation', 'segmentation', 'Segmentations (segmentationSopClassUids). One display set per series.'),
|
|
65287
|
-
rtStructureSet: objectRule(10, 'isRtStructureSet', 'rtStructureSet', 'RT structure sets (rtStructureSetSopClassUids). One display set per series.'),
|
|
65288
|
-
parametricMap: objectRule(11, 'isParametricMap', 'parametricMap', 'Parametric maps (parametricMapSopClassUids). One display set per series.'),
|
|
65289
|
-
structuredReport: {
|
|
65290
|
-
...objectRule(12, 'isStructuredReport', 'structuredReport', 'Structured reports (structuredReportSopClassUids), also Comprehensive ' +
|
|
65291
|
-
'3D SR. One display set per series. Manufacturer and ' +
|
|
65292
|
-
'ManufacturerModelName name the writer of the SR.'),
|
|
65293
|
-
attributes: {
|
|
65294
|
-
Manufacturer: 'Manufacturer',
|
|
65295
|
-
ManufacturerModelName: 'ManufacturerModelName',
|
|
65296
|
-
},
|
|
65297
|
-
},
|
|
65298
|
-
encapsulatedDocument: {
|
|
65299
|
-
...objectRule(13, 'isEncapsulatedDocument', 'encapsulatedDocument', 'Encapsulated documents (encapsulatedDocumentSopClassUids). One ' +
|
|
65300
|
-
'display set per revision chain (PredecessorDocumentsSequence) of ' +
|
|
65301
|
-
'the series; activeSopInstanceUid names the current revision.'),
|
|
65302
|
-
...REVISION_CHAIN,
|
|
65303
|
-
},
|
|
65304
|
-
bulkAnnotation: objectRule(14, 'isBulkAnnotation', 'bulkAnnotation', 'Microscopy bulk annotations (bulkAnnotationSopClassUids). One display ' +
|
|
65305
|
-
'set per series.'),
|
|
65306
|
-
chart: {
|
|
65307
|
-
...objectRule(15, 'isChart', 'chart', 'Charts (chartSopClassUids, empty by default: a host adds its chart ' +
|
|
65308
|
-
'SOP class). One display set per revision chain of the series; ' +
|
|
65309
|
-
'activeSopInstanceUid names the current revision.'),
|
|
65310
|
-
...REVISION_CHAIN,
|
|
65311
|
-
},
|
|
65312
|
-
unsupported: {
|
|
65313
|
-
priority: Number.MAX_SAFE_INTEGER,
|
|
65314
|
-
description: 'Catch-all for objects that no other rule claims (presentation states, ' +
|
|
65315
|
-
'other non-image objects). Produces one display set for each series, ' +
|
|
65316
|
-
'marked isDisplayable: false, so the objects are surfaced rather than ' +
|
|
65317
|
-
'silently dropped. Runs last.',
|
|
65318
|
-
handler: 'unsupported',
|
|
65319
|
-
groupBy: ['SeriesInstanceUID'],
|
|
65320
|
-
},
|
|
65321
|
-
};
|
|
65322
|
-
function createDisplaySetSplitRules(rules = displaySetRules, options = {}) {
|
|
65323
|
-
return compileDisplaySetSplitRules(rules, options);
|
|
65324
|
-
}
|
|
65325
|
-
|
|
65326
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/compiledDisplaySetRules.js
|
|
65327
|
-
|
|
65328
|
-
const compiledDisplaySetRules = createDisplaySetSplitRules(displaySetRules);
|
|
65329
|
-
const defaultDisplaySetSplitRules = (/* unused pure expression or super */ null && (compiledDisplaySetRules));
|
|
65330
|
-
|
|
65331
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/isReconstructableInstances.js
|
|
65332
|
-
|
|
65333
|
-
|
|
65334
|
-
|
|
65335
|
-
const SPACING_TOLERANCE = 0.2;
|
|
65336
|
-
const item = (value) => asArrayFirst(value);
|
|
65337
|
-
function vectorAt(source, path, field, length) {
|
|
65338
|
-
let current = source;
|
|
65339
|
-
for (const sequence of path) {
|
|
65340
|
-
current = item(readOwn(current, sequence));
|
|
65341
|
-
}
|
|
65342
|
-
return toFiniteVector(readOwn(current, field), length);
|
|
65343
|
-
}
|
|
65344
|
-
function geometryOf(positions, orientation) {
|
|
65345
|
-
return planeGeometry(positions.map((ImagePositionPatient, index) => ({
|
|
65346
|
-
SOPInstanceUID: String(index),
|
|
65347
|
-
ImagePositionPatient,
|
|
65348
|
-
ImageOrientationPatient: orientation,
|
|
65349
|
-
})), { args: { tolerance: SPACING_TOLERANCE } });
|
|
65350
|
-
}
|
|
65351
|
-
function isSingleFrameVolume(instances) {
|
|
65352
|
-
if (instances.length < 2) {
|
|
65353
|
-
return false;
|
|
65354
|
-
}
|
|
65355
|
-
const [first] = instances;
|
|
65356
|
-
const same = (name) => (instance) => toFiniteFirst(readOwn(instance, name)) ===
|
|
65357
|
-
toFiniteFirst(readOwn(first, name));
|
|
65358
|
-
if (!instances.every(same('Rows')) ||
|
|
65359
|
-
!instances.every(same('Columns')) ||
|
|
65360
|
-
!instances.every(same('SamplesPerPixel'))) {
|
|
65361
|
-
return false;
|
|
65362
|
-
}
|
|
65363
|
-
const geometry = planeGeometry([...instances], {
|
|
65364
|
-
args: { tolerance: SPACING_TOLERANCE },
|
|
65365
|
-
});
|
|
65366
|
-
return (geometry.irregularCount === 0 &&
|
|
65367
|
-
geometry.positions >= 2 &&
|
|
65368
|
-
!geometry.duplicates);
|
|
65369
|
-
}
|
|
65370
|
-
function framePositions(instance) {
|
|
65371
|
-
const perFrame = asArrayFromSequence(readOwn(instance, 'PerFrameFunctionalGroupsSequence')).map((group) => vectorAt(group, ['PlanePositionSequence'], 'ImagePositionPatient', 3));
|
|
65372
|
-
if (perFrame.filter(Boolean).length >= 2) {
|
|
65373
|
-
return perFrame;
|
|
65374
|
-
}
|
|
65375
|
-
const shared = vectorAt(instance, ['SharedFunctionalGroupsSequence', 'PlanePositionSequence'], 'ImagePositionPatient', 3);
|
|
65376
|
-
const count = toFiniteFirst(instance.NumberOfFrames, perFrame.length);
|
|
65377
|
-
return shared ? new Array(count).fill(shared) : [];
|
|
65378
|
-
}
|
|
65379
|
-
function asArrayFromSequence(value) {
|
|
65380
|
-
return Array.isArray(value) ? value : value == null ? [] : [value];
|
|
65381
|
-
}
|
|
65382
|
-
function isMultiFrameVolume(instance) {
|
|
65383
|
-
const perFrame0 = item(readOwn(instance, 'PerFrameFunctionalGroupsSequence'));
|
|
65384
|
-
const shared = item(readOwn(instance, 'SharedFunctionalGroupsSequence'));
|
|
65385
|
-
const detector = item(readOwn(instance, 'DetectorInformationSequence'));
|
|
65386
|
-
const hasPixelMeasures = readOwn(perFrame0, 'PixelMeasuresSequence') != null ||
|
|
65387
|
-
readOwn(shared, 'PixelMeasuresSequence') != null ||
|
|
65388
|
-
(instance.PixelSpacing != null &&
|
|
65389
|
-
(instance.SliceThickness != null ||
|
|
65390
|
-
instance.SpacingBetweenFrames != null));
|
|
65391
|
-
const orientation = toFiniteVector(instance.ImageOrientationPatient, 6) ??
|
|
65392
|
-
vectorAt(shared, ['PlaneOrientationSequence'], 'ImageOrientationPatient', 6) ??
|
|
65393
|
-
vectorAt(perFrame0, ['PlaneOrientationSequence'], 'ImageOrientationPatient', 6) ??
|
|
65394
|
-
toFiniteVector(readOwn(detector, 'ImageOrientationPatient'), 6);
|
|
65395
|
-
const hasPosition = readOwn(perFrame0, 'PlanePositionSequence') != null ||
|
|
65396
|
-
readOwn(perFrame0, 'CTPositionSequence') != null ||
|
|
65397
|
-
instance.ImagePositionPatient != null ||
|
|
65398
|
-
readOwn(detector, 'ImagePositionPatient') != null;
|
|
65399
|
-
if (!hasPixelMeasures || !orientation || !hasPosition) {
|
|
65400
|
-
return false;
|
|
65401
|
-
}
|
|
65402
|
-
if (String(instance.Modality ?? '').includes('NM')) {
|
|
65403
|
-
const subType = asArrayFromSequence(instance.ImageType)[2];
|
|
65404
|
-
if (subType !== 'RECON TOMO' && subType !== 'RECON GATED TOMO') {
|
|
65405
|
-
return false;
|
|
65406
|
-
}
|
|
65407
|
-
}
|
|
65408
|
-
const positions = framePositions(instance);
|
|
65409
|
-
if (positions.filter(Boolean).length < 2) {
|
|
65410
|
-
return true;
|
|
65411
|
-
}
|
|
65412
|
-
return geometryOf(positions, orientation).positions >= 2;
|
|
65413
|
-
}
|
|
65414
|
-
function isReconstructableInstances_isReconstructableInstances(instances) {
|
|
65415
|
-
const defined = instances.filter(Boolean);
|
|
65416
|
-
if (!defined.length) {
|
|
65417
|
-
return false;
|
|
65418
|
-
}
|
|
65419
|
-
return toFiniteFirst(defined[0].NumberOfFrames, 0) > 1
|
|
65420
|
-
? isMultiFrameVolume(defined[0])
|
|
65421
|
-
: isSingleFrameVolume(defined);
|
|
65422
|
-
}
|
|
65423
|
-
|
|
65424
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/createDisplaySetFromGroup.js
|
|
65425
|
-
|
|
65426
|
-
|
|
65427
|
-
|
|
65428
63669
|
|
|
65429
|
-
const RESERVED_ATTRIBUTE_KEYS = new Set([
|
|
65430
|
-
'imageIds',
|
|
65431
|
-
'underlyingImageIds',
|
|
65432
|
-
'instances',
|
|
65433
|
-
'displaySetId',
|
|
65434
|
-
'splitKey',
|
|
65435
|
-
'splitRuleId',
|
|
65436
|
-
'splitGroupId',
|
|
65437
|
-
'handler',
|
|
65438
|
-
'isDisplayable',
|
|
65439
|
-
]);
|
|
65440
|
-
function isAssignable(target, key) {
|
|
65441
|
-
let obj = target;
|
|
65442
|
-
while (obj) {
|
|
65443
|
-
const descriptor = Object.getOwnPropertyDescriptor(obj, key);
|
|
65444
|
-
if (descriptor) {
|
|
65445
|
-
if (descriptor.get || descriptor.set) {
|
|
65446
|
-
return typeof descriptor.set === 'function';
|
|
65447
|
-
}
|
|
65448
|
-
return descriptor.writable !== false;
|
|
65449
|
-
}
|
|
65450
|
-
obj = Object.getPrototypeOf(obj);
|
|
65451
|
-
}
|
|
65452
|
-
return true;
|
|
65453
|
-
}
|
|
65454
|
-
function runCustomAttributes(group, options) {
|
|
65455
|
-
const { instances, matchedRule } = group;
|
|
65456
|
-
const first = instances[0];
|
|
65457
|
-
if (!matchedRule.customAttributes || !first) {
|
|
65458
|
-
return undefined;
|
|
65459
|
-
}
|
|
65460
|
-
const sopClassUids = [
|
|
65461
|
-
...new Set(instances.map((i) => i.SOPClassUID).filter(Boolean)),
|
|
65462
|
-
];
|
|
65463
|
-
const isMultiFrame = Number(first.NumberOfFrames) > 1;
|
|
65464
|
-
return (matchedRule.customAttributes({ instance: first, isMultiFrame, sopClassUids }, {
|
|
65465
|
-
instances,
|
|
65466
|
-
splitNumber: options.splitNumber,
|
|
65467
|
-
descriptionName: options.descriptionName,
|
|
65468
|
-
series: group.series,
|
|
65469
|
-
}) ?? undefined);
|
|
65470
|
-
}
|
|
65471
|
-
function applyCustomAttributes(displaySet, attributes) {
|
|
65472
|
-
if (!attributes) {
|
|
65473
|
-
return;
|
|
65474
|
-
}
|
|
65475
|
-
for (const [key, value] of Object.entries(attributes)) {
|
|
65476
|
-
if (RESERVED_ATTRIBUTE_KEYS.has(key) || isUnsafeKey(key)) {
|
|
65477
|
-
continue;
|
|
65478
|
-
}
|
|
65479
|
-
if (isAssignable(displaySet, key)) {
|
|
65480
|
-
displaySet[key] = value;
|
|
65481
|
-
}
|
|
65482
|
-
}
|
|
65483
|
-
}
|
|
65484
|
-
function createDisplaySetFromGroup(group, options = {}) {
|
|
65485
|
-
const attributes = runCustomAttributes(group, options);
|
|
65486
|
-
const { instances } = group;
|
|
65487
|
-
const baseDisplaySetId = instances[0]?.SeriesInstanceUID ??
|
|
65488
|
-
`display-set-${instances[0]?.imageId ?? 'unknown'}`;
|
|
65489
|
-
const displaySetId = options.displaySetId ??
|
|
65490
|
-
(options.splitNumber
|
|
65491
|
-
? `${baseDisplaySetId}:${options.splitNumber}`
|
|
65492
|
-
: baseDisplaySetId);
|
|
65493
|
-
const first = instances[0];
|
|
65494
|
-
const { handler } = group.matchedRule;
|
|
65495
|
-
const underlyingImageIds = instances
|
|
65496
|
-
.map((i) => i.imageId)
|
|
65497
|
-
.filter(Boolean);
|
|
65498
|
-
let displaySet;
|
|
65499
|
-
if (handler === 'unsupported') {
|
|
65500
|
-
displaySet = new BaseDisplaySet({
|
|
65501
|
-
displaySetId,
|
|
65502
|
-
instances,
|
|
65503
|
-
imageIds: [],
|
|
65504
|
-
underlyingImageIds,
|
|
65505
|
-
isDisplayable: false,
|
|
65506
|
-
});
|
|
65507
|
-
}
|
|
65508
|
-
else if (handler !== undefined && handler !== 'image') {
|
|
65509
|
-
displaySet = new BaseDisplaySet({
|
|
65510
|
-
displaySetId,
|
|
65511
|
-
instances,
|
|
65512
|
-
imageIds: options.imageIds ?? underlyingImageIds,
|
|
65513
|
-
underlyingImageIds,
|
|
65514
|
-
});
|
|
65515
|
-
}
|
|
65516
|
-
else {
|
|
65517
|
-
displaySet = ImageStackDisplaySet.fromInstances(instances, {
|
|
65518
|
-
displaySetId,
|
|
65519
|
-
imageIds: options.imageIds,
|
|
65520
|
-
});
|
|
65521
|
-
}
|
|
65522
|
-
displaySet.splitKey = group.splitKey;
|
|
65523
|
-
displaySet.splitRuleId = group.matchedRule.id;
|
|
65524
|
-
displaySet.splitGroupId = group.matchedRule.groupId ?? group.matchedRule.id;
|
|
65525
|
-
if (handler !== undefined) {
|
|
65526
|
-
displaySet.handler = handler;
|
|
65527
|
-
}
|
|
65528
|
-
if (group.matchedRule.viewportTypes !== undefined) {
|
|
65529
|
-
displaySet.viewportTypes = [...group.matchedRule.viewportTypes];
|
|
65530
|
-
}
|
|
65531
|
-
displaySet.sopClassUids = [
|
|
65532
|
-
...new Set(instances.map((i) => i.SOPClassUID).filter(Boolean)),
|
|
65533
|
-
];
|
|
65534
|
-
if (options.splitNumber !== undefined) {
|
|
65535
|
-
displaySet.splitNumber = options.splitNumber;
|
|
65536
|
-
}
|
|
65537
|
-
displaySet.isMultiFrame ??= Number(first?.NumberOfFrames) > 1;
|
|
65538
|
-
applyCustomAttributes(displaySet, attributes);
|
|
65539
|
-
if ((handler === undefined || handler === 'image') &&
|
|
65540
|
-
typeof displaySet.isReconstructable !== 'boolean') {
|
|
65541
|
-
displaySet.isReconstructable =
|
|
65542
|
-
!displaySet.isClip && isReconstructableInstances(instances);
|
|
65543
|
-
}
|
|
65544
|
-
return displaySet;
|
|
65545
|
-
}
|
|
65546
63670
|
|
|
65547
|
-
|
|
65548
|
-
|
|
65549
|
-
|
|
65550
|
-
|
|
65551
|
-
|
|
65552
|
-
function isImageInstance(instance, context) {
|
|
65553
|
-
return isTrue(getContextValue('isImage', instance, context));
|
|
65554
|
-
}
|
|
65555
|
-
|
|
65556
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/isVideoInstance.js
|
|
65557
|
-
|
|
65558
|
-
|
|
65559
|
-
function isVideoInstance(instance, context) {
|
|
65560
|
-
return isTrue(getContextValue('isVideo', instance, context));
|
|
65561
|
-
}
|
|
65562
|
-
|
|
65563
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/isEcgInstance.js
|
|
65564
|
-
|
|
65565
|
-
|
|
65566
|
-
function isEcgInstance(instance, context) {
|
|
65567
|
-
return isTrue(getContextValue('isEcg', instance, context));
|
|
65568
|
-
}
|
|
65569
|
-
|
|
65570
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/isWsiInstance.js
|
|
65571
|
-
|
|
65572
|
-
|
|
65573
|
-
function isWsiInstance(instance, context) {
|
|
65574
|
-
return isTrue(getContextValue('isWsi', instance, context));
|
|
65575
|
-
}
|
|
65576
|
-
|
|
65577
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/types.js
|
|
63671
|
+
},
|
|
63672
|
+
10251() {
|
|
63673
|
+
"use strict";
|
|
65578
63674
|
const DISPLAY_SET_HANDLER_NAMES = (/* unused pure expression or super */ null && ([
|
|
65579
63675
|
'image',
|
|
65580
63676
|
'video',
|
|
@@ -65589,31 +63685,6 @@ const DISPLAY_SET_HANDLER_NAMES = (/* unused pure expression or super */ null &&
|
|
|
65589
63685
|
'chart',
|
|
65590
63686
|
'unsupported',
|
|
65591
63687
|
]));
|
|
65592
|
-
const DEFAULT_SPLIT_RULE_PRIORITY_LIMIT = 10000;
|
|
65593
|
-
|
|
65594
|
-
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/metadata/dist/esm/displayset/index.js
|
|
65595
|
-
|
|
65596
|
-
|
|
65597
|
-
|
|
65598
|
-
|
|
65599
|
-
|
|
65600
|
-
|
|
65601
|
-
|
|
65602
|
-
|
|
65603
|
-
|
|
65604
|
-
|
|
65605
|
-
|
|
65606
|
-
|
|
65607
|
-
|
|
65608
|
-
|
|
65609
|
-
|
|
65610
|
-
|
|
65611
|
-
|
|
65612
|
-
|
|
65613
|
-
|
|
65614
|
-
|
|
65615
|
-
|
|
65616
|
-
|
|
65617
63688
|
|
|
65618
63689
|
|
|
65619
63690
|
},
|
|
@@ -65680,6 +63751,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
65680
63751
|
zd: () => (/* reexport */ compileExpressionAt),
|
|
65681
63752
|
BX: () => (/* reexport */ safeFunctions_schema/* .conditionShape */.BX),
|
|
65682
63753
|
Ae: () => (/* reexport */ createSite),
|
|
63754
|
+
ol: () => (/* reexport */ safeFunctions_schema/* .deepFreeze */.ol),
|
|
65683
63755
|
au: () => (/* reexport */ safeFunctions_schema/* .didYouMean */.au),
|
|
65684
63756
|
Tn: () => (/* reexport */ safeFunctions_values/* .hasNoValue */.Tn),
|
|
65685
63757
|
$3: () => (/* reexport */ safeFunctions_schema/* .hasOwn */.$3),
|
|
@@ -67014,6 +65086,15 @@ function readOwn(object, key) {
|
|
|
67014
65086
|
? object[key]
|
|
67015
65087
|
: undefined;
|
|
67016
65088
|
}
|
|
65089
|
+
function deepFreeze(value) {
|
|
65090
|
+
if (value && typeof value === 'object' && !Object.isFrozen(value)) {
|
|
65091
|
+
Object.freeze(value);
|
|
65092
|
+
for (const child of Object.values(value)) {
|
|
65093
|
+
deepFreeze(child);
|
|
65094
|
+
}
|
|
65095
|
+
}
|
|
65096
|
+
return value;
|
|
65097
|
+
}
|
|
67017
65098
|
function isUnsafeKey(key) {
|
|
67018
65099
|
return key === '__proto__';
|
|
67019
65100
|
}
|
|
@@ -67071,7 +65152,6 @@ const LEAF_KINDS = new Set([
|
|
|
67071
65152
|
'true',
|
|
67072
65153
|
'scalar',
|
|
67073
65154
|
'literal',
|
|
67074
|
-
'priority',
|
|
67075
65155
|
'expression',
|
|
67076
65156
|
]);
|
|
67077
65157
|
function isLeafKind(kind) {
|
|
@@ -67093,10 +65173,6 @@ const LEAF_CHECKS = {
|
|
|
67093
65173
|
(typeof v === 'number' && Number.isFinite(v)),
|
|
67094
65174
|
],
|
|
67095
65175
|
literal: ['any value', () => true],
|
|
67096
|
-
priority: [
|
|
67097
|
-
'a finite number, or null',
|
|
67098
|
-
(v) => v === null || (typeof v === 'number' && Number.isFinite(v)),
|
|
67099
|
-
],
|
|
67100
65176
|
};
|
|
67101
65177
|
function checkLeaf(spec, value, site, label = 'value') {
|
|
67102
65178
|
const [expected, test] = LEAF_CHECKS[spec.kind];
|
|
@@ -67371,6 +65447,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
67371
65447
|
au: () => (didYouMean),
|
|
67372
65448
|
ez: () => (isUnsafeKey),
|
|
67373
65449
|
jU: () => (readOwn),
|
|
65450
|
+
ol: () => (deepFreeze),
|
|
67374
65451
|
w6: () => (RuleCompileError)
|
|
67375
65452
|
}, {
|
|
67376
65453
|
BX: conditionShape,
|
|
@@ -67831,7 +65908,7 @@ const moduleDefinitions = [
|
|
|
67831
65908
|
},
|
|
67832
65909
|
24671() {
|
|
67833
65910
|
"use strict";
|
|
67834
|
-
const version = '5.
|
|
65911
|
+
const version = '5.18.0';
|
|
67835
65912
|
|
|
67836
65913
|
|
|
67837
65914
|
},
|
|
@@ -67934,7 +66011,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
67934
66011
|
},
|
|
67935
66012
|
88253() {
|
|
67936
66013
|
"use strict";
|
|
67937
|
-
const version = '5.
|
|
66014
|
+
const version = '5.18.0';
|
|
67938
66015
|
|
|
67939
66016
|
|
|
67940
66017
|
},
|