@ohif/app 3.13.0-beta.35 → 3.13.0-beta.39
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/{147.bundle.9c245011849e09bd7904.js → 147.bundle.f71d384c49f50e23f795.js} +15 -40
- package/dist/{1608.bundle.417884758328a1fc04a9.js → 1608.bundle.c10d9aef452fe5a86d77.js} +2 -2
- package/dist/{1933.bundle.19f83b2c7881912dcc34.js → 1933.bundle.0aba0ce3d97d32bd3ca5.js} +2 -2
- package/dist/{2701.bundle.2cfa58ae04427d4c897d.js → 2701.bundle.28b3ca0e6ae5a13f78b3.js} +2 -2
- package/dist/{3138.bundle.4e151e0dbd74a8265f42.js → 3138.bundle.a377f868158dec8efdb0.js} +2 -2
- package/dist/{4202.bundle.9dc6af971a47981d2a5e.js → 4202.bundle.f11f02596e30a22d1105.js} +1 -1
- package/dist/{4287.bundle.d2d09ffd5cd8680fad8d.js → 4287.bundle.b7840e7b94cbbc102236.js} +3 -3
- package/dist/{4688.bundle.add6a6c6bb72fcd35ee3.js → 4688.bundle.324f320f177fe7f70db8.js} +130 -120
- package/dist/{4819.bundle.1ff04ae518bab5e59dc6.js → 4819.bundle.5aa5ed42843908dbb820.js} +4 -4
- package/dist/{5015.bundle.a35182426b6b4d2d1fe4.js → 5015.bundle.4f91f03ea8084a82657b.js} +2 -2
- package/dist/{5802.bundle.70d423c8b488cc56cc36.js → 5802.bundle.a3a398ddaac222cf08f7.js} +2 -2
- package/dist/{581.bundle.b70e5d2d0f3958df69f0.js → 581.bundle.f48ce2a0f0dae080154c.js} +7 -6
- package/dist/{6354.bundle.d8a592b03e9a5b7a66c2.js → 6354.bundle.929febcf6d326e582e00.js} +50 -45
- package/dist/{6386.bundle.c0618e49b65769ddf752.js → 6386.bundle.e75a2f70039dfe42f935.js} +11 -3
- package/dist/{7537.bundle.1a18959ceec98634bc48.js → 7537.bundle.b784154ebd4c85946642.js} +758 -679
- package/dist/{8305.bundle.7e577ab4f21ac44d355e.js → 8305.bundle.371dde3415de88db3f43.js} +2 -2
- package/dist/{8583.bundle.47394b6ef65ff3a4190c.js → 8583.bundle.f6c226c9fa6de90f2bcb.js} +2 -2
- package/dist/{6280.bundle.081861b7e685b28616c8.js → 9039.bundle.fd54c15934103ff3fd3b.js} +1470 -1259
- package/dist/{9195.bundle.a38804074672c87ad1ec.js → 9195.bundle.afd5483195e12e5cef8e.js} +8 -8
- package/dist/{9205.bundle.09c52845b43bd8513d50.js → 9205.bundle.7c4a29705386dcefd999.js} +1602 -1347
- package/dist/{933.bundle.ea9db108b8a4e3d51904.js → 9567.bundle.be350438bed4e656f278.js} +2690 -193
- package/dist/{9845.bundle.fe6930acb204e2fd8323.js → 9845.bundle.36b3563ae1dba65b6b9a.js} +2 -2
- package/dist/{9862.bundle.47e7574a486c30ab0dfd.js → 9862.bundle.f59f3a574a92024c8823.js} +1 -1
- package/dist/{app.bundle.3e902f3aba87f5fdaca0.js → app.bundle.6c3daf11c7fbd7e48175.js} +970 -811
- package/dist/app.bundle.css +1 -1
- package/dist/{compute.bundle.6016de6e5f7c25749422.js → compute.bundle.47da6b38c64751bdb9c4.js} +1 -1
- package/dist/{histogram-worker.bundle.5b679ce4142c803c80a4.js → histogram-worker.bundle.a2a50c4674d99c619ca7.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/{interpolation.bundle.072a28b303f2dbafe05c.js → interpolation.bundle.53073c15cca1c5a41ae4.js} +1 -1
- package/dist/{polySeg.bundle.cdcc2c3d11009ccf112c.js → polySeg.bundle.8954fb59f99daeb3f0b0.js} +3 -3
- package/dist/sw.js +1 -1
- package/package.json +21 -21
- /package/dist/{1459.bundle.062605b72ad894597c40.js → 1459.bundle.4aef0d934c3a12aa66bb.js} +0 -0
- /package/dist/{2018.bundle.d8cf3001bae55516d13a.js → 2018.bundle.896e322e7c39599383f7.js} +0 -0
- /package/dist/{2075.bundle.16215ba94d714a1c905f.js → 2075.bundle.0e69a126a39539ff8e9a.js} +0 -0
- /package/dist/{213.bundle.5527b63c734814bca27c.js → 213.bundle.9a4de523c0842d7bd7fd.js} +0 -0
- /package/dist/{2424.bundle.7cf905346cf856a74d18.js → 2424.bundle.6a9ca8e7e84f5528c8d1.js} +0 -0
- /package/dist/{3461.bundle.19921563b1d9ee7c4599.js → 3461.bundle.b6304f280d7dc0ade73a.js} +0 -0
- /package/dist/{4507.bundle.816349fd19d1f7feb8cc.js → 4507.bundle.67c73fab897aa7040fce.js} +0 -0
- /package/dist/{5028.bundle.12210efc962029543cf8.js → 5028.bundle.71b240621417df1a6fab.js} +0 -0
- /package/dist/{5457.bundle.ce2a509fad38c7b5d23e.js → 5457.bundle.109f104b4520e6374fa6.js} +0 -0
- /package/dist/{5485.bundle.18ac74bcc1f62f4ff48a.js → 5485.bundle.a88fd5be3f5aa20dc643.js} +0 -0
- /package/dist/{6027.bundle.11593983ae8a72b4b10d.js → 6027.bundle.555553c951bba02afa54.js} +0 -0
- /package/dist/{7431.bundle.84b3d88ef94b97c84298.js → 7431.bundle.e5a9b628c993b78ff7db.js} +0 -0
- /package/dist/{7639.bundle.47fa2f67acb39082efe9.js → 7639.bundle.0f0b2419e43c7dc3b88a.js} +0 -0
- /package/dist/{8499.bundle.ef8d548ca8261c78ed2b.js → 8499.bundle.c179a028eae7170b397d.js} +0 -0
- /package/dist/{85.bundle.47697c7697f28e3d1865.js → 85.bundle.80b16edc06976de80ae6.js} +0 -0
- /package/dist/{8558.bundle.b7124f251785e778c3c1.js → 8558.bundle.f08683ca26d63fb8c0ef.js} +0 -0
- /package/dist/{9927.bundle.861ce96aab6eed8e6ff3.js → 9927.bundle.6966a86ab930197c8295.js} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"
|
|
2
|
-
(globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[933],{
|
|
1
|
+
(globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[9567],{
|
|
3
2
|
|
|
4
3
|
/***/ 75183
|
|
5
4
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
6
5
|
|
|
6
|
+
"use strict";
|
|
7
7
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8
8
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
9
9
|
/* harmony export */ });
|
|
@@ -27,6 +27,7 @@ var ChangeTypes;
|
|
|
27
27
|
/***/ 74690
|
|
28
28
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
29
29
|
|
|
30
|
+
"use strict";
|
|
30
31
|
|
|
31
32
|
// EXPORTS
|
|
32
33
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -163,6 +164,7 @@ function keyUp(evt) {
|
|
|
163
164
|
/***/ 40100
|
|
164
165
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
165
166
|
|
|
167
|
+
"use strict";
|
|
166
168
|
|
|
167
169
|
// EXPORTS
|
|
168
170
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -527,6 +529,7 @@ function mouseWheel(evt) {
|
|
|
527
529
|
/***/ 96198
|
|
528
530
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
529
531
|
|
|
532
|
+
"use strict";
|
|
530
533
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
531
534
|
/* harmony export */ A: () => (/* binding */ customCallbackHandler)
|
|
532
535
|
/* harmony export */ });
|
|
@@ -570,6 +573,7 @@ function customCallbackHandler(handlerType, customFunction, evt) {
|
|
|
570
573
|
/***/ 70333
|
|
571
574
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
572
575
|
|
|
576
|
+
"use strict";
|
|
573
577
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
574
578
|
/* harmony export */ A: () => (/* binding */ getToolsWithModesForMouseEvent)
|
|
575
579
|
/* harmony export */ });
|
|
@@ -604,6 +608,7 @@ function getToolsWithModesForMouseEvent(evt, modesFilter, evtButton) {
|
|
|
604
608
|
/***/ 84971
|
|
605
609
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
606
610
|
|
|
611
|
+
"use strict";
|
|
607
612
|
|
|
608
613
|
// EXPORTS
|
|
609
614
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -838,6 +843,7 @@ const touchPress = customCallbackHandler/* default */.A.bind(null, 'Touch', 'tou
|
|
|
838
843
|
/***/ 39595
|
|
839
844
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
840
845
|
|
|
846
|
+
"use strict";
|
|
841
847
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
842
848
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
843
849
|
/* harmony export */ });
|
|
@@ -862,6 +868,7 @@ function disable(element) {
|
|
|
862
868
|
/***/ 40776
|
|
863
869
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
864
870
|
|
|
871
|
+
"use strict";
|
|
865
872
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
866
873
|
/* harmony export */ Ay: () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
867
874
|
/* harmony export */ Ud: () => (/* binding */ resetModifierKey),
|
|
@@ -940,6 +947,7 @@ function resetModifierKey() {
|
|
|
940
947
|
/***/ 99019
|
|
941
948
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
942
949
|
|
|
950
|
+
"use strict";
|
|
943
951
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
944
952
|
/* harmony export */ A: () => (/* binding */ getMouseEventPoints)
|
|
945
953
|
/* harmony export */ });
|
|
@@ -982,6 +990,7 @@ function _clientToPoint(evt) {
|
|
|
982
990
|
/***/ 91099
|
|
983
991
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
984
992
|
|
|
993
|
+
"use strict";
|
|
985
994
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
986
995
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
987
996
|
/* harmony export */ });
|
|
@@ -1027,6 +1036,7 @@ function mouseDoubleClickListener(evt) {
|
|
|
1027
1036
|
/***/ 68014
|
|
1028
1037
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1029
1038
|
|
|
1039
|
+
"use strict";
|
|
1030
1040
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1031
1041
|
/* harmony export */ Ay: () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
1032
1042
|
/* harmony export */ DF: () => (/* binding */ mouseDoubleClickIgnoreListener),
|
|
@@ -1308,6 +1318,7 @@ function mouseDoubleClickIgnoreListener(evt) {
|
|
|
1308
1318
|
/***/ 41343
|
|
1309
1319
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1310
1320
|
|
|
1321
|
+
"use strict";
|
|
1311
1322
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1312
1323
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1313
1324
|
/* harmony export */ });
|
|
@@ -1349,6 +1360,7 @@ function mouseMoveListener(evt) {
|
|
|
1349
1360
|
/***/ 41666
|
|
1350
1361
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1351
1362
|
|
|
1363
|
+
"use strict";
|
|
1352
1364
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1353
1365
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1354
1366
|
/* harmony export */ });
|
|
@@ -1406,6 +1418,7 @@ function enable(element) {
|
|
|
1406
1418
|
/***/ 82603
|
|
1407
1419
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1408
1420
|
|
|
1421
|
+
"use strict";
|
|
1409
1422
|
|
|
1410
1423
|
// EXPORTS
|
|
1411
1424
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -1750,6 +1763,7 @@ function _updateTouchEventsLastPoints(element, lastPoints) {
|
|
|
1750
1763
|
/***/ 17806
|
|
1751
1764
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1752
1765
|
|
|
1766
|
+
"use strict";
|
|
1753
1767
|
|
|
1754
1768
|
// EXPORTS
|
|
1755
1769
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -1854,6 +1868,7 @@ function wheelListener(evt) {
|
|
|
1854
1868
|
/***/ 6802
|
|
1855
1869
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1856
1870
|
|
|
1871
|
+
"use strict";
|
|
1857
1872
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1858
1873
|
/* harmony export */ O8: () => (/* reexport safe */ _annotation_annotationState__WEBPACK_IMPORTED_MODULE_3__.removeAnnotation),
|
|
1859
1874
|
/* harmony export */ Rh: () => (/* reexport safe */ _annotation_annotationState__WEBPACK_IMPORTED_MODULE_3__.getAnnotations),
|
|
@@ -1878,6 +1893,7 @@ function wheelListener(evt) {
|
|
|
1878
1893
|
/***/ 6273
|
|
1879
1894
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1880
1895
|
|
|
1896
|
+
"use strict";
|
|
1881
1897
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1882
1898
|
/* harmony export */ p: () => (/* binding */ convertStackToVolumeLabelmap)
|
|
1883
1899
|
/* harmony export */ });
|
|
@@ -1897,6 +1913,7 @@ async function convertStackToVolumeLabelmap(args) {
|
|
|
1897
1913
|
/***/ 98149
|
|
1898
1914
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1899
1915
|
|
|
1916
|
+
"use strict";
|
|
1900
1917
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1901
1918
|
/* harmony export */ X: () => (/* binding */ updateStackSegmentationState)
|
|
1902
1919
|
/* harmony export */ });
|
|
@@ -1943,6 +1960,7 @@ async function updateStackSegmentationState({ segmentationId, viewportId, imageI
|
|
|
1943
1960
|
/***/ 25972
|
|
1944
1961
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1945
1962
|
|
|
1963
|
+
"use strict";
|
|
1946
1964
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1947
1965
|
/* harmony export */ A: () => (/* binding */ filterMoveableAnnotationTools)
|
|
1948
1966
|
/* harmony export */ });
|
|
@@ -1973,6 +1991,7 @@ function filterMoveableAnnotationTools(element, ToolAndAnnotations, canvasCoords
|
|
|
1973
1991
|
/***/ 57725
|
|
1974
1992
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1975
1993
|
|
|
1994
|
+
"use strict";
|
|
1976
1995
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1977
1996
|
/* harmony export */ A: () => (/* binding */ filterToolsWithAnnotationsForElement)
|
|
1978
1997
|
/* harmony export */ });
|
|
@@ -2006,6 +2025,7 @@ function filterToolsWithAnnotationsForElement(element, tools) {
|
|
|
2006
2025
|
/***/ 35486
|
|
2007
2026
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2008
2027
|
|
|
2028
|
+
"use strict";
|
|
2009
2029
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2010
2030
|
/* harmony export */ A: () => (/* binding */ filterToolsWithMoveableHandles)
|
|
2011
2031
|
/* harmony export */ });
|
|
@@ -2037,6 +2057,7 @@ function filterToolsWithMoveableHandles(element, ToolAndAnnotations, canvasCoord
|
|
|
2037
2057
|
/***/ 16175
|
|
2038
2058
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2039
2059
|
|
|
2060
|
+
"use strict";
|
|
2040
2061
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2041
2062
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
2042
2063
|
/* harmony export */ });
|
|
@@ -2129,6 +2150,7 @@ class CircleSculptCursor {
|
|
|
2129
2150
|
/***/ 10639
|
|
2130
2151
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2131
2152
|
|
|
2153
|
+
"use strict";
|
|
2132
2154
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2133
2155
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
2134
2156
|
/* harmony export */ });
|
|
@@ -2429,6 +2451,7 @@ GrowCutBaseTool.toolName = 'GrowCutBaseTool';
|
|
|
2429
2451
|
/***/ 13271
|
|
2430
2452
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2431
2453
|
|
|
2454
|
+
"use strict";
|
|
2432
2455
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2433
2456
|
/* harmony export */ X: () => (/* binding */ distancePointToContour)
|
|
2434
2457
|
/* harmony export */ });
|
|
@@ -2458,6 +2481,7 @@ const distancePointToContour = (viewport, annotation, coords) => {
|
|
|
2458
2481
|
/***/ 47347
|
|
2459
2482
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2460
2483
|
|
|
2484
|
+
"use strict";
|
|
2461
2485
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2462
2486
|
/* harmony export */ M: () => (/* binding */ eraseInsideRectangle)
|
|
2463
2487
|
/* harmony export */ });
|
|
@@ -2483,6 +2507,7 @@ function eraseOutsideRectangle(enabledElement, operationData) {
|
|
|
2483
2507
|
/***/ 39848
|
|
2484
2508
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2485
2509
|
|
|
2510
|
+
"use strict";
|
|
2486
2511
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2487
2512
|
/* harmony export */ A: () => (/* binding */ getToolsWithModesForElement)
|
|
2488
2513
|
/* harmony export */ });
|
|
@@ -2519,6 +2544,7 @@ function getToolsWithModesForElement(element, modesFilter) {
|
|
|
2519
2544
|
/***/ 22658
|
|
2520
2545
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2521
2546
|
|
|
2547
|
+
"use strict";
|
|
2522
2548
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2523
2549
|
/* harmony export */ j: () => (/* binding */ getVOIMultipliers)
|
|
2524
2550
|
/* harmony export */ });
|
|
@@ -2550,6 +2576,7 @@ function getVOIMultipliers(viewport, volumeId, options) {
|
|
|
2550
2576
|
/***/ 38776
|
|
2551
2577
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2552
2578
|
|
|
2579
|
+
"use strict";
|
|
2553
2580
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2554
2581
|
/* harmony export */ j: () => (/* binding */ LivewirePath)
|
|
2555
2582
|
/* harmony export */ });
|
|
@@ -2631,6 +2658,7 @@ class LivewirePath {
|
|
|
2631
2658
|
/***/ 78044
|
|
2632
2659
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2633
2660
|
|
|
2661
|
+
"use strict";
|
|
2634
2662
|
|
|
2635
2663
|
// EXPORTS
|
|
2636
2664
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -3032,6 +3060,7 @@ class LivewireScissors {
|
|
|
3032
3060
|
/***/ 11256
|
|
3033
3061
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3034
3062
|
|
|
3063
|
+
"use strict";
|
|
3035
3064
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3036
3065
|
/* harmony export */ A: () => (/* binding */ getCanvasCircleCorners)
|
|
3037
3066
|
/* harmony export */ });
|
|
@@ -3051,6 +3080,7 @@ function getCanvasCircleCorners(circleCanvasPoints) {
|
|
|
3051
3080
|
/***/ 76090
|
|
3052
3081
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3053
3082
|
|
|
3083
|
+
"use strict";
|
|
3054
3084
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3055
3085
|
/* harmony export */ A: () => (/* binding */ getCanvasCircleRadius)
|
|
3056
3086
|
/* harmony export */ });
|
|
@@ -3067,6 +3097,7 @@ function getCanvasCircleRadius(circleCanvasPoints) {
|
|
|
3067
3097
|
/***/ 2222
|
|
3068
3098
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3069
3099
|
|
|
3100
|
+
"use strict";
|
|
3070
3101
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3071
3102
|
/* harmony export */ A: () => (/* binding */ getCanvasEllipseCorners)
|
|
3072
3103
|
/* harmony export */ });
|
|
@@ -3083,6 +3114,7 @@ function getCanvasEllipseCorners(ellipseCanvasPoints) {
|
|
|
3083
3114
|
/***/ 17787
|
|
3084
3115
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3085
3116
|
|
|
3117
|
+
"use strict";
|
|
3086
3118
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3087
3119
|
/* harmony export */ IM: () => (/* binding */ clipInterval),
|
|
3088
3120
|
/* harmony export */ Mo: () => (/* binding */ calculateInnerFanPercentage),
|
|
@@ -3197,6 +3229,7 @@ function calculateInnerFanPercentage(center, outerFanPairs, innerFanPairs) {
|
|
|
3197
3229
|
/***/ 82983
|
|
3198
3230
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3199
3231
|
|
|
3232
|
+
"use strict";
|
|
3200
3233
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3201
3234
|
/* harmony export */ f: () => (/* binding */ midPoint2)
|
|
3202
3235
|
/* harmony export */ });
|
|
@@ -3222,6 +3255,7 @@ const midPoint2 = midPoint;
|
|
|
3222
3255
|
/***/ 5767
|
|
3223
3256
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3224
3257
|
|
|
3258
|
+
"use strict";
|
|
3225
3259
|
// ESM COMPAT FLAG
|
|
3226
3260
|
__webpack_require__.r(__webpack_exports__);
|
|
3227
3261
|
|
|
@@ -3253,6 +3287,7 @@ var mirror = __webpack_require__(83483);
|
|
|
3253
3287
|
/***/ 98122
|
|
3254
3288
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3255
3289
|
|
|
3290
|
+
"use strict";
|
|
3256
3291
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3257
3292
|
/* harmony export */ A: () => (/* binding */ getAABB)
|
|
3258
3293
|
/* harmony export */ });
|
|
@@ -3303,6 +3338,7 @@ function getAABB(polyline, options) {
|
|
|
3303
3338
|
/***/ 50932
|
|
3304
3339
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3305
3340
|
|
|
3341
|
+
"use strict";
|
|
3306
3342
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3307
3343
|
/* harmony export */ A: () => (/* binding */ getLineSegmentIntersectionsCoordinates)
|
|
3308
3344
|
/* harmony export */ });
|
|
@@ -3328,6 +3364,7 @@ function getLineSegmentIntersectionsCoordinates(points, p1, q1, closed = true) {
|
|
|
3328
3364
|
/***/ 8361
|
|
3329
3365
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3330
3366
|
|
|
3367
|
+
"use strict";
|
|
3331
3368
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3332
3369
|
/* harmony export */ i: () => (/* binding */ isPointInsidePolyline3D)
|
|
3333
3370
|
/* harmony export */ });
|
|
@@ -3365,6 +3402,7 @@ function isPointInsidePolyline3D(point, polyline, options = {}) {
|
|
|
3365
3402
|
/***/ 80514
|
|
3366
3403
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3367
3404
|
|
|
3405
|
+
"use strict";
|
|
3368
3406
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3369
3407
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
3370
3408
|
/* harmony export */ });
|
|
@@ -3408,6 +3446,7 @@ const pointCanProjectOnLine = (p, p1, p2, proximity) => {
|
|
|
3408
3446
|
/***/ 28502
|
|
3409
3447
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3410
3448
|
|
|
3449
|
+
"use strict";
|
|
3411
3450
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3412
3451
|
/* harmony export */ p: () => (/* binding */ projectTo2D)
|
|
3413
3452
|
/* harmony export */ });
|
|
@@ -3444,6 +3483,7 @@ function projectTo2D(polyline) {
|
|
|
3444
3483
|
/***/ 61587
|
|
3445
3484
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3446
3485
|
|
|
3486
|
+
"use strict";
|
|
3447
3487
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3448
3488
|
/* harmony export */ A: () => (/* binding */ smoothAnnotation)
|
|
3449
3489
|
/* harmony export */ });
|
|
@@ -3512,6 +3552,7 @@ function smoothAnnotation(annotation, options) {
|
|
|
3512
3552
|
/***/ 10564
|
|
3513
3553
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3514
3554
|
|
|
3555
|
+
"use strict";
|
|
3515
3556
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3516
3557
|
/* harmony export */ BX: () => (/* binding */ DEFAULT_NEGATIVE_SEED_MARGIN),
|
|
3517
3558
|
/* harmony export */ Sp: () => (/* binding */ DEFAULT_NEIGHBORHOOD_RADIUS),
|
|
@@ -3537,6 +3578,7 @@ const MAX_NEGATIVE_SEED_ATTEMPTS_MULTIPLIER = 50;
|
|
|
3537
3578
|
/***/ 94762
|
|
3538
3579
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3539
3580
|
|
|
3581
|
+
"use strict";
|
|
3540
3582
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3541
3583
|
/* harmony export */ Lr: () => (/* binding */ priority),
|
|
3542
3584
|
/* harmony export */ Pg: () => (/* binding */ clearFromImageIds),
|
|
@@ -3631,6 +3673,7 @@ const clearFromImageIds = (stack) => {
|
|
|
3631
3673
|
/***/ 30045
|
|
3632
3674
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3633
3675
|
|
|
3676
|
+
"use strict";
|
|
3634
3677
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3635
3678
|
/* harmony export */ P: () => (/* binding */ addToolState),
|
|
3636
3679
|
/* harmony export */ k: () => (/* binding */ getToolState)
|
|
@@ -3656,6 +3699,7 @@ function getToolState(element) {
|
|
|
3656
3699
|
/***/ 33517
|
|
3657
3700
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3658
3701
|
|
|
3702
|
+
"use strict";
|
|
3659
3703
|
|
|
3660
3704
|
// EXPORTS
|
|
3661
3705
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -3868,6 +3912,7 @@ class ColorbarCanvas {
|
|
|
3868
3912
|
/***/ 62184
|
|
3869
3913
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3870
3914
|
|
|
3915
|
+
"use strict";
|
|
3871
3916
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3872
3917
|
/* harmony export */ f: () => (/* binding */ ColorbarTicks)
|
|
3873
3918
|
/* harmony export */ });
|
|
@@ -4174,6 +4219,7 @@ class ColorbarTicks {
|
|
|
4174
4219
|
/***/ 57227
|
|
4175
4220
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4176
4221
|
|
|
4222
|
+
"use strict";
|
|
4177
4223
|
|
|
4178
4224
|
// EXPORTS
|
|
4179
4225
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -4219,6 +4265,7 @@ const areColorbarSizesEqual = (a, b) => {
|
|
|
4219
4265
|
/***/ 79457
|
|
4220
4266
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4221
4267
|
|
|
4268
|
+
"use strict";
|
|
4222
4269
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4223
4270
|
/* harmony export */ A: () => (/* binding */ isRangeTextPositionValid)
|
|
4224
4271
|
/* harmony export */ });
|
|
@@ -4237,158 +4284,2670 @@ function isRangeTextPositionValid(colorbarWidth, colorbarHeight, rangeTextPositi
|
|
|
4237
4284
|
|
|
4238
4285
|
/***/ },
|
|
4239
4286
|
|
|
4240
|
-
/***/
|
|
4287
|
+
/***/ 88380
|
|
4241
4288
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4242
4289
|
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4290
|
+
"use strict";
|
|
4291
|
+
|
|
4292
|
+
// EXPORTS
|
|
4293
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
4294
|
+
LINE_INTERSECTION_TOLERANCE: () => (/* reexport */ LINE_INTERSECTION_TOLERANCE),
|
|
4295
|
+
NUM_CLIPPING_PLANES: () => (/* reexport */ NUM_CLIPPING_PLANES),
|
|
4296
|
+
PLANEINDEX: () => (/* reexport */ PLANEINDEX),
|
|
4297
|
+
POINT_PROXIMITY_THRESHOLD_PIXELS: () => (/* reexport */ POINT_PROXIMITY_THRESHOLD_PIXELS),
|
|
4298
|
+
SPHEREINDEX: () => (/* reexport */ SPHEREINDEX),
|
|
4299
|
+
computePlanePlaneIntersection: () => (/* reexport */ computePlanePlaneIntersection),
|
|
4300
|
+
copyClippingPlanes: () => (/* reexport */ copyClippingPlanes),
|
|
4301
|
+
extractVolumeDirectionVectors: () => (/* reexport */ extractVolumeDirectionVectors),
|
|
4302
|
+
findLineBoundsIntersection: () => (/* reexport */ findLineBoundsIntersection),
|
|
4303
|
+
getColorKeyForPlaneIndex: () => (/* reexport */ getColorKeyForPlaneIndex),
|
|
4304
|
+
getOrientationFromNormal: () => (/* reexport */ getOrientationFromNormal),
|
|
4305
|
+
parseCornerKey: () => (/* reexport */ parseCornerKey)
|
|
4306
|
+
});
|
|
4307
|
+
|
|
4308
|
+
// UNUSED EXPORTS: LINE_EXTENSION_DISTANCE, MIN_LINE_LENGTH_PIXELS, ORIENTATION_TOLERANCE, PARALLEL_PLANE_TOLERANCE
|
|
4309
|
+
|
|
4310
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/volumeCropping/constants.js
|
|
4311
|
+
const PLANEINDEX = {
|
|
4312
|
+
XMIN: 0,
|
|
4313
|
+
XMAX: 1,
|
|
4314
|
+
YMIN: 2,
|
|
4315
|
+
YMAX: 3,
|
|
4316
|
+
ZMIN: 4,
|
|
4317
|
+
ZMAX: 5,
|
|
4318
|
+
};
|
|
4319
|
+
const SPHEREINDEX = {
|
|
4320
|
+
XMIN: 0,
|
|
4321
|
+
XMAX: 1,
|
|
4322
|
+
YMIN: 2,
|
|
4323
|
+
YMAX: 3,
|
|
4324
|
+
ZMIN: 4,
|
|
4325
|
+
ZMAX: 5,
|
|
4326
|
+
XMIN_YMIN_ZMIN: 6,
|
|
4327
|
+
XMIN_YMIN_ZMAX: 7,
|
|
4328
|
+
XMIN_YMAX_ZMIN: 8,
|
|
4329
|
+
XMIN_YMAX_ZMAX: 9,
|
|
4330
|
+
XMAX_YMIN_ZMIN: 10,
|
|
4331
|
+
XMAX_YMIN_ZMAX: 11,
|
|
4332
|
+
XMAX_YMAX_ZMIN: 12,
|
|
4333
|
+
XMAX_YMAX_ZMAX: 13,
|
|
4334
|
+
};
|
|
4335
|
+
const NUM_CLIPPING_PLANES = 6;
|
|
4336
|
+
const ORIENTATION_TOLERANCE = 1e-2;
|
|
4337
|
+
const PARALLEL_PLANE_TOLERANCE = 1e-10;
|
|
4338
|
+
const LINE_INTERSECTION_TOLERANCE = 1e-8;
|
|
4339
|
+
const LINE_EXTENSION_DISTANCE = 100000;
|
|
4340
|
+
const MIN_LINE_LENGTH_PIXELS = 1;
|
|
4341
|
+
const POINT_PROXIMITY_THRESHOLD_PIXELS = 6;
|
|
4342
|
+
|
|
4343
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/volumeCropping/types.js
|
|
4344
|
+
var types = __webpack_require__(22716);
|
|
4345
|
+
// EXTERNAL MODULE: ../../../node_modules/gl-matrix/esm/index.js + 1 modules
|
|
4346
|
+
var esm = __webpack_require__(3823);
|
|
4347
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/volumeCropping/extractVolumeDirectionVectors.js
|
|
4348
|
+
|
|
4349
|
+
function extractVolumeDirectionVectors(imageData) {
|
|
4350
|
+
const direction = imageData.getDirection();
|
|
4351
|
+
return {
|
|
4352
|
+
xDir: esm/* vec3.normalize */.eR.normalize([0, 0, 0], direction.slice(0, 3)),
|
|
4353
|
+
yDir: esm/* vec3.normalize */.eR.normalize([0, 0, 0], direction.slice(3, 6)),
|
|
4354
|
+
zDir: esm/* vec3.normalize */.eR.normalize([0, 0, 0], direction.slice(6, 9)),
|
|
4355
|
+
};
|
|
4356
|
+
}
|
|
4357
|
+
|
|
4358
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/volumeCropping/parseCornerKey.js
|
|
4359
|
+
function parseCornerKey(uid) {
|
|
4360
|
+
const cornerKey = uid.replace('corner_', '');
|
|
4361
|
+
return {
|
|
4362
|
+
isXMin: cornerKey.includes('XMIN'),
|
|
4363
|
+
isXMax: cornerKey.includes('XMAX'),
|
|
4364
|
+
isYMin: cornerKey.includes('YMIN'),
|
|
4365
|
+
isYMax: cornerKey.includes('YMAX'),
|
|
4366
|
+
isZMin: cornerKey.includes('ZMIN'),
|
|
4367
|
+
isZMax: cornerKey.includes('ZMAX'),
|
|
4368
|
+
};
|
|
4369
|
+
}
|
|
4370
|
+
|
|
4371
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/volumeCropping/copyClippingPlanes.js
|
|
4372
|
+
function copyClippingPlanes(planes) {
|
|
4373
|
+
return planes.map((plane) => ({
|
|
4374
|
+
origin: [...plane.origin],
|
|
4375
|
+
normal: [...plane.normal],
|
|
4376
|
+
}));
|
|
4377
|
+
}
|
|
4378
|
+
|
|
4379
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/volumeCropping/getColorKeyForPlaneIndex.js
|
|
4380
|
+
|
|
4381
|
+
function getColorKeyForPlaneIndex(planeIndex) {
|
|
4382
|
+
if (planeIndex === PLANEINDEX.XMIN || planeIndex === PLANEINDEX.XMAX) {
|
|
4383
|
+
return 'SAGITTAL';
|
|
4271
4384
|
}
|
|
4272
|
-
|
|
4273
|
-
return
|
|
4385
|
+
else if (planeIndex === PLANEINDEX.YMIN || planeIndex === PLANEINDEX.YMAX) {
|
|
4386
|
+
return 'CORONAL';
|
|
4274
4387
|
}
|
|
4275
|
-
|
|
4276
|
-
return
|
|
4388
|
+
else if (planeIndex === PLANEINDEX.ZMIN || planeIndex === PLANEINDEX.ZMAX) {
|
|
4389
|
+
return 'AXIAL';
|
|
4277
4390
|
}
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4391
|
+
return null;
|
|
4392
|
+
}
|
|
4393
|
+
|
|
4394
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 1 modules
|
|
4395
|
+
var dist_esm = __webpack_require__(15327);
|
|
4396
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/volumeCropping/getOrientationFromNormal.js
|
|
4397
|
+
|
|
4398
|
+
|
|
4399
|
+
|
|
4400
|
+
function getOrientationFromNormal(normal) {
|
|
4401
|
+
if (!normal) {
|
|
4402
|
+
return null;
|
|
4403
|
+
}
|
|
4404
|
+
const canonical = {
|
|
4405
|
+
AXIAL: [0, 0, 1],
|
|
4406
|
+
CORONAL: [0, 1, 0],
|
|
4407
|
+
SAGITTAL: [1, 0, 0],
|
|
4408
|
+
};
|
|
4409
|
+
for (const [key, value] of Object.entries(canonical)) {
|
|
4410
|
+
if (dist_esm.utilities.isEqualAbs(1, esm/* vec3.dot */.eR.dot(value, normal), ORIENTATION_TOLERANCE)) {
|
|
4411
|
+
return key;
|
|
4286
4412
|
}
|
|
4287
|
-
container.appendChild(rootElement);
|
|
4288
|
-
resizeObserver.observe(container);
|
|
4289
4413
|
}
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4414
|
+
return null;
|
|
4415
|
+
}
|
|
4416
|
+
|
|
4417
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/Math.js
|
|
4418
|
+
var Core_Math = __webpack_require__(91352);
|
|
4419
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/volumeCropping/computePlanePlaneIntersection.js
|
|
4420
|
+
|
|
4421
|
+
|
|
4422
|
+
|
|
4423
|
+
function computePlanePlaneIntersection(clippingPlane, viewPlaneNormal, viewPlanePoint) {
|
|
4424
|
+
const n1 = clippingPlane.normal;
|
|
4425
|
+
const p1 = clippingPlane.origin;
|
|
4426
|
+
const n2 = viewPlaneNormal;
|
|
4427
|
+
const p2 = viewPlanePoint;
|
|
4428
|
+
const dir = esm/* vec3.create */.eR.create();
|
|
4429
|
+
esm/* vec3.cross */.eR.cross(dir, n1, n2);
|
|
4430
|
+
const dirLenSq = esm/* vec3.squaredLength */.eR.squaredLength(dir);
|
|
4431
|
+
if (dirLenSq < PARALLEL_PLANE_TOLERANCE) {
|
|
4432
|
+
return null;
|
|
4295
4433
|
}
|
|
4296
|
-
|
|
4297
|
-
|
|
4434
|
+
const d1 = Core_Math/* default.dot */.Ay.dot(n1, p1);
|
|
4435
|
+
const d2 = Core_Math/* default.dot */.Ay.dot(n2, p2);
|
|
4436
|
+
const term1 = esm/* vec3.create */.eR.create();
|
|
4437
|
+
const term2 = esm/* vec3.create */.eR.create();
|
|
4438
|
+
esm/* vec3.cross */.eR.cross(term1, n2, dir);
|
|
4439
|
+
esm/* vec3.scale */.eR.scale(term1, term1, d1);
|
|
4440
|
+
esm/* vec3.cross */.eR.cross(term2, dir, n1);
|
|
4441
|
+
esm/* vec3.scale */.eR.scale(term2, term2, d2);
|
|
4442
|
+
const point = esm/* vec3.create */.eR.create();
|
|
4443
|
+
esm/* vec3.add */.eR.add(point, term1, term2);
|
|
4444
|
+
esm/* vec3.scale */.eR.scale(point, point, 1 / dirLenSq);
|
|
4445
|
+
if (!Number.isFinite(point[0]) ||
|
|
4446
|
+
!Number.isFinite(point[1]) ||
|
|
4447
|
+
!Number.isFinite(point[2])) {
|
|
4448
|
+
return null;
|
|
4298
4449
|
}
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4450
|
+
const direction = esm/* vec3.create */.eR.create();
|
|
4451
|
+
esm/* vec3.scale */.eR.scale(direction, dir, 1 / Math.sqrt(dirLenSq));
|
|
4452
|
+
return {
|
|
4453
|
+
direction: direction,
|
|
4454
|
+
point: point,
|
|
4455
|
+
};
|
|
4456
|
+
}
|
|
4457
|
+
|
|
4458
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/vec2/liangBarksyClip.js
|
|
4459
|
+
var liangBarksyClip = __webpack_require__(35381);
|
|
4460
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/volumeCropping/findLineBoundsIntersection.js
|
|
4461
|
+
|
|
4462
|
+
|
|
4463
|
+
|
|
4464
|
+
function findLineBoundsIntersection(linePoint, lineDirection, viewport) {
|
|
4465
|
+
const lineLength = LINE_EXTENSION_DISTANCE;
|
|
4466
|
+
const lineStart = esm/* vec3.scaleAndAdd */.eR.scaleAndAdd([0, 0, 0], linePoint, lineDirection, -lineLength);
|
|
4467
|
+
const lineEnd = esm/* vec3.scaleAndAdd */.eR.scaleAndAdd([0, 0, 0], linePoint, lineDirection, lineLength);
|
|
4468
|
+
const canvasStart = viewport.worldToCanvas(lineStart);
|
|
4469
|
+
const canvasEnd = viewport.worldToCanvas(lineEnd);
|
|
4470
|
+
const { clientWidth, clientHeight } = viewport.canvas;
|
|
4471
|
+
const canvasBox = [0, 0, clientWidth, clientHeight];
|
|
4472
|
+
const clippedStart = esm/* vec2.clone */.Zc.clone(canvasStart);
|
|
4473
|
+
const clippedEnd = esm/* vec2.clone */.Zc.clone(canvasEnd);
|
|
4474
|
+
const startValid = !isNaN(clippedStart[0]) && !isNaN(clippedStart[1]);
|
|
4475
|
+
const endValid = !isNaN(clippedEnd[0]) && !isNaN(clippedEnd[1]);
|
|
4476
|
+
if (!startValid || !endValid) {
|
|
4477
|
+
return null;
|
|
4308
4478
|
}
|
|
4309
|
-
|
|
4479
|
+
const clipResult = (0,liangBarksyClip/* default */.A)(clippedStart, clippedEnd, canvasBox);
|
|
4480
|
+
if (clipResult === 0) {
|
|
4481
|
+
return null;
|
|
4482
|
+
}
|
|
4483
|
+
const clippedStartValid = !isNaN(clippedStart[0]) && !isNaN(clippedStart[1]);
|
|
4484
|
+
const clippedEndValid = !isNaN(clippedEnd[0]) && !isNaN(clippedEnd[1]);
|
|
4485
|
+
if (!clippedStartValid || !clippedEndValid) {
|
|
4486
|
+
return null;
|
|
4487
|
+
}
|
|
4488
|
+
const [xMin, yMin, xMax, yMax] = canvasBox;
|
|
4489
|
+
const startInBounds = clippedStart[0] >= xMin - 1 &&
|
|
4490
|
+
clippedStart[0] <= xMax + 1 &&
|
|
4491
|
+
clippedStart[1] >= yMin - 1 &&
|
|
4492
|
+
clippedStart[1] <= yMax + 1;
|
|
4493
|
+
const endInBounds = clippedEnd[0] >= xMin - 1 &&
|
|
4494
|
+
clippedEnd[0] <= xMax + 1 &&
|
|
4495
|
+
clippedEnd[1] >= yMin - 1 &&
|
|
4496
|
+
clippedEnd[1] <= yMax + 1;
|
|
4497
|
+
if (!startInBounds || !endInBounds) {
|
|
4498
|
+
return null;
|
|
4499
|
+
}
|
|
4500
|
+
const dx = clippedEnd[0] - clippedStart[0];
|
|
4501
|
+
const dy = clippedEnd[1] - clippedStart[1];
|
|
4502
|
+
const length = Math.sqrt(dx * dx + dy * dy);
|
|
4503
|
+
if (length < MIN_LINE_LENGTH_PIXELS) {
|
|
4504
|
+
return null;
|
|
4310
4505
|
}
|
|
4506
|
+
return {
|
|
4507
|
+
start: clippedStart,
|
|
4508
|
+
end: clippedEnd,
|
|
4509
|
+
};
|
|
4311
4510
|
}
|
|
4312
4511
|
|
|
4512
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/volumeCropping/index.js
|
|
4513
|
+
|
|
4514
|
+
|
|
4515
|
+
|
|
4516
|
+
|
|
4517
|
+
|
|
4518
|
+
|
|
4519
|
+
|
|
4520
|
+
|
|
4521
|
+
|
|
4313
4522
|
|
|
4314
4523
|
|
|
4315
4524
|
/***/ },
|
|
4316
4525
|
|
|
4317
|
-
/***/
|
|
4318
|
-
(
|
|
4526
|
+
/***/ 22716
|
|
4527
|
+
() {
|
|
4319
4528
|
|
|
4320
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4321
|
-
/* harmony export */ Ay: () => (/* binding */ vtkSphereSource$1)
|
|
4322
|
-
/* harmony export */ });
|
|
4323
|
-
/* unused harmony exports extend, newInstance */
|
|
4324
|
-
/* harmony import */ var _macros2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(90027);
|
|
4325
|
-
/* harmony import */ var _Common_DataModel_PolyData_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12548);
|
|
4326
|
-
/* harmony import */ var _Common_Core_DataArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(445);
|
|
4327
4529
|
|
|
4328
4530
|
|
|
4531
|
+
/***/ },
|
|
4532
|
+
|
|
4533
|
+
/***/ 14770
|
|
4534
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4535
|
+
|
|
4536
|
+
"use strict";
|
|
4537
|
+
|
|
4538
|
+
// EXPORTS
|
|
4539
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
4540
|
+
C: () => (/* binding */ vtkOrientationControllerWidget)
|
|
4541
|
+
});
|
|
4542
|
+
|
|
4543
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/macros2.js
|
|
4544
|
+
var macros2 = __webpack_require__(90027);
|
|
4545
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/CellTypes.js
|
|
4546
|
+
var CellTypes = __webpack_require__(82649);
|
|
4547
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/Line.js
|
|
4548
|
+
var Line = __webpack_require__(35856);
|
|
4549
|
+
;// ../../../node_modules/@kitware/vtk.js/Rendering/Core/AbstractPicker.js
|
|
4329
4550
|
|
|
4330
4551
|
|
|
4331
4552
|
// ----------------------------------------------------------------------------
|
|
4332
|
-
//
|
|
4553
|
+
// vtkAbstractPicker methods
|
|
4333
4554
|
// ----------------------------------------------------------------------------
|
|
4334
4555
|
|
|
4335
|
-
function
|
|
4556
|
+
function vtkAbstractPicker(publicAPI, model) {
|
|
4336
4557
|
// Set our className
|
|
4337
|
-
model.classHierarchy.push('
|
|
4338
|
-
publicAPI.
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
endPhi *= Math.PI / 180.0;
|
|
4358
|
-
if (Math.abs(startTheta - endTheta) < 2.0 * Math.PI) {
|
|
4359
|
-
++thetaResolution;
|
|
4558
|
+
model.classHierarchy.push('vtkAbstractPicker');
|
|
4559
|
+
publicAPI.initialize = () => {
|
|
4560
|
+
model.renderer = null;
|
|
4561
|
+
model.selectionPoint[0] = 0.0;
|
|
4562
|
+
model.selectionPoint[1] = 0.0;
|
|
4563
|
+
model.selectionPoint[2] = 0.0;
|
|
4564
|
+
model.pickPosition[0] = 0.0;
|
|
4565
|
+
model.pickPosition[1] = 0.0;
|
|
4566
|
+
model.pickPosition[2] = 0.0;
|
|
4567
|
+
};
|
|
4568
|
+
publicAPI.initializePickList = () => {
|
|
4569
|
+
model.pickList = [];
|
|
4570
|
+
};
|
|
4571
|
+
publicAPI.addPickList = actor => {
|
|
4572
|
+
model.pickList.push(actor);
|
|
4573
|
+
};
|
|
4574
|
+
publicAPI.deletePickList = actor => {
|
|
4575
|
+
const i = model.pickList.indexOf(actor);
|
|
4576
|
+
if (i !== -1) {
|
|
4577
|
+
model.pickList.splice(i, 1);
|
|
4360
4578
|
}
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
const jEnd = model.phiResolution + (model.endPhi >= 180.0 ? -1 : 0);
|
|
4364
|
-
const numPts = model.phiResolution * thetaResolution + 2;
|
|
4365
|
-
const numPolys = model.phiResolution * 2 * model.thetaResolution;
|
|
4579
|
+
};
|
|
4580
|
+
}
|
|
4366
4581
|
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4582
|
+
// ----------------------------------------------------------------------------
|
|
4583
|
+
// Object factory
|
|
4584
|
+
// ----------------------------------------------------------------------------
|
|
4370
4585
|
|
|
4371
|
-
|
|
4372
|
-
|
|
4586
|
+
const DEFAULT_VALUES = {
|
|
4587
|
+
renderer: null,
|
|
4588
|
+
selectionPoint: [0.0, 0.0, 0.0],
|
|
4589
|
+
pickPosition: [0.0, 0.0, 0.0],
|
|
4590
|
+
pickFromList: false,
|
|
4591
|
+
pickList: []
|
|
4592
|
+
};
|
|
4373
4593
|
|
|
4374
|
-
|
|
4375
|
-
let cellLocation = 0;
|
|
4376
|
-
let polys = new Uint32Array(numPolys * 5);
|
|
4594
|
+
// ----------------------------------------------------------------------------
|
|
4377
4595
|
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
points[pointIdx * 3 + 1] = model.center[1];
|
|
4382
|
-
points[pointIdx * 3 + 2] = model.center[2] + model.radius;
|
|
4383
|
-
normals[pointIdx * 3 + 0] = 0;
|
|
4384
|
-
normals[pointIdx * 3 + 1] = 0;
|
|
4385
|
-
normals[pointIdx * 3 + 2] = 1;
|
|
4386
|
-
pointIdx++;
|
|
4387
|
-
numPoles++;
|
|
4388
|
-
}
|
|
4596
|
+
function extend(publicAPI, model) {
|
|
4597
|
+
let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
4598
|
+
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
4389
4599
|
|
|
4390
|
-
|
|
4391
|
-
|
|
4600
|
+
// Build VTK API
|
|
4601
|
+
macros2.m.obj(publicAPI, model);
|
|
4602
|
+
macros2.m.get(publicAPI, model, ['renderer']);
|
|
4603
|
+
macros2.m.getArray(publicAPI, model, ['selectionPoint', 'pickPosition']);
|
|
4604
|
+
macros2.m.setGet(publicAPI, model, ['pickFromList', 'pickList']);
|
|
4605
|
+
vtkAbstractPicker(publicAPI, model);
|
|
4606
|
+
}
|
|
4607
|
+
|
|
4608
|
+
// ----------------------------------------------------------------------------
|
|
4609
|
+
|
|
4610
|
+
const newInstance = macros2.m.newInstance(extend, 'vtkAbstractPicker');
|
|
4611
|
+
|
|
4612
|
+
// ----------------------------------------------------------------------------
|
|
4613
|
+
|
|
4614
|
+
var vtkAbstractPicker$1 = {
|
|
4615
|
+
newInstance,
|
|
4616
|
+
extend
|
|
4617
|
+
};
|
|
4618
|
+
|
|
4619
|
+
|
|
4620
|
+
|
|
4621
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/BoundingBox.js
|
|
4622
|
+
var BoundingBox = __webpack_require__(24377);
|
|
4623
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/Math/index.js
|
|
4624
|
+
var Core_Math = __webpack_require__(8047);
|
|
4625
|
+
// EXTERNAL MODULE: ../../../node_modules/gl-matrix/esm/index.js + 1 modules
|
|
4626
|
+
var esm = __webpack_require__(3823);
|
|
4627
|
+
;// ../../../node_modules/@kitware/vtk.js/Rendering/Core/Picker.js
|
|
4628
|
+
|
|
4629
|
+
|
|
4630
|
+
|
|
4631
|
+
|
|
4632
|
+
|
|
4633
|
+
|
|
4634
|
+
const {
|
|
4635
|
+
vtkErrorMacro
|
|
4636
|
+
} = macros2.m;
|
|
4637
|
+
const {
|
|
4638
|
+
vtkWarningMacro
|
|
4639
|
+
} = macros2.m;
|
|
4640
|
+
|
|
4641
|
+
// ----------------------------------------------------------------------------
|
|
4642
|
+
// vtkPicker methods
|
|
4643
|
+
// ----------------------------------------------------------------------------
|
|
4644
|
+
|
|
4645
|
+
function vtkPicker(publicAPI, model) {
|
|
4646
|
+
// Set our className
|
|
4647
|
+
model.classHierarchy.push('vtkPicker');
|
|
4648
|
+
const superClass = {
|
|
4649
|
+
...publicAPI
|
|
4650
|
+
};
|
|
4651
|
+
function initialize() {
|
|
4652
|
+
superClass.initialize();
|
|
4653
|
+
model.actors = [];
|
|
4654
|
+
model.pickedPositions = [];
|
|
4655
|
+
model.mapperPosition[0] = 0.0;
|
|
4656
|
+
model.mapperPosition[1] = 0.0;
|
|
4657
|
+
model.mapperPosition[2] = 0.0;
|
|
4658
|
+
model.mapper = null;
|
|
4659
|
+
model.dataSet = null;
|
|
4660
|
+
model.globalTMin = Number.MAX_VALUE;
|
|
4661
|
+
}
|
|
4662
|
+
|
|
4663
|
+
/**
|
|
4664
|
+
* Compute the tolerance in world coordinates.
|
|
4665
|
+
* Do this by determining the world coordinates of the diagonal points of the
|
|
4666
|
+
* window, computing the width of the window in world coordinates, and
|
|
4667
|
+
* multiplying by the tolerance.
|
|
4668
|
+
* @param {Number} selectionZ
|
|
4669
|
+
* @param {Number} aspect
|
|
4670
|
+
* @param {vtkRenderer} renderer
|
|
4671
|
+
* @returns {Number} the computed tolerance
|
|
4672
|
+
*/
|
|
4673
|
+
function computeTolerance(selectionZ, aspect, renderer) {
|
|
4674
|
+
let tolerance = 0.0;
|
|
4675
|
+
const view = renderer.getRenderWindow().getViews()[0];
|
|
4676
|
+
const viewport = renderer.getViewport();
|
|
4677
|
+
const winSize = view.getSize();
|
|
4678
|
+
let x = winSize[0] * viewport[0];
|
|
4679
|
+
let y = winSize[1] * viewport[1];
|
|
4680
|
+
const normalizedLeftDisplay = view.displayToNormalizedDisplay(x, y, selectionZ);
|
|
4681
|
+
const windowLowerLeft = renderer.normalizedDisplayToWorld(normalizedLeftDisplay[0], normalizedLeftDisplay[1], normalizedLeftDisplay[2], aspect);
|
|
4682
|
+
x = winSize[0] * viewport[2];
|
|
4683
|
+
y = winSize[1] * viewport[3];
|
|
4684
|
+
const normalizedRightDisplay = view.displayToNormalizedDisplay(x, y, selectionZ);
|
|
4685
|
+
const windowUpperRight = renderer.normalizedDisplayToWorld(normalizedRightDisplay[0], normalizedRightDisplay[1], normalizedRightDisplay[2], aspect);
|
|
4686
|
+
for (let i = 0; i < 3; i++) {
|
|
4687
|
+
tolerance += (windowUpperRight[i] - windowLowerLeft[i]) * (windowUpperRight[i] - windowLowerLeft[i]);
|
|
4688
|
+
}
|
|
4689
|
+
return Math.sqrt(tolerance);
|
|
4690
|
+
}
|
|
4691
|
+
|
|
4692
|
+
/**
|
|
4693
|
+
* Perform picking on the given renderer, given a ray defined in world coordinates.
|
|
4694
|
+
* @param {*} renderer
|
|
4695
|
+
* @param {*} tolerance
|
|
4696
|
+
* @param {*} p1World
|
|
4697
|
+
* @param {*} p2World
|
|
4698
|
+
* @returns true if we picked something else false
|
|
4699
|
+
*/
|
|
4700
|
+
function pick3DInternal(renderer, tolerance, p1World, p2World) {
|
|
4701
|
+
const p1Mapper = new Float64Array(4);
|
|
4702
|
+
const p2Mapper = new Float64Array(4);
|
|
4703
|
+
const ray = [];
|
|
4704
|
+
const hitPosition = [];
|
|
4705
|
+
const props = model.pickFromList ? model.pickList : renderer.getActors();
|
|
4706
|
+
|
|
4707
|
+
// pre-allocate some arrays.
|
|
4708
|
+
const transformScale = new Float64Array(3);
|
|
4709
|
+
const pickedPosition = new Float64Array(3);
|
|
4710
|
+
|
|
4711
|
+
// Loop over props.
|
|
4712
|
+
// Transform ray (defined from position of camera to selection point) into coordinates of mapper (not
|
|
4713
|
+
// transformed to actors coordinates! Reduces overall computation!!!).
|
|
4714
|
+
// Note that only vtkProp3D's can be picked by vtkPicker.
|
|
4715
|
+
props.forEach(prop => {
|
|
4716
|
+
const mapper = prop.getMapper();
|
|
4717
|
+
const propIsFullyTranslucent = prop.getProperty?.().getOpacity?.() === 0.0;
|
|
4718
|
+
const pickable = prop.getNestedPickable() && prop.getNestedVisibility() && !propIsFullyTranslucent;
|
|
4719
|
+
if (!pickable) {
|
|
4720
|
+
// prop cannot be picked
|
|
4721
|
+
return;
|
|
4722
|
+
}
|
|
4723
|
+
|
|
4724
|
+
// The prop is candidate for picking:
|
|
4725
|
+
// - get its composite matrix and invert it
|
|
4726
|
+
// - use the inverted matrix to transform the ray points into mapper coordinates
|
|
4727
|
+
model.transformMatrix = prop.getMatrix().slice(0);
|
|
4728
|
+
esm/* mat4.transpose */.pB.transpose(model.transformMatrix, model.transformMatrix);
|
|
4729
|
+
esm/* mat4.invert */.pB.invert(model.transformMatrix, model.transformMatrix);
|
|
4730
|
+
esm/* vec4.transformMat4 */.ln.transformMat4(p1Mapper, p1World, model.transformMatrix);
|
|
4731
|
+
esm/* vec4.transformMat4 */.ln.transformMat4(p2Mapper, p2World, model.transformMatrix);
|
|
4732
|
+
esm/* vec3.scale */.eR.scale(p1Mapper, p1Mapper, 1 / p1Mapper[3]);
|
|
4733
|
+
esm/* vec3.scale */.eR.scale(p2Mapper, p2Mapper, 1 / p2Mapper[3]);
|
|
4734
|
+
(0,Core_Math.s)(p2Mapper, p1Mapper, ray);
|
|
4735
|
+
|
|
4736
|
+
// We now have the ray endpoints in mapper coordinates.
|
|
4737
|
+
// Compare it with the mapper bounds to check if intersection is possible.
|
|
4738
|
+
|
|
4739
|
+
// Get the bounding box of the mapper.
|
|
4740
|
+
// Note that the tolerance is added to the bounding box to make sure things on the edge of the
|
|
4741
|
+
// bounding box are picked correctly.
|
|
4742
|
+
const bounds = mapper ? BoundingBox/* default */.Ay.inflate(mapper.getBounds(), tolerance) : [...BoundingBox/* default */.Ay.INIT_BOUNDS];
|
|
4743
|
+
if (BoundingBox/* default.intersectBox */.Ay.intersectBox(bounds, p1Mapper, ray, hitPosition, [])) {
|
|
4744
|
+
esm/* mat4.getScaling */.pB.getScaling(transformScale, model.transformMatrix);
|
|
4745
|
+
const t = model.intersectWithLine(p1Mapper, p2Mapper, tolerance * 0.333 * (transformScale[0] + transformScale[1] + transformScale[2]), prop, mapper);
|
|
4746
|
+
if (t < Number.MAX_VALUE) {
|
|
4747
|
+
pickedPosition[0] = (1.0 - t) * p1World[0] + t * p2World[0];
|
|
4748
|
+
pickedPosition[1] = (1.0 - t) * p1World[1] + t * p2World[1];
|
|
4749
|
+
pickedPosition[2] = (1.0 - t) * p1World[2] + t * p2World[2];
|
|
4750
|
+
const actorIndex = model.actors.indexOf(prop);
|
|
4751
|
+
if (actorIndex !== -1) {
|
|
4752
|
+
// If already in list, compare the previous picked position with the new one.
|
|
4753
|
+
// Store the new one if it is closer from the ray endpoint.
|
|
4754
|
+
const previousPickedPosition = model.pickedPositions[actorIndex];
|
|
4755
|
+
if ((0,Core_Math.f)(p1World, pickedPosition) < (0,Core_Math.f)(p1World, previousPickedPosition)) {
|
|
4756
|
+
model.pickedPositions[actorIndex] = pickedPosition.slice(0);
|
|
4757
|
+
}
|
|
4758
|
+
} else {
|
|
4759
|
+
model.actors.push(prop);
|
|
4760
|
+
model.pickedPositions.push(pickedPosition.slice(0));
|
|
4761
|
+
}
|
|
4762
|
+
}
|
|
4763
|
+
}
|
|
4764
|
+
});
|
|
4765
|
+
|
|
4766
|
+
// sort array by distance
|
|
4767
|
+
const tempArray = [];
|
|
4768
|
+
for (let i = 0; i < model.pickedPositions.length; i++) {
|
|
4769
|
+
tempArray.push({
|
|
4770
|
+
actor: model.actors[i],
|
|
4771
|
+
pickedPosition: model.pickedPositions[i],
|
|
4772
|
+
distance2: (0,Core_Math.f)(p1World, model.pickedPositions[i])
|
|
4773
|
+
});
|
|
4774
|
+
}
|
|
4775
|
+
tempArray.sort((a, b) => {
|
|
4776
|
+
const keyA = a.distance2;
|
|
4777
|
+
const keyB = b.distance2;
|
|
4778
|
+
// order the actors based on the distance2 attribute, so the near actors comes
|
|
4779
|
+
// first in the list
|
|
4780
|
+
if (keyA < keyB) return -1;
|
|
4781
|
+
if (keyA > keyB) return 1;
|
|
4782
|
+
return 0;
|
|
4783
|
+
});
|
|
4784
|
+
model.pickedPositions = [];
|
|
4785
|
+
model.actors = [];
|
|
4786
|
+
tempArray.forEach(obj => {
|
|
4787
|
+
model.pickedPositions.push(obj.pickedPosition);
|
|
4788
|
+
model.actors.push(obj.actor);
|
|
4789
|
+
});
|
|
4790
|
+
}
|
|
4791
|
+
|
|
4792
|
+
// Intersect data with specified ray.
|
|
4793
|
+
// Project the center point of the mapper onto the ray and determine its parametric value
|
|
4794
|
+
model.intersectWithLine = (p1, p2, tolerance, prop, mapper) => {
|
|
4795
|
+
if (!mapper) {
|
|
4796
|
+
return Number.MAX_VALUE;
|
|
4797
|
+
}
|
|
4798
|
+
const center = mapper.getCenter();
|
|
4799
|
+
const ray = esm/* vec3.subtract */.eR.subtract(new Float64Array(3), p2, p1);
|
|
4800
|
+
const rayFactor = (0,Core_Math.d)(ray, ray);
|
|
4801
|
+
if (rayFactor === 0.0) {
|
|
4802
|
+
return 2.0;
|
|
4803
|
+
}
|
|
4804
|
+
|
|
4805
|
+
// Project the center point onto the ray and determine its parametric value
|
|
4806
|
+
const t = (ray[0] * (center[0] - p1[0]) + ray[1] * (center[1] - p1[1]) + ray[2] * (center[2] - p1[2])) / rayFactor;
|
|
4807
|
+
return t;
|
|
4808
|
+
};
|
|
4809
|
+
|
|
4810
|
+
// To be overridden in subclasses
|
|
4811
|
+
publicAPI.pick = (selection, renderer) => {
|
|
4812
|
+
if (selection.length !== 3) {
|
|
4813
|
+
vtkWarningMacro('vtkPicker.pick - selection needs three components');
|
|
4814
|
+
}
|
|
4815
|
+
if (!renderer) {
|
|
4816
|
+
vtkErrorMacro('vtkPicker.pick - renderer cannot be null');
|
|
4817
|
+
throw new Error('renderer cannot be null');
|
|
4818
|
+
}
|
|
4819
|
+
initialize();
|
|
4820
|
+
const selectionX = selection[0];
|
|
4821
|
+
const selectionY = selection[1];
|
|
4822
|
+
let selectionZ = selection[2];
|
|
4823
|
+
model.renderer = renderer;
|
|
4824
|
+
model.selectionPoint[0] = selectionX;
|
|
4825
|
+
model.selectionPoint[1] = selectionY;
|
|
4826
|
+
model.selectionPoint[2] = selectionZ;
|
|
4827
|
+
const p1World = new Float64Array(4);
|
|
4828
|
+
const p2World = new Float64Array(4);
|
|
4829
|
+
|
|
4830
|
+
// Get camera focal point and position. Convert to display (screen)
|
|
4831
|
+
// coordinates. We need a depth value for z-buffer.
|
|
4832
|
+
const camera = renderer.getActiveCamera();
|
|
4833
|
+
const cameraPos = camera.getPosition();
|
|
4834
|
+
const cameraFP = camera.getFocalPoint();
|
|
4835
|
+
const view = renderer.getRenderWindow().getViews()[0];
|
|
4836
|
+
const dims = view.getViewportSize(renderer);
|
|
4837
|
+
if (dims[1] === 0) {
|
|
4838
|
+
vtkWarningMacro('vtkPicker.pick - viewport area is 0');
|
|
4839
|
+
return;
|
|
4840
|
+
}
|
|
4841
|
+
const aspect = dims[0] / dims[1];
|
|
4842
|
+
let displayCoords = [];
|
|
4843
|
+
displayCoords = renderer.worldToNormalizedDisplay(cameraFP[0], cameraFP[1], cameraFP[2], aspect);
|
|
4844
|
+
displayCoords = view.normalizedDisplayToDisplay(displayCoords[0], displayCoords[1], displayCoords[2]);
|
|
4845
|
+
selectionZ = displayCoords[2];
|
|
4846
|
+
|
|
4847
|
+
// Convert the selection point into world coordinates.
|
|
4848
|
+
const normalizedDisplay = view.displayToNormalizedDisplay(selectionX, selectionY, selectionZ);
|
|
4849
|
+
const worldCoords = renderer.normalizedDisplayToWorld(normalizedDisplay[0], normalizedDisplay[1], normalizedDisplay[2], aspect);
|
|
4850
|
+
for (let i = 0; i < 3; i++) {
|
|
4851
|
+
model.pickPosition[i] = worldCoords[i];
|
|
4852
|
+
}
|
|
4853
|
+
|
|
4854
|
+
// Compute the ray endpoints. The ray is along the line running from
|
|
4855
|
+
// the camera position to the selection point, starting where this line
|
|
4856
|
+
// intersects the front clipping plane, and terminating where this
|
|
4857
|
+
// line intersects the back clipping plane.
|
|
4858
|
+
const ray = [];
|
|
4859
|
+
for (let i = 0; i < 3; i++) {
|
|
4860
|
+
ray[i] = model.pickPosition[i] - cameraPos[i];
|
|
4861
|
+
}
|
|
4862
|
+
const cameraDOP = [];
|
|
4863
|
+
for (let i = 0; i < 3; i++) {
|
|
4864
|
+
cameraDOP[i] = cameraFP[i] - cameraPos[i];
|
|
4865
|
+
}
|
|
4866
|
+
(0,Core_Math.l)(cameraDOP);
|
|
4867
|
+
const rayLength = (0,Core_Math.d)(cameraDOP, ray);
|
|
4868
|
+
if (rayLength === 0.0) {
|
|
4869
|
+
vtkWarningMacro('Picker::Pick Cannot process points');
|
|
4870
|
+
return;
|
|
4871
|
+
}
|
|
4872
|
+
const clipRange = camera.getClippingRange();
|
|
4873
|
+
let tF;
|
|
4874
|
+
let tB;
|
|
4875
|
+
if (camera.getParallelProjection()) {
|
|
4876
|
+
tF = clipRange[0] - rayLength;
|
|
4877
|
+
tB = clipRange[1] - rayLength;
|
|
4878
|
+
for (let i = 0; i < 3; i++) {
|
|
4879
|
+
p1World[i] = model.pickPosition[i] + tF * cameraDOP[i];
|
|
4880
|
+
p2World[i] = model.pickPosition[i] + tB * cameraDOP[i];
|
|
4881
|
+
}
|
|
4882
|
+
} else {
|
|
4883
|
+
tF = clipRange[0] / rayLength;
|
|
4884
|
+
tB = clipRange[1] / rayLength;
|
|
4885
|
+
for (let i = 0; i < 3; i++) {
|
|
4886
|
+
p1World[i] = cameraPos[i] + tF * ray[i];
|
|
4887
|
+
p2World[i] = cameraPos[i] + tB * ray[i];
|
|
4888
|
+
}
|
|
4889
|
+
}
|
|
4890
|
+
p1World[3] = 1.0;
|
|
4891
|
+
p2World[3] = 1.0;
|
|
4892
|
+
const tolerance = computeTolerance(selectionZ, aspect, renderer) * model.tolerance;
|
|
4893
|
+
pick3DInternal(model.renderer, tolerance, p1World, p2World);
|
|
4894
|
+
};
|
|
4895
|
+
publicAPI.pick3DPoint = (selectionPoint, focalPoint, renderer) => {
|
|
4896
|
+
if (!renderer) {
|
|
4897
|
+
throw new Error('renderer cannot be null');
|
|
4898
|
+
}
|
|
4899
|
+
initialize();
|
|
4900
|
+
model.renderer = renderer;
|
|
4901
|
+
esm/* vec3.copy */.eR.copy(model.selectionPoint, selectionPoint);
|
|
4902
|
+
const view = renderer.getRenderWindow().getViews()[0];
|
|
4903
|
+
const dims = view.getViewportSize(renderer);
|
|
4904
|
+
if (dims[1] === 0) {
|
|
4905
|
+
vtkWarningMacro('vtkPicker.pick3DPoint - viewport area is 0');
|
|
4906
|
+
return;
|
|
4907
|
+
}
|
|
4908
|
+
const aspect = dims[0] / dims[1];
|
|
4909
|
+
const tolerance = computeTolerance(model.selectionPoint[2], aspect, renderer) * model.tolerance;
|
|
4910
|
+
pick3DInternal(renderer, tolerance, selectionPoint, focalPoint);
|
|
4911
|
+
};
|
|
4912
|
+
}
|
|
4913
|
+
|
|
4914
|
+
// ----------------------------------------------------------------------------
|
|
4915
|
+
// Object factory
|
|
4916
|
+
// ----------------------------------------------------------------------------
|
|
4917
|
+
|
|
4918
|
+
const Picker_DEFAULT_VALUES = {
|
|
4919
|
+
tolerance: 0.025,
|
|
4920
|
+
mapperPosition: [0.0, 0.0, 0.0],
|
|
4921
|
+
mapper: null,
|
|
4922
|
+
dataSet: null,
|
|
4923
|
+
actors: [],
|
|
4924
|
+
pickedPositions: [],
|
|
4925
|
+
transformMatrix: null,
|
|
4926
|
+
globalTMin: Number.MAX_VALUE
|
|
4927
|
+
};
|
|
4928
|
+
|
|
4929
|
+
// ----------------------------------------------------------------------------
|
|
4930
|
+
function Picker_extend(publicAPI, model) {
|
|
4931
|
+
let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
4932
|
+
Object.assign(model, Picker_DEFAULT_VALUES, initialValues);
|
|
4933
|
+
|
|
4934
|
+
// Inheritance
|
|
4935
|
+
vtkAbstractPicker$1.extend(publicAPI, model, initialValues);
|
|
4936
|
+
macros2.m.setGet(publicAPI, model, ['tolerance']);
|
|
4937
|
+
macros2.m.setGetArray(publicAPI, model, ['mapperPosition'], 3);
|
|
4938
|
+
macros2.m.get(publicAPI, model, ['mapper', 'dataSet', 'actors', 'pickedPositions']);
|
|
4939
|
+
macros2.m.event(publicAPI, model, 'pickChange');
|
|
4940
|
+
vtkPicker(publicAPI, model);
|
|
4941
|
+
}
|
|
4942
|
+
|
|
4943
|
+
// ----------------------------------------------------------------------------
|
|
4944
|
+
|
|
4945
|
+
const Picker_newInstance = macros2.m.newInstance(Picker_extend, 'vtkPicker');
|
|
4946
|
+
|
|
4947
|
+
// ----------------------------------------------------------------------------
|
|
4948
|
+
|
|
4949
|
+
var vtkPicker$1 = {
|
|
4950
|
+
newInstance: Picker_newInstance,
|
|
4951
|
+
extend: Picker_extend
|
|
4952
|
+
};
|
|
4953
|
+
|
|
4954
|
+
|
|
4955
|
+
|
|
4956
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/PolyLine.js
|
|
4957
|
+
var PolyLine = __webpack_require__(21186);
|
|
4958
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/Triangle.js
|
|
4959
|
+
var Triangle = __webpack_require__(96402);
|
|
4960
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/Quad.js
|
|
4961
|
+
var Quad = __webpack_require__(82021);
|
|
4962
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/CellTypes/Constants.js
|
|
4963
|
+
var Constants = __webpack_require__(61091);
|
|
4964
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/ImplicitFunction.js
|
|
4965
|
+
var ImplicitFunction = __webpack_require__(53001);
|
|
4966
|
+
;// ../../../node_modules/@kitware/vtk.js/Common/DataModel/Box.js
|
|
4967
|
+
|
|
4968
|
+
|
|
4969
|
+
|
|
4970
|
+
|
|
4971
|
+
// ----------------------------------------------------------------------------
|
|
4972
|
+
// Global methods
|
|
4973
|
+
// ----------------------------------------------------------------------------
|
|
4974
|
+
|
|
4975
|
+
//------------------------------------------------------------------------------
|
|
4976
|
+
// Bounding box intersection code from David Gobbi. Go through the
|
|
4977
|
+
// bounding planes one at a time and compute the parametric coordinate
|
|
4978
|
+
// of each intersection and return the parametric values and the calculated points
|
|
4979
|
+
function intersectWithLine(bounds, p1, p2) {
|
|
4980
|
+
let plane1 = -1;
|
|
4981
|
+
let plane2 = -1;
|
|
4982
|
+
let t1 = 0.0;
|
|
4983
|
+
let t2 = 1.0;
|
|
4984
|
+
for (let j = 0; j < 3; j++) {
|
|
4985
|
+
for (let k = 0; k < 2; k++) {
|
|
4986
|
+
// Compute distances of p1 and p2 from the plane along the plane normal
|
|
4987
|
+
const i = 2 * j + k;
|
|
4988
|
+
const d1 = (bounds[i] - p1[j]) * (1 - 2 * k);
|
|
4989
|
+
const d2 = (bounds[i] - p2[j]) * (1 - 2 * k);
|
|
4990
|
+
|
|
4991
|
+
// If both distances are positive, both points are outside
|
|
4992
|
+
if (d1 > 0 && d2 > 0) {
|
|
4993
|
+
return;
|
|
4994
|
+
}
|
|
4995
|
+
// If one of the distances is positive, the line crosses the plane
|
|
4996
|
+
if (d1 > 0 || d2 > 0) {
|
|
4997
|
+
// Compute fractional distance "t" of the crossing between p1 & p2
|
|
4998
|
+
let t = 0.0;
|
|
4999
|
+
if (d1 !== 0) {
|
|
5000
|
+
t = d1 / (d1 - d2);
|
|
5001
|
+
}
|
|
5002
|
+
|
|
5003
|
+
// If point p1 was clipped, adjust t1
|
|
5004
|
+
if (d1 > 0) {
|
|
5005
|
+
if (t >= t1) {
|
|
5006
|
+
t1 = t;
|
|
5007
|
+
plane1 = i;
|
|
5008
|
+
}
|
|
5009
|
+
}
|
|
5010
|
+
// else point p2 was clipped, so adjust t2
|
|
5011
|
+
else if (t <= t2) {
|
|
5012
|
+
t2 = t;
|
|
5013
|
+
plane2 = i;
|
|
5014
|
+
}
|
|
5015
|
+
// If this happens, there's no line left
|
|
5016
|
+
if (t1 > t2) {
|
|
5017
|
+
// Allow for planes that are coincident or slightly inverted
|
|
5018
|
+
if (plane1 < 0 || plane2 < 0) {
|
|
5019
|
+
return;
|
|
5020
|
+
}
|
|
5021
|
+
}
|
|
5022
|
+
}
|
|
5023
|
+
}
|
|
5024
|
+
}
|
|
5025
|
+
function getValues(plane, t) {
|
|
5026
|
+
const x = [0, 0, 0];
|
|
5027
|
+
for (let count = 0; count < 2; count++) {
|
|
5028
|
+
for (let i = 0; i < 3; i++) {
|
|
5029
|
+
if (plane === 2 * i || plane === 2 * i + 1) {
|
|
5030
|
+
x[i] = bounds[plane];
|
|
5031
|
+
} else {
|
|
5032
|
+
x[i] = p1[i] * (1.0 - t) + p2[i] * t;
|
|
5033
|
+
if (x[i] < bounds[2 * i]) {
|
|
5034
|
+
x[i] = bounds[2 * i];
|
|
5035
|
+
}
|
|
5036
|
+
if (x[i] > bounds[2 * i + 1]) {
|
|
5037
|
+
x[i] = bounds[2 * i + 1];
|
|
5038
|
+
}
|
|
5039
|
+
}
|
|
5040
|
+
}
|
|
5041
|
+
}
|
|
5042
|
+
return x;
|
|
5043
|
+
}
|
|
5044
|
+
const x1 = getValues(plane1, t1);
|
|
5045
|
+
const x2 = getValues(plane2, t2);
|
|
5046
|
+
const outObject = {
|
|
5047
|
+
t1,
|
|
5048
|
+
t2,
|
|
5049
|
+
x1,
|
|
5050
|
+
x2
|
|
5051
|
+
};
|
|
5052
|
+
|
|
5053
|
+
// eslint-disable-next-line consistent-return
|
|
5054
|
+
return outObject;
|
|
5055
|
+
}
|
|
5056
|
+
|
|
5057
|
+
// ----------------------------------------------------------------------------
|
|
5058
|
+
// Static API
|
|
5059
|
+
// ----------------------------------------------------------------------------
|
|
5060
|
+
|
|
5061
|
+
const STATIC = {};
|
|
5062
|
+
|
|
5063
|
+
// ----------------------------------------------------------------------------
|
|
5064
|
+
// vtkBox methods
|
|
5065
|
+
// ----------------------------------------------------------------------------
|
|
5066
|
+
function vtkBox(publicAPI, model) {
|
|
5067
|
+
// Set our className
|
|
5068
|
+
model.classHierarchy.push('vtkBox');
|
|
5069
|
+
|
|
5070
|
+
// TODO: replace with macro.setArray ?
|
|
5071
|
+
publicAPI.setBounds = function () {
|
|
5072
|
+
let boundsArray = [];
|
|
5073
|
+
for (var _len = arguments.length, bounds = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5074
|
+
bounds[_key] = arguments[_key];
|
|
5075
|
+
}
|
|
5076
|
+
if (Array.isArray(bounds[0])) {
|
|
5077
|
+
boundsArray = bounds[0];
|
|
5078
|
+
} else {
|
|
5079
|
+
for (let i = 0; i < bounds.length; i++) {
|
|
5080
|
+
boundsArray.push(bounds[i]);
|
|
5081
|
+
}
|
|
5082
|
+
}
|
|
5083
|
+
if (boundsArray.length !== 6) {
|
|
5084
|
+
console.log('vtkBox.setBounds', boundsArray, bounds);
|
|
5085
|
+
return;
|
|
5086
|
+
}
|
|
5087
|
+
BoundingBox/* default.setBounds */.Ay.setBounds(model.bbox, boundsArray);
|
|
5088
|
+
};
|
|
5089
|
+
publicAPI.getBounds = () => model.bbox;
|
|
5090
|
+
publicAPI.evaluateFunction = (x, y, z) => {
|
|
5091
|
+
const point = Array.isArray(x) ? x : [x, y, z];
|
|
5092
|
+
let diff;
|
|
5093
|
+
let dist;
|
|
5094
|
+
let t;
|
|
5095
|
+
let minDistance = -Number.MAX_VALUE;
|
|
5096
|
+
let distance = 0;
|
|
5097
|
+
const minPoint = BoundingBox/* default.getMinPoint */.Ay.getMinPoint(model.bbox);
|
|
5098
|
+
const maxPoint = BoundingBox/* default.getMaxPoint */.Ay.getMaxPoint(model.bbox);
|
|
5099
|
+
let inside = 1;
|
|
5100
|
+
for (let i = 0; i < 3; i++) {
|
|
5101
|
+
diff = BoundingBox/* default.getLength */.Ay.getLength(model.bbox, i);
|
|
5102
|
+
if (diff !== 0.0) {
|
|
5103
|
+
t = (point[i] - minPoint[i]) / diff;
|
|
5104
|
+
if (t < 0.0) {
|
|
5105
|
+
inside = 0;
|
|
5106
|
+
dist = minPoint[i] - point[i];
|
|
5107
|
+
} else if (t > 1.0) {
|
|
5108
|
+
inside = 0;
|
|
5109
|
+
dist = point[i] - maxPoint[i];
|
|
5110
|
+
} else {
|
|
5111
|
+
// want negative distance, we are inside
|
|
5112
|
+
if (t <= 0.5) {
|
|
5113
|
+
dist = minPoint[i] - point[i];
|
|
5114
|
+
} else {
|
|
5115
|
+
dist = point[i] - maxPoint[i];
|
|
5116
|
+
}
|
|
5117
|
+
if (dist > minDistance) {
|
|
5118
|
+
// remember, it's negative
|
|
5119
|
+
minDistance = dist;
|
|
5120
|
+
}
|
|
5121
|
+
} // end if inside
|
|
5122
|
+
} else {
|
|
5123
|
+
dist = Math.abs(point[i] - minPoint[i]);
|
|
5124
|
+
if (dist > 0.0) {
|
|
5125
|
+
inside = 0;
|
|
5126
|
+
}
|
|
5127
|
+
}
|
|
5128
|
+
if (dist > 0.0) {
|
|
5129
|
+
distance += dist * dist;
|
|
5130
|
+
}
|
|
5131
|
+
} // end for i
|
|
5132
|
+
distance = Math.sqrt(distance);
|
|
5133
|
+
if (inside) {
|
|
5134
|
+
return minDistance;
|
|
5135
|
+
}
|
|
5136
|
+
return distance;
|
|
5137
|
+
};
|
|
5138
|
+
publicAPI.addBounds = function () {
|
|
5139
|
+
let boundsArray = [];
|
|
5140
|
+
if (Array.isArray(arguments.length <= 0 ? undefined : arguments[0])) {
|
|
5141
|
+
boundsArray = arguments.length <= 0 ? undefined : arguments[0];
|
|
5142
|
+
} else {
|
|
5143
|
+
for (let i = 0; i < arguments.length; i++) {
|
|
5144
|
+
boundsArray.push(i < 0 || arguments.length <= i ? undefined : arguments[i]);
|
|
5145
|
+
}
|
|
5146
|
+
}
|
|
5147
|
+
if (boundsArray.length !== 6) {
|
|
5148
|
+
return;
|
|
5149
|
+
}
|
|
5150
|
+
BoundingBox/* default.addBounds */.Ay.addBounds(model.bbox, ...boundsArray);
|
|
5151
|
+
publicAPI.modified();
|
|
5152
|
+
};
|
|
5153
|
+
publicAPI.addBox = other => publicAPI.addBounds(other.getBounds());
|
|
5154
|
+
publicAPI.intersectWithLine = (p1, p2) => intersectWithLine(model.bbox, p1, p2);
|
|
5155
|
+
}
|
|
5156
|
+
|
|
5157
|
+
// ----------------------------------------------------------------------------
|
|
5158
|
+
// Object factory
|
|
5159
|
+
// ----------------------------------------------------------------------------
|
|
5160
|
+
|
|
5161
|
+
const Box_DEFAULT_VALUES = {
|
|
5162
|
+
bbox: [...BoundingBox/* default */.Ay.INIT_BOUNDS]
|
|
5163
|
+
};
|
|
5164
|
+
|
|
5165
|
+
// ----------------------------------------------------------------------------
|
|
5166
|
+
|
|
5167
|
+
function Box_extend(publicAPI, model) {
|
|
5168
|
+
let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
5169
|
+
Object.assign(model, Box_DEFAULT_VALUES, initialValues);
|
|
5170
|
+
|
|
5171
|
+
// Object methods
|
|
5172
|
+
ImplicitFunction/* default.extend */.Ay.extend(publicAPI, model, initialValues);
|
|
5173
|
+
vtkBox(publicAPI, model);
|
|
5174
|
+
}
|
|
5175
|
+
|
|
5176
|
+
// ----------------------------------------------------------------------------
|
|
5177
|
+
|
|
5178
|
+
const Box_newInstance = macros2.m.newInstance(Box_extend, 'vtkBox');
|
|
5179
|
+
|
|
5180
|
+
// ----------------------------------------------------------------------------
|
|
5181
|
+
|
|
5182
|
+
var vtkBox$1 = {
|
|
5183
|
+
newInstance: Box_newInstance,
|
|
5184
|
+
extend: Box_extend,
|
|
5185
|
+
intersectWithLine,
|
|
5186
|
+
...STATIC
|
|
5187
|
+
};
|
|
5188
|
+
|
|
5189
|
+
|
|
5190
|
+
|
|
5191
|
+
;// ../../../node_modules/@kitware/vtk.js/Rendering/Core/CellPicker.js
|
|
5192
|
+
|
|
5193
|
+
|
|
5194
|
+
|
|
5195
|
+
|
|
5196
|
+
|
|
5197
|
+
|
|
5198
|
+
|
|
5199
|
+
|
|
5200
|
+
|
|
5201
|
+
|
|
5202
|
+
|
|
5203
|
+
|
|
5204
|
+
// ----------------------------------------------------------------------------
|
|
5205
|
+
// Global methods
|
|
5206
|
+
// ----------------------------------------------------------------------------
|
|
5207
|
+
|
|
5208
|
+
function createCellMap() {
|
|
5209
|
+
return {
|
|
5210
|
+
[Constants/* CellType */.vZ.VTK_LINE]: Line/* default.newInstance */.Ay.newInstance(),
|
|
5211
|
+
[Constants/* CellType */.vZ.VTK_POLY_LINE]: PolyLine/* default.newInstance */.Ay.newInstance(),
|
|
5212
|
+
[Constants/* CellType */.vZ.VTK_TRIANGLE]: Triangle/* default.newInstance */.Ay.newInstance(),
|
|
5213
|
+
[Constants/* CellType */.vZ.VTK_QUAD]: Quad/* default.newInstance */.Ay.newInstance()
|
|
5214
|
+
};
|
|
5215
|
+
}
|
|
5216
|
+
function clipLineWithPlane(mapper, matrix, p1, p2) {
|
|
5217
|
+
const outObj = {
|
|
5218
|
+
planeId: -1,
|
|
5219
|
+
t1: 0.0,
|
|
5220
|
+
t2: 1.0,
|
|
5221
|
+
intersect: 0
|
|
5222
|
+
};
|
|
5223
|
+
const nbClippingPlanes = mapper.getNumberOfClippingPlanes();
|
|
5224
|
+
const plane = [];
|
|
5225
|
+
for (let i = 0; i < nbClippingPlanes; i++) {
|
|
5226
|
+
mapper.getClippingPlaneInDataCoords(matrix, i, plane);
|
|
5227
|
+
const d1 = plane[0] * p1[0] + plane[1] * p1[1] + plane[2] * p1[2] + plane[3];
|
|
5228
|
+
const d2 = plane[0] * p2[0] + plane[1] * p2[1] + plane[2] * p2[2] + plane[3];
|
|
5229
|
+
|
|
5230
|
+
// If both distances are negative, both points are outside
|
|
5231
|
+
if (d1 < 0 && d2 < 0) {
|
|
5232
|
+
return 0;
|
|
5233
|
+
}
|
|
5234
|
+
if (d1 < 0 || d2 < 0) {
|
|
5235
|
+
// If only one of the distances is negative, the line crosses the plane
|
|
5236
|
+
// Compute fractional distance "t" of the crossing between p1 & p2
|
|
5237
|
+
let t = 0.0;
|
|
5238
|
+
|
|
5239
|
+
// The "if" here just avoids an expensive division when possible
|
|
5240
|
+
if (d1 !== 0) {
|
|
5241
|
+
// We will never have d1==d2 since they have different signs
|
|
5242
|
+
t = d1 / (d1 - d2);
|
|
5243
|
+
}
|
|
5244
|
+
|
|
5245
|
+
// If point p1 was clipped, adjust t1
|
|
5246
|
+
if (d1 < 0) {
|
|
5247
|
+
if (t >= outObj.t1) {
|
|
5248
|
+
outObj.t1 = t;
|
|
5249
|
+
outObj.planeId = i;
|
|
5250
|
+
}
|
|
5251
|
+
} else if (t <= outObj.t2) {
|
|
5252
|
+
// else point p2 was clipped, so adjust t2
|
|
5253
|
+
outObj.t2 = t;
|
|
5254
|
+
}
|
|
5255
|
+
// If this happens, there's no line left
|
|
5256
|
+
if (outObj.t1 > outObj.t2) {
|
|
5257
|
+
outObj.intersect = 0;
|
|
5258
|
+
return outObj;
|
|
5259
|
+
}
|
|
5260
|
+
}
|
|
5261
|
+
}
|
|
5262
|
+
outObj.intersect = 1;
|
|
5263
|
+
return outObj;
|
|
5264
|
+
}
|
|
5265
|
+
|
|
5266
|
+
// ----------------------------------------------------------------------------
|
|
5267
|
+
// Static API
|
|
5268
|
+
// ----------------------------------------------------------------------------
|
|
5269
|
+
|
|
5270
|
+
const CellPicker_STATIC = {
|
|
5271
|
+
clipLineWithPlane
|
|
5272
|
+
};
|
|
5273
|
+
|
|
5274
|
+
// ----------------------------------------------------------------------------
|
|
5275
|
+
// vtkCellPicker methods
|
|
5276
|
+
// ----------------------------------------------------------------------------
|
|
5277
|
+
|
|
5278
|
+
function vtkCellPicker(publicAPI, model) {
|
|
5279
|
+
// Set our className
|
|
5280
|
+
model.classHierarchy.push('vtkCellPicker');
|
|
5281
|
+
const superClass = {
|
|
5282
|
+
...publicAPI
|
|
5283
|
+
};
|
|
5284
|
+
function resetCellPickerInfo() {
|
|
5285
|
+
model.cellId = -1;
|
|
5286
|
+
model.pCoords[0] = 0.0;
|
|
5287
|
+
model.pCoords[1] = 0.0;
|
|
5288
|
+
model.pCoords[2] = 0.0;
|
|
5289
|
+
model.cellIJK[0] = 0.0;
|
|
5290
|
+
model.cellIJK[1] = 0.0;
|
|
5291
|
+
model.cellIJK[2] = 0.0;
|
|
5292
|
+
model.mapperNormal[0] = 0.0;
|
|
5293
|
+
model.mapperNormal[1] = 0.0;
|
|
5294
|
+
model.mapperNormal[2] = 1.0;
|
|
5295
|
+
model.pickNormal[0] = 0.0;
|
|
5296
|
+
model.pickNormal[1] = 0.0;
|
|
5297
|
+
model.pickNormal[2] = 1.0;
|
|
5298
|
+
}
|
|
5299
|
+
function resetPickInfo() {
|
|
5300
|
+
model.dataSet = null;
|
|
5301
|
+
model.mapper = null;
|
|
5302
|
+
resetCellPickerInfo();
|
|
5303
|
+
}
|
|
5304
|
+
publicAPI.initialize = () => {
|
|
5305
|
+
resetPickInfo();
|
|
5306
|
+
superClass.initialize();
|
|
5307
|
+
};
|
|
5308
|
+
publicAPI.computeSurfaceNormal = (data, cell, weights, normal) => {
|
|
5309
|
+
const normals = data.getPointData().getNormals();
|
|
5310
|
+
if (normals) {
|
|
5311
|
+
normal[0] = 0.0;
|
|
5312
|
+
normal[1] = 0.0;
|
|
5313
|
+
normal[2] = 0.0;
|
|
5314
|
+
const pointNormal = [];
|
|
5315
|
+
for (let i = 0; i < 3; i++) {
|
|
5316
|
+
normals.getTuple(cell.getPointsIds()[i], pointNormal);
|
|
5317
|
+
normal[0] += pointNormal[0] * weights[i];
|
|
5318
|
+
normal[1] += pointNormal[1] * weights[i];
|
|
5319
|
+
normal[2] += pointNormal[2] * weights[i];
|
|
5320
|
+
}
|
|
5321
|
+
(0,Core_Math.l)(normal);
|
|
5322
|
+
} else {
|
|
5323
|
+
return 0;
|
|
5324
|
+
}
|
|
5325
|
+
return 1;
|
|
5326
|
+
};
|
|
5327
|
+
publicAPI.pick = (selection, renderer) => {
|
|
5328
|
+
publicAPI.initialize();
|
|
5329
|
+
const pickResult = superClass.pick(selection, renderer);
|
|
5330
|
+
if (pickResult) {
|
|
5331
|
+
const camera = renderer.getActiveCamera();
|
|
5332
|
+
const cameraPos = [];
|
|
5333
|
+
camera.getPosition(cameraPos);
|
|
5334
|
+
if (camera.getParallelProjection()) {
|
|
5335
|
+
// For parallel projection, use -ve direction of projection
|
|
5336
|
+
const cameraFocus = [];
|
|
5337
|
+
camera.getFocalPoint(cameraFocus);
|
|
5338
|
+
model.pickNormal[0] = cameraPos[0] - cameraFocus[0];
|
|
5339
|
+
model.pickNormal[1] = cameraPos[1] - cameraFocus[1];
|
|
5340
|
+
model.pickNormal[2] = cameraPos[2] - cameraFocus[2];
|
|
5341
|
+
} else {
|
|
5342
|
+
// Get the vector from pick position to the camera
|
|
5343
|
+
model.pickNormal[0] = cameraPos[0] - model.pickPosition[0];
|
|
5344
|
+
model.pickNormal[1] = cameraPos[1] - model.pickPosition[1];
|
|
5345
|
+
model.pickNormal[2] = cameraPos[2] - model.pickPosition[2];
|
|
5346
|
+
}
|
|
5347
|
+
(0,Core_Math.l)(model.pickNormal);
|
|
5348
|
+
}
|
|
5349
|
+
return pickResult;
|
|
5350
|
+
};
|
|
5351
|
+
model.intersectWithLine = (p1, p2, tolerance, prop, mapper) => {
|
|
5352
|
+
let tMin = Number.MAX_VALUE;
|
|
5353
|
+
let t1 = 0.0;
|
|
5354
|
+
let t2 = 1.0;
|
|
5355
|
+
const vtkCellPickerPlaneTol = 1e-14;
|
|
5356
|
+
const clipLine = clipLineWithPlane(mapper, model.transformMatrix, p1, p2);
|
|
5357
|
+
if (mapper && !clipLine.intersect) {
|
|
5358
|
+
return Number.MAX_VALUE;
|
|
5359
|
+
}
|
|
5360
|
+
if (mapper.isA('vtkImageMapper') || mapper.isA('vtkImageArrayMapper')) {
|
|
5361
|
+
const pickData = mapper.intersectWithLineForCellPicking(p1, p2);
|
|
5362
|
+
if (pickData) {
|
|
5363
|
+
tMin = pickData.t;
|
|
5364
|
+
model.cellIJK = pickData.ijk;
|
|
5365
|
+
model.pCoords = pickData.pCoords;
|
|
5366
|
+
}
|
|
5367
|
+
} else if (mapper.isA('vtkVolumeMapper')) {
|
|
5368
|
+
// we calculate here the parametric intercept points between the ray and the bounding box, so
|
|
5369
|
+
// if the application defines for some reason a too large ray length (1e6), it restrict the calculation
|
|
5370
|
+
// to the vtkVolume prop bounding box
|
|
5371
|
+
const interceptionObject = vtkBox$1.intersectWithLine(mapper.getBounds(), p1, p2);
|
|
5372
|
+
t1 = interceptionObject?.t1 > clipLine.t1 ? interceptionObject.t1 : clipLine.t1;
|
|
5373
|
+
t2 = interceptionObject?.t2 < clipLine.t2 ? interceptionObject.t2 : clipLine.t2;
|
|
5374
|
+
tMin = model.intersectVolumeWithLine(p1, p2, t1, t2, tolerance, prop);
|
|
5375
|
+
} else if (mapper.isA('vtkMapper')) {
|
|
5376
|
+
tMin = model.intersectActorWithLine(p1, p2, t1, t2, tolerance, mapper);
|
|
5377
|
+
}
|
|
5378
|
+
if (tMin < model.globalTMin) {
|
|
5379
|
+
model.globalTMin = tMin;
|
|
5380
|
+
if (Math.abs(tMin - t1) < vtkCellPickerPlaneTol && clipLine.clippingPlaneId >= 0) {
|
|
5381
|
+
model.mapperPosition[0] = p1[0] * (1 - t1) + p2[0] * t1;
|
|
5382
|
+
model.mapperPosition[1] = p1[1] * (1 - t1) + p2[1] * t1;
|
|
5383
|
+
model.mapperPosition[2] = p1[2] * (1 - t1) + p2[2] * t1;
|
|
5384
|
+
const plane = [];
|
|
5385
|
+
mapper.getClippingPlaneInDataCoords(model.transformMatrix, clipLine.clippingPlaneId, plane);
|
|
5386
|
+
(0,Core_Math.l)(plane);
|
|
5387
|
+
// Want normal outward from the planes, not inward
|
|
5388
|
+
model.mapperNormal[0] = -plane[0];
|
|
5389
|
+
model.mapperNormal[1] = -plane[1];
|
|
5390
|
+
model.mapperNormal[2] = -plane[2];
|
|
5391
|
+
}
|
|
5392
|
+
esm/* vec3.transformMat4 */.eR.transformMat4(model.pickPosition, model.mapperPosition, model.transformMatrix);
|
|
5393
|
+
// Transform vector
|
|
5394
|
+
const mat = model.transformMatrix;
|
|
5395
|
+
model.mapperNormal[0] = mat[0] * model.pickNormal[0] + mat[4] * model.pickNormal[1] + mat[8] * model.pickNormal[2];
|
|
5396
|
+
model.mapperNormal[1] = mat[1] * model.pickNormal[0] + mat[5] * model.pickNormal[1] + mat[9] * model.pickNormal[2];
|
|
5397
|
+
model.mapperNormal[2] = mat[2] * model.pickNormal[0] + mat[6] * model.pickNormal[1] + mat[10] * model.pickNormal[2];
|
|
5398
|
+
}
|
|
5399
|
+
return tMin;
|
|
5400
|
+
};
|
|
5401
|
+
model.intersectVolumeWithLine = (p1, p2, t1, t2, tolerance, volume) => {
|
|
5402
|
+
let tMin = Number.MAX_VALUE;
|
|
5403
|
+
const mapper = volume.getMapper();
|
|
5404
|
+
const imageData = mapper.getInputData();
|
|
5405
|
+
const dims = imageData.getDimensions();
|
|
5406
|
+
const scalars = imageData.getPointData().getScalars().getData();
|
|
5407
|
+
const extent = imageData.getExtent();
|
|
5408
|
+
// get the world to index transform to correctly transform from world to volume index
|
|
5409
|
+
const imageTransform = imageData.getWorldToIndex();
|
|
5410
|
+
|
|
5411
|
+
// calculate opacity table
|
|
5412
|
+
const numIComps = 1;
|
|
5413
|
+
let oWidth = mapper.getOpacityTextureWidth();
|
|
5414
|
+
if (oWidth <= 0) {
|
|
5415
|
+
oWidth = 1024;
|
|
5416
|
+
}
|
|
5417
|
+
const tmpTable = new Float32Array(oWidth);
|
|
5418
|
+
const opacityArray = new Float32Array(oWidth);
|
|
5419
|
+
let ofun;
|
|
5420
|
+
let oRange;
|
|
5421
|
+
const sampleDist = volume.getMapper().getSampleDistance();
|
|
5422
|
+
for (let c = 0; c < numIComps; ++c) {
|
|
5423
|
+
ofun = volume.getProperty().getScalarOpacity(c);
|
|
5424
|
+
oRange = ofun.getRange();
|
|
5425
|
+
ofun.getTable(oRange[0], oRange[1], oWidth, tmpTable, 1);
|
|
5426
|
+
const opacityFactor = sampleDist / volume.getProperty().getScalarOpacityUnitDistance(c);
|
|
5427
|
+
|
|
5428
|
+
// adjust for sample distance etc
|
|
5429
|
+
for (let i = 0; i < oWidth; ++i) {
|
|
5430
|
+
opacityArray[i] = 1.0 - (1.0 - tmpTable[i]) ** opacityFactor;
|
|
5431
|
+
}
|
|
5432
|
+
}
|
|
5433
|
+
const scale = oWidth / (oRange[1] - oRange[0] + 1);
|
|
5434
|
+
|
|
5435
|
+
// Make a new p1 and p2 using the clipped t1 and t2
|
|
5436
|
+
const q1 = [0, 0, 0, 1];
|
|
5437
|
+
const q2 = [0, 0, 0, 1];
|
|
5438
|
+
q1[0] = p1[0];
|
|
5439
|
+
q1[1] = p1[1];
|
|
5440
|
+
q1[2] = p1[2];
|
|
5441
|
+
q2[0] = p2[0];
|
|
5442
|
+
q2[1] = p2[1];
|
|
5443
|
+
q2[2] = p2[2];
|
|
5444
|
+
if (t1 !== 0.0 || t2 !== 1.0) {
|
|
5445
|
+
for (let j = 0; j < 3; j++) {
|
|
5446
|
+
q1[j] = p1[j] * (1.0 - t1) + p2[j] * t1;
|
|
5447
|
+
q2[j] = p1[j] * (1.0 - t2) + p2[j] * t2;
|
|
5448
|
+
}
|
|
5449
|
+
}
|
|
5450
|
+
|
|
5451
|
+
// convert q1, q2 world coordinates to x1, x2 volume index coordinates
|
|
5452
|
+
const x1 = [0, 0, 0, 0];
|
|
5453
|
+
const x2 = [0, 0, 0, 0];
|
|
5454
|
+
esm/* vec4.transformMat4 */.ln.transformMat4(x1, q1, imageTransform);
|
|
5455
|
+
esm/* vec4.transformMat4 */.ln.transformMat4(x2, q2, imageTransform);
|
|
5456
|
+
const x = [0, 0, 0];
|
|
5457
|
+
const xi = [0, 0, 0];
|
|
5458
|
+
const sliceSize = dims[1] * dims[0];
|
|
5459
|
+
const rowSize = dims[0];
|
|
5460
|
+
// here the step is the 1 over the distance between volume index location x1 and x2
|
|
5461
|
+
const step = 1 / Math.sqrt((0,Core_Math.f)(x1, x2));
|
|
5462
|
+
let insideVolume;
|
|
5463
|
+
// here we reinterpret the t value as the distance between x1 and x2
|
|
5464
|
+
// When calculating the tMin, we weight t between t1 and t2 values
|
|
5465
|
+
for (let t = 0; t < 1; t += step) {
|
|
5466
|
+
// calculate the location of the point
|
|
5467
|
+
insideVolume = true;
|
|
5468
|
+
for (let j = 0; j < 3; j++) {
|
|
5469
|
+
// "t" is the fractional distance between endpoints x1 and x2
|
|
5470
|
+
x[j] = x1[j] * (1.0 - t) + x2[j] * t;
|
|
5471
|
+
}
|
|
5472
|
+
for (let j = 0; j < 3; j++) {
|
|
5473
|
+
// Bounds check
|
|
5474
|
+
if (x[j] < extent[2 * j]) {
|
|
5475
|
+
x[j] = extent[2 * j];
|
|
5476
|
+
insideVolume = false;
|
|
5477
|
+
} else if (x[j] > extent[2 * j + 1]) {
|
|
5478
|
+
x[j] = extent[2 * j + 1];
|
|
5479
|
+
insideVolume = false;
|
|
5480
|
+
}
|
|
5481
|
+
xi[j] = Math.round(x[j]);
|
|
5482
|
+
}
|
|
5483
|
+
if (insideVolume) {
|
|
5484
|
+
const index = xi[2] * sliceSize + xi[1] * rowSize + xi[0];
|
|
5485
|
+
let value = scalars[index];
|
|
5486
|
+
if (value < oRange[0]) {
|
|
5487
|
+
value = oRange[0];
|
|
5488
|
+
} else if (value > oRange[1]) {
|
|
5489
|
+
value = oRange[1];
|
|
5490
|
+
}
|
|
5491
|
+
value = Math.floor((value - oRange[0]) * scale);
|
|
5492
|
+
const opacity = tmpTable[value];
|
|
5493
|
+
if (opacity > model.opacityThreshold) {
|
|
5494
|
+
// returning the tMin to the original scale, if t1 > 0 or t2 < 1
|
|
5495
|
+
tMin = t1 * (1.0 - t) + t2 * t;
|
|
5496
|
+
break;
|
|
5497
|
+
}
|
|
5498
|
+
}
|
|
5499
|
+
}
|
|
5500
|
+
return tMin;
|
|
5501
|
+
};
|
|
5502
|
+
model.intersectActorWithLine = (p1, p2, t1, t2, tolerance, mapper) => {
|
|
5503
|
+
let tMin = Number.MAX_VALUE;
|
|
5504
|
+
const minXYZ = [0, 0, 0];
|
|
5505
|
+
let pDistMin = Number.MAX_VALUE;
|
|
5506
|
+
const minPCoords = [0, 0, 0];
|
|
5507
|
+
let minCellId = null;
|
|
5508
|
+
let minCell = null;
|
|
5509
|
+
let minCellType = null;
|
|
5510
|
+
let subId = null;
|
|
5511
|
+
const x = [];
|
|
5512
|
+
const data = mapper.getInputData();
|
|
5513
|
+
|
|
5514
|
+
// Make a new p1 and p2 using the clipped t1 and t2
|
|
5515
|
+
const q1 = [0, 0, 0];
|
|
5516
|
+
const q2 = [0, 0, 0];
|
|
5517
|
+
q1[0] = p1[0];
|
|
5518
|
+
q1[1] = p1[1];
|
|
5519
|
+
q1[2] = p1[2];
|
|
5520
|
+
q2[0] = p2[0];
|
|
5521
|
+
q2[1] = p2[1];
|
|
5522
|
+
q2[2] = p2[2];
|
|
5523
|
+
if (t1 !== 0.0 || t2 !== 1.0) {
|
|
5524
|
+
for (let j = 0; j < 3; j++) {
|
|
5525
|
+
q1[j] = p1[j] * (1.0 - t1) + p2[j] * t1;
|
|
5526
|
+
q2[j] = p1[j] * (1.0 - t2) + p2[j] * t2;
|
|
5527
|
+
}
|
|
5528
|
+
}
|
|
5529
|
+
if (data.getCells) {
|
|
5530
|
+
if (!data.getCells()) {
|
|
5531
|
+
data.buildLinks();
|
|
5532
|
+
}
|
|
5533
|
+
const tempCellMap = createCellMap();
|
|
5534
|
+
const minCellMap = createCellMap();
|
|
5535
|
+
const numberOfCells = data.getNumberOfCells();
|
|
5536
|
+
|
|
5537
|
+
/* eslint-disable no-continue */
|
|
5538
|
+
for (let cellId = 0; cellId < numberOfCells; cellId++) {
|
|
5539
|
+
const pCoords = [0, 0, 0];
|
|
5540
|
+
minCellType = data.getCellType(cellId);
|
|
5541
|
+
|
|
5542
|
+
// Skip cells that are marked as empty
|
|
5543
|
+
if (minCellType === Constants/* CellType */.vZ.VTK_EMPTY_CELL) {
|
|
5544
|
+
continue;
|
|
5545
|
+
}
|
|
5546
|
+
const cell = tempCellMap[minCellType];
|
|
5547
|
+
if (cell == null) {
|
|
5548
|
+
continue;
|
|
5549
|
+
}
|
|
5550
|
+
minCell = minCellMap[minCellType];
|
|
5551
|
+
data.getCell(cellId, cell);
|
|
5552
|
+
let cellPicked;
|
|
5553
|
+
{
|
|
5554
|
+
if (CellTypes/* default */.Ay.hasSubCells(minCellType)) {
|
|
5555
|
+
cellPicked = cell.intersectWithLine(t1, t2, p1, p2, tolerance, x, pCoords);
|
|
5556
|
+
} else {
|
|
5557
|
+
cellPicked = cell.intersectWithLine(p1, p2, tolerance, x, pCoords);
|
|
5558
|
+
}
|
|
5559
|
+
}
|
|
5560
|
+
if (cellPicked.intersect === 1 && cellPicked.t <= tMin + model.tolerance && cellPicked.t >= t1 && cellPicked.t <= t2) {
|
|
5561
|
+
const pDist = cell.getParametricDistance(pCoords);
|
|
5562
|
+
if (pDist < pDistMin || pDist === pDistMin && cellPicked.t < tMin) {
|
|
5563
|
+
tMin = cellPicked.t;
|
|
5564
|
+
pDistMin = pDist;
|
|
5565
|
+
subId = cellPicked.subId;
|
|
5566
|
+
minCellId = cellId;
|
|
5567
|
+
cell.deepCopy(minCell);
|
|
5568
|
+
for (let k = 0; k < 3; k++) {
|
|
5569
|
+
minXYZ[k] = x[k];
|
|
5570
|
+
minPCoords[k] = pCoords[k];
|
|
5571
|
+
}
|
|
5572
|
+
}
|
|
5573
|
+
}
|
|
5574
|
+
}
|
|
5575
|
+
/* eslint-enable no-continue */
|
|
5576
|
+
}
|
|
5577
|
+
|
|
5578
|
+
if (minCellId >= 0 && tMin < model.globalTMin) {
|
|
5579
|
+
resetPickInfo();
|
|
5580
|
+
const nbPointsInCell = minCell.getNumberOfPoints();
|
|
5581
|
+
const weights = new Array(nbPointsInCell);
|
|
5582
|
+
for (let i = 0; i < nbPointsInCell; i++) {
|
|
5583
|
+
weights[i] = 0.0;
|
|
5584
|
+
}
|
|
5585
|
+
const point = [];
|
|
5586
|
+
if (CellTypes/* default */.Ay.hasSubCells(minCellType)) {
|
|
5587
|
+
minCell.evaluateLocation(subId, minPCoords, point, weights);
|
|
5588
|
+
} else {
|
|
5589
|
+
minCell.evaluateLocation(minPCoords, point, weights);
|
|
5590
|
+
}
|
|
5591
|
+
|
|
5592
|
+
// Return the polydata to the user
|
|
5593
|
+
model.dataSet = data;
|
|
5594
|
+
model.cellId = minCellId;
|
|
5595
|
+
model.pCoords[0] = minPCoords[0];
|
|
5596
|
+
model.pCoords[1] = minPCoords[1];
|
|
5597
|
+
model.pCoords[2] = minPCoords[2];
|
|
5598
|
+
|
|
5599
|
+
// Find the point with the maximum weight
|
|
5600
|
+
let maxWeight = 0;
|
|
5601
|
+
let iMaxWeight = -1;
|
|
5602
|
+
for (let i = 0; i < nbPointsInCell; i++) {
|
|
5603
|
+
if (weights[i] > maxWeight) {
|
|
5604
|
+
iMaxWeight = i;
|
|
5605
|
+
maxWeight = weights[i];
|
|
5606
|
+
}
|
|
5607
|
+
}
|
|
5608
|
+
|
|
5609
|
+
// If maximum weight is found, use it to get the PointId
|
|
5610
|
+
if (iMaxWeight !== -1) {
|
|
5611
|
+
model.pointId = minCell.getPointsIds()[iMaxWeight];
|
|
5612
|
+
}
|
|
5613
|
+
|
|
5614
|
+
// Set the mapper position
|
|
5615
|
+
model.mapperPosition[0] = minXYZ[0];
|
|
5616
|
+
model.mapperPosition[1] = minXYZ[1];
|
|
5617
|
+
model.mapperPosition[2] = minXYZ[2];
|
|
5618
|
+
|
|
5619
|
+
// Compute the normal
|
|
5620
|
+
if (!publicAPI.computeSurfaceNormal(data, minCell, weights, model.mapperNormal)) {
|
|
5621
|
+
// By default, the normal points back along view ray
|
|
5622
|
+
model.mapperNormal[0] = p1[0] - p2[0];
|
|
5623
|
+
model.mapperNormal[1] = p1[1] - p2[1];
|
|
5624
|
+
model.mapperNormal[2] = p1[2] - p2[2];
|
|
5625
|
+
(0,Core_Math.l)(model.mapperNormal);
|
|
5626
|
+
}
|
|
5627
|
+
}
|
|
5628
|
+
return tMin;
|
|
5629
|
+
};
|
|
5630
|
+
}
|
|
5631
|
+
|
|
5632
|
+
// ----------------------------------------------------------------------------
|
|
5633
|
+
// Object factory
|
|
5634
|
+
// ----------------------------------------------------------------------------
|
|
5635
|
+
|
|
5636
|
+
const CellPicker_DEFAULT_VALUES = {
|
|
5637
|
+
cellId: -1,
|
|
5638
|
+
pCoords: [],
|
|
5639
|
+
cellIJK: [],
|
|
5640
|
+
pickNormal: [],
|
|
5641
|
+
mapperNormal: [],
|
|
5642
|
+
opacityThreshold: 0.2
|
|
5643
|
+
};
|
|
5644
|
+
|
|
5645
|
+
// ----------------------------------------------------------------------------
|
|
5646
|
+
|
|
5647
|
+
function CellPicker_extend(publicAPI, model) {
|
|
5648
|
+
let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
5649
|
+
Object.assign(model, CellPicker_DEFAULT_VALUES, initialValues);
|
|
5650
|
+
|
|
5651
|
+
// Inheritance
|
|
5652
|
+
vtkPicker$1.extend(publicAPI, model, initialValues);
|
|
5653
|
+
macros2.m.getArray(publicAPI, model, ['pickNormal', 'mapperNormal', 'pCoords', 'cellIJK']);
|
|
5654
|
+
macros2.m.setGet(publicAPI, model, ['opacityThreshold']);
|
|
5655
|
+
macros2.m.get(publicAPI, model, ['cellId']);
|
|
5656
|
+
|
|
5657
|
+
// Object methods
|
|
5658
|
+
vtkCellPicker(publicAPI, model);
|
|
5659
|
+
}
|
|
5660
|
+
|
|
5661
|
+
// ----------------------------------------------------------------------------
|
|
5662
|
+
|
|
5663
|
+
const CellPicker_newInstance = macros2.m.newInstance(CellPicker_extend, 'vtkCellPicker');
|
|
5664
|
+
|
|
5665
|
+
// ----------------------------------------------------------------------------
|
|
5666
|
+
|
|
5667
|
+
var vtkCellPicker$1 = {
|
|
5668
|
+
newInstance: CellPicker_newInstance,
|
|
5669
|
+
extend: CellPicker_extend,
|
|
5670
|
+
...CellPicker_STATIC
|
|
5671
|
+
};
|
|
5672
|
+
|
|
5673
|
+
|
|
5674
|
+
|
|
5675
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Rendering/Core/Actor.js
|
|
5676
|
+
var Actor = __webpack_require__(44404);
|
|
5677
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 1 modules
|
|
5678
|
+
var dist_esm = __webpack_require__(15327);
|
|
5679
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/macros.js
|
|
5680
|
+
var macros = __webpack_require__(28241);
|
|
5681
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Rendering/Core/Mapper.js + 1 modules
|
|
5682
|
+
var Mapper = __webpack_require__(81418);
|
|
5683
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/DataArray.js
|
|
5684
|
+
var DataArray = __webpack_require__(445);
|
|
5685
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Rendering/Core/Texture.js
|
|
5686
|
+
var Texture = __webpack_require__(41090);
|
|
5687
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/ImageHelper.js
|
|
5688
|
+
var ImageHelper = __webpack_require__(74821);
|
|
5689
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/CellArray.js
|
|
5690
|
+
var CellArray = __webpack_require__(32461);
|
|
5691
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/PolyData.js + 7 modules
|
|
5692
|
+
var PolyData = __webpack_require__(27480);
|
|
5693
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/vtkjs/RhombicuboctahedronSource/index.js
|
|
5694
|
+
|
|
5695
|
+
|
|
5696
|
+
|
|
5697
|
+
|
|
5698
|
+
const MAIN_FACES = [
|
|
5699
|
+
4, 0, 1, 2, 3, 4, 4, 5, 6, 7, 4, 8, 9, 10, 11, 4, 12, 13, 14, 15, 4, 16, 17,
|
|
5700
|
+
18, 19, 4, 20, 21, 22, 23,
|
|
5701
|
+
];
|
|
5702
|
+
const CORNER_FACES = [
|
|
5703
|
+
3, 0, 16, 8, 3, 1, 9, 20, 3, 2, 23, 13, 3, 3, 12, 19, 3, 4, 17, 11, 3, 5, 10,
|
|
5704
|
+
21, 3, 6, 14, 22, 3, 7, 18, 15,
|
|
5705
|
+
];
|
|
5706
|
+
const EDGE_FACES = [
|
|
5707
|
+
4, 0, 1, 9, 8, 4, 1, 2, 23, 20, 4, 2, 3, 12, 13, 4, 3, 0, 16, 19, 4, 4, 5, 10,
|
|
5708
|
+
11, 4, 5, 6, 22, 21, 4, 6, 7, 15, 14, 4, 7, 4, 17, 18, 4, 8, 11, 17, 16, 4, 9,
|
|
5709
|
+
20, 21, 10, 4, 13, 23, 22, 14, 4, 12, 19, 18, 15,
|
|
5710
|
+
];
|
|
5711
|
+
function vtkRhombicuboctahedronSource(publicAPI, model) {
|
|
5712
|
+
model.classHierarchy.push('vtkRhombicuboctahedronSource');
|
|
5713
|
+
publicAPI.requestData = (inData, outData) => {
|
|
5714
|
+
const polyData = outData[0]?.initialize() || PolyData/* default.newInstance */.Ay.newInstance();
|
|
5715
|
+
outData[0] = polyData;
|
|
5716
|
+
let scale = 1.0;
|
|
5717
|
+
if (model.scale !== undefined && model.scale !== null) {
|
|
5718
|
+
if (Array.isArray(model.scale)) {
|
|
5719
|
+
scale = model.scale[0] || 1.0;
|
|
5720
|
+
}
|
|
5721
|
+
else if (typeof model.scale === 'number') {
|
|
5722
|
+
scale = model.scale;
|
|
5723
|
+
}
|
|
5724
|
+
}
|
|
5725
|
+
const phi = 1.4;
|
|
5726
|
+
const faceSize = 0.88;
|
|
5727
|
+
const vertices = [];
|
|
5728
|
+
vertices.push(-faceSize, -faceSize, -phi);
|
|
5729
|
+
vertices.push(faceSize, -faceSize, -phi);
|
|
5730
|
+
vertices.push(faceSize, faceSize, -phi);
|
|
5731
|
+
vertices.push(-faceSize, faceSize, -phi);
|
|
5732
|
+
vertices.push(-faceSize, -faceSize, phi);
|
|
5733
|
+
vertices.push(faceSize, -faceSize, phi);
|
|
5734
|
+
vertices.push(faceSize, faceSize, phi);
|
|
5735
|
+
vertices.push(-faceSize, faceSize, phi);
|
|
5736
|
+
vertices.push(-faceSize, -phi, -faceSize);
|
|
5737
|
+
vertices.push(faceSize, -phi, -faceSize);
|
|
5738
|
+
vertices.push(faceSize, -phi, faceSize);
|
|
5739
|
+
vertices.push(-faceSize, -phi, faceSize);
|
|
5740
|
+
vertices.push(-faceSize, phi, -faceSize);
|
|
5741
|
+
vertices.push(faceSize, phi, -faceSize);
|
|
5742
|
+
vertices.push(faceSize, phi, faceSize);
|
|
5743
|
+
vertices.push(-faceSize, phi, faceSize);
|
|
5744
|
+
vertices.push(-phi, -faceSize, -faceSize);
|
|
5745
|
+
vertices.push(-phi, -faceSize, faceSize);
|
|
5746
|
+
vertices.push(-phi, faceSize, faceSize);
|
|
5747
|
+
vertices.push(-phi, faceSize, -faceSize);
|
|
5748
|
+
vertices.push(phi, -faceSize, -faceSize);
|
|
5749
|
+
vertices.push(phi, -faceSize, faceSize);
|
|
5750
|
+
vertices.push(phi, faceSize, faceSize);
|
|
5751
|
+
vertices.push(phi, faceSize, -faceSize);
|
|
5752
|
+
let textureCoords = null;
|
|
5753
|
+
if (model.generate3DTextureCoordinates) {
|
|
5754
|
+
textureCoords = new Float64Array(24 * 3);
|
|
5755
|
+
for (let i = 0; i < 24; i++) {
|
|
5756
|
+
const vx = vertices[i * 3];
|
|
5757
|
+
const vy = vertices[i * 3 + 1];
|
|
5758
|
+
const vz = vertices[i * 3 + 2];
|
|
5759
|
+
const len = Math.sqrt(vx * vx + vy * vy + vz * vz) || 1;
|
|
5760
|
+
textureCoords[i * 3] = vx / len;
|
|
5761
|
+
textureCoords[i * 3 + 1] = vy / len;
|
|
5762
|
+
textureCoords[i * 3 + 2] = vz / len;
|
|
5763
|
+
}
|
|
5764
|
+
}
|
|
5765
|
+
for (let i = 0; i < vertices.length; i++) {
|
|
5766
|
+
vertices[i] *= scale;
|
|
5767
|
+
}
|
|
5768
|
+
const vertexArray = Float64Array.from(vertices);
|
|
5769
|
+
polyData.getPoints().setData(vertexArray, 3);
|
|
5770
|
+
const normals = new Float64Array(24 * 3);
|
|
5771
|
+
for (let i = 0; i < 24; i++) {
|
|
5772
|
+
const x = vertexArray[i * 3];
|
|
5773
|
+
const y = vertexArray[i * 3 + 1];
|
|
5774
|
+
const z = vertexArray[i * 3 + 2];
|
|
5775
|
+
const len = Math.sqrt(x * x + y * y + z * z);
|
|
5776
|
+
normals[i * 3] = x / len;
|
|
5777
|
+
normals[i * 3 + 1] = y / len;
|
|
5778
|
+
normals[i * 3 + 2] = z / len;
|
|
5779
|
+
}
|
|
5780
|
+
const normalArray = DataArray/* default.newInstance */.Ay.newInstance({
|
|
5781
|
+
name: 'Normals',
|
|
5782
|
+
values: normals,
|
|
5783
|
+
numberOfComponents: 3,
|
|
5784
|
+
});
|
|
5785
|
+
polyData.getPointData().setNormals(normalArray);
|
|
5786
|
+
if (textureCoords) {
|
|
5787
|
+
const tcoords = DataArray/* default.newInstance */.Ay.newInstance({
|
|
5788
|
+
name: 'TextureCoordinates',
|
|
5789
|
+
values: textureCoords,
|
|
5790
|
+
numberOfComponents: 3,
|
|
5791
|
+
});
|
|
5792
|
+
polyData.getPointData().setTCoords(tcoords);
|
|
5793
|
+
}
|
|
5794
|
+
const allFaces = [];
|
|
5795
|
+
if (model.generateMainFaces) {
|
|
5796
|
+
allFaces.push(...MAIN_FACES);
|
|
5797
|
+
}
|
|
5798
|
+
if (model.generateEdgeFaces) {
|
|
5799
|
+
allFaces.push(...EDGE_FACES);
|
|
5800
|
+
}
|
|
5801
|
+
if (model.generateCornerFaces) {
|
|
5802
|
+
allFaces.push(...CORNER_FACES);
|
|
5803
|
+
}
|
|
5804
|
+
if (allFaces.length > 0) {
|
|
5805
|
+
const polys = CellArray/* default.newInstance */.Ay.newInstance({
|
|
5806
|
+
values: Uint16Array.from(allFaces),
|
|
5807
|
+
});
|
|
5808
|
+
polyData.getPolys().deepCopy(polys);
|
|
5809
|
+
}
|
|
5810
|
+
else {
|
|
5811
|
+
polyData.getPolys().initialize();
|
|
5812
|
+
}
|
|
5813
|
+
polyData.modified();
|
|
5814
|
+
};
|
|
5815
|
+
}
|
|
5816
|
+
const RhombicuboctahedronSource_DEFAULT_VALUES = {
|
|
5817
|
+
scale: 1.0,
|
|
5818
|
+
generate3DTextureCoordinates: false,
|
|
5819
|
+
generateMainFaces: true,
|
|
5820
|
+
generateEdgeFaces: true,
|
|
5821
|
+
generateCornerFaces: true,
|
|
5822
|
+
};
|
|
5823
|
+
function RhombicuboctahedronSource_extend(publicAPI, model, initialValues = {}) {
|
|
5824
|
+
Object.assign(model, RhombicuboctahedronSource_DEFAULT_VALUES, initialValues);
|
|
5825
|
+
macros/* default.obj */.Ay.obj(publicAPI, model);
|
|
5826
|
+
macros/* default.setGet */.Ay.setGet(publicAPI, model, [
|
|
5827
|
+
'scale',
|
|
5828
|
+
'generate3DTextureCoordinates',
|
|
5829
|
+
'generateMainFaces',
|
|
5830
|
+
'generateEdgeFaces',
|
|
5831
|
+
'generateCornerFaces',
|
|
5832
|
+
]);
|
|
5833
|
+
macros/* default.algo */.Ay.algo(publicAPI, model, 0, 1);
|
|
5834
|
+
vtkRhombicuboctahedronSource(publicAPI, model);
|
|
5835
|
+
}
|
|
5836
|
+
const RhombicuboctahedronSource_newInstance = macros/* default.newInstance */.Ay.newInstance(RhombicuboctahedronSource_extend, 'vtkRhombicuboctahedronSource');
|
|
5837
|
+
/* harmony default export */ const RhombicuboctahedronSource = ({ newInstance: RhombicuboctahedronSource_newInstance, extend: RhombicuboctahedronSource_extend });
|
|
5838
|
+
|
|
5839
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/vtkjs/AnnotatedRhombicuboctahedronActor/index.js
|
|
5840
|
+
|
|
5841
|
+
|
|
5842
|
+
|
|
5843
|
+
|
|
5844
|
+
|
|
5845
|
+
|
|
5846
|
+
|
|
5847
|
+
function createMainFacesMesh(scale, faceColors, faceTextures) {
|
|
5848
|
+
const source = RhombicuboctahedronSource.newInstance({
|
|
5849
|
+
generate3DTextureCoordinates: false,
|
|
5850
|
+
generateMainFaces: true,
|
|
5851
|
+
generateEdgeFaces: false,
|
|
5852
|
+
generateCornerFaces: false,
|
|
5853
|
+
scale: scale,
|
|
5854
|
+
});
|
|
5855
|
+
source.update();
|
|
5856
|
+
const data = source.getOutputData();
|
|
5857
|
+
if (data) {
|
|
5858
|
+
const tcoords = [];
|
|
5859
|
+
for (let faceIdx = 0; faceIdx < 6; faceIdx++) {
|
|
5860
|
+
const col = faceIdx % 3;
|
|
5861
|
+
const row = Math.floor(faceIdx / 3);
|
|
5862
|
+
const u0 = col / 3.0;
|
|
5863
|
+
const u1 = (col + 1) / 3.0;
|
|
5864
|
+
const v0 = row / 2.0;
|
|
5865
|
+
const v1 = (row + 1) / 2.0;
|
|
5866
|
+
tcoords.push(u0, v0);
|
|
5867
|
+
tcoords.push(u1, v0);
|
|
5868
|
+
tcoords.push(u1, v1);
|
|
5869
|
+
tcoords.push(u0, v1);
|
|
5870
|
+
}
|
|
5871
|
+
const tcoordsArray = DataArray/* default.newInstance */.Ay.newInstance({
|
|
5872
|
+
name: 'TextureCoordinates',
|
|
5873
|
+
values: new Float32Array(tcoords),
|
|
5874
|
+
numberOfComponents: 2,
|
|
5875
|
+
});
|
|
5876
|
+
data.getPointData().setTCoords(tcoordsArray);
|
|
5877
|
+
data.modified();
|
|
5878
|
+
}
|
|
5879
|
+
return data;
|
|
5880
|
+
}
|
|
5881
|
+
function createEdgeFacesMesh(scale, color) {
|
|
5882
|
+
const source = RhombicuboctahedronSource.newInstance({
|
|
5883
|
+
generate3DTextureCoordinates: false,
|
|
5884
|
+
generateMainFaces: false,
|
|
5885
|
+
generateEdgeFaces: true,
|
|
5886
|
+
generateCornerFaces: false,
|
|
5887
|
+
scale: scale,
|
|
5888
|
+
});
|
|
5889
|
+
source.update();
|
|
5890
|
+
const data = source.getOutputData();
|
|
5891
|
+
if (data) {
|
|
5892
|
+
const colors = [];
|
|
5893
|
+
const numCells = data.getNumberOfCells();
|
|
5894
|
+
for (let i = 0; i < numCells; i++) {
|
|
5895
|
+
colors.push(color[0], color[1], color[2], 255);
|
|
5896
|
+
}
|
|
5897
|
+
const colorsArray = DataArray/* default.newInstance */.Ay.newInstance({
|
|
5898
|
+
name: 'Colors',
|
|
5899
|
+
values: new Uint8Array(colors),
|
|
5900
|
+
numberOfComponents: 4,
|
|
5901
|
+
});
|
|
5902
|
+
data.getCellData().setScalars(colorsArray);
|
|
5903
|
+
data.modified();
|
|
5904
|
+
}
|
|
5905
|
+
return data;
|
|
5906
|
+
}
|
|
5907
|
+
function createCornerFacesMesh(scale, color) {
|
|
5908
|
+
const source = RhombicuboctahedronSource.newInstance({
|
|
5909
|
+
generate3DTextureCoordinates: false,
|
|
5910
|
+
generateMainFaces: false,
|
|
5911
|
+
generateEdgeFaces: false,
|
|
5912
|
+
generateCornerFaces: true,
|
|
5913
|
+
scale: scale,
|
|
5914
|
+
});
|
|
5915
|
+
source.update();
|
|
5916
|
+
const data = source.getOutputData();
|
|
5917
|
+
if (data) {
|
|
5918
|
+
const colors = [];
|
|
5919
|
+
const numCells = data.getNumberOfCells();
|
|
5920
|
+
for (let i = 0; i < numCells; i++) {
|
|
5921
|
+
colors.push(color[0], color[1], color[2], 255);
|
|
5922
|
+
}
|
|
5923
|
+
const colorsArray = DataArray/* default.newInstance */.Ay.newInstance({
|
|
5924
|
+
name: 'Colors',
|
|
5925
|
+
values: new Uint8Array(colors),
|
|
5926
|
+
numberOfComponents: 4,
|
|
5927
|
+
});
|
|
5928
|
+
data.getCellData().setScalars(colorsArray);
|
|
5929
|
+
data.modified();
|
|
5930
|
+
}
|
|
5931
|
+
return data;
|
|
5932
|
+
}
|
|
5933
|
+
function createTextureAtlas(faceTextureData) {
|
|
5934
|
+
const faceSize = 256;
|
|
5935
|
+
const canvas = document.createElement('canvas');
|
|
5936
|
+
canvas.width = faceSize * 3;
|
|
5937
|
+
canvas.height = faceSize * 2;
|
|
5938
|
+
const ctx = canvas.getContext('2d');
|
|
5939
|
+
faceTextureData.forEach((data, index) => {
|
|
5940
|
+
const col = index % 3;
|
|
5941
|
+
const row = Math.floor(index / 3);
|
|
5942
|
+
const x = col * faceSize;
|
|
5943
|
+
const y = row * faceSize;
|
|
5944
|
+
ctx.fillStyle = `rgb(${data.faceColor[0]}, ${data.faceColor[1]}, ${data.faceColor[2]})`;
|
|
5945
|
+
ctx.fillRect(x, y, faceSize, faceSize);
|
|
5946
|
+
if (data.text) {
|
|
5947
|
+
ctx.save();
|
|
5948
|
+
ctx.translate(x + faceSize / 2, y + faceSize / 2);
|
|
5949
|
+
if (data.flipVertical) {
|
|
5950
|
+
ctx.scale(1, -1);
|
|
5951
|
+
}
|
|
5952
|
+
if (data.flipHorizontal) {
|
|
5953
|
+
ctx.scale(-1, 1);
|
|
5954
|
+
}
|
|
5955
|
+
ctx.rotate(((data.rotation || 0) * Math.PI) / 180);
|
|
5956
|
+
ctx.fillStyle = `rgb(${data.textColor[0]}, ${data.textColor[1]}, ${data.textColor[2]})`;
|
|
5957
|
+
ctx.font = 'bold 180px Arial';
|
|
5958
|
+
ctx.textAlign = 'center';
|
|
5959
|
+
ctx.textBaseline = 'middle';
|
|
5960
|
+
ctx.fillText(data.text, 0, 0);
|
|
5961
|
+
ctx.restore();
|
|
5962
|
+
}
|
|
5963
|
+
});
|
|
5964
|
+
return ImageHelper/* default */.A.canvasToImageData(canvas);
|
|
5965
|
+
}
|
|
5966
|
+
function vtkAnnotatedRhombicuboctahedronActor(publicAPI, model) {
|
|
5967
|
+
model.classHierarchy.push('vtkAnnotatedRhombicuboctahedronActor');
|
|
5968
|
+
function updateAllFaceTextures() { }
|
|
5969
|
+
function createActors() {
|
|
5970
|
+
let sourceScale = 1.0;
|
|
5971
|
+
if (model.scale !== undefined && model.scale !== null) {
|
|
5972
|
+
if (Array.isArray(model.scale)) {
|
|
5973
|
+
sourceScale = model.scale[0] || 1.0;
|
|
5974
|
+
}
|
|
5975
|
+
else if (typeof model.scale === 'number') {
|
|
5976
|
+
sourceScale = model.scale;
|
|
5977
|
+
}
|
|
5978
|
+
}
|
|
5979
|
+
const actors = [];
|
|
5980
|
+
const hexToRgb = (hex) => {
|
|
5981
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
5982
|
+
return result
|
|
5983
|
+
? result.slice(1, 4).map((n) => parseInt(n, 16))
|
|
5984
|
+
: [255, 255, 255];
|
|
5985
|
+
};
|
|
5986
|
+
const parseFontColor = (color) => {
|
|
5987
|
+
if (!color) {
|
|
5988
|
+
return [0, 0, 0];
|
|
5989
|
+
}
|
|
5990
|
+
const rgbMatch = color.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
5991
|
+
if (rgbMatch) {
|
|
5992
|
+
return [
|
|
5993
|
+
parseInt(rgbMatch[1], 10),
|
|
5994
|
+
parseInt(rgbMatch[2], 10),
|
|
5995
|
+
parseInt(rgbMatch[3], 10),
|
|
5996
|
+
];
|
|
5997
|
+
}
|
|
5998
|
+
if (color.startsWith('#')) {
|
|
5999
|
+
return hexToRgb(color);
|
|
6000
|
+
}
|
|
6001
|
+
const namedColors = {
|
|
6002
|
+
black: [0, 0, 0],
|
|
6003
|
+
white: [255, 255, 255],
|
|
6004
|
+
red: [255, 0, 0],
|
|
6005
|
+
green: [0, 255, 0],
|
|
6006
|
+
blue: [0, 0, 255],
|
|
6007
|
+
};
|
|
6008
|
+
if (namedColors[color.toLowerCase()]) {
|
|
6009
|
+
return namedColors[color.toLowerCase()];
|
|
6010
|
+
}
|
|
6011
|
+
return [0, 0, 0];
|
|
6012
|
+
};
|
|
6013
|
+
const faceColors = {
|
|
6014
|
+
zMinus: hexToRgb(model.zMinusFaceProperty.faceColor || model.defaultStyle.faceColor),
|
|
6015
|
+
zPlus: hexToRgb(model.zPlusFaceProperty.faceColor || model.defaultStyle.faceColor),
|
|
6016
|
+
yMinus: hexToRgb(model.yMinusFaceProperty.faceColor || model.defaultStyle.faceColor),
|
|
6017
|
+
yPlus: hexToRgb(model.yPlusFaceProperty.faceColor || model.defaultStyle.faceColor),
|
|
6018
|
+
xMinus: hexToRgb(model.xMinusFaceProperty.faceColor || model.defaultStyle.faceColor),
|
|
6019
|
+
xPlus: hexToRgb(model.xPlusFaceProperty.faceColor || model.defaultStyle.faceColor),
|
|
6020
|
+
};
|
|
6021
|
+
if (model.showMainFaces !== false) {
|
|
6022
|
+
const faceTextureData = [
|
|
6023
|
+
{
|
|
6024
|
+
faceColor: faceColors.zMinus,
|
|
6025
|
+
text: model.zMinusFaceProperty.text || 'I',
|
|
6026
|
+
textColor: parseFontColor(model.zMinusFaceProperty.fontColor || model.defaultStyle.fontColor),
|
|
6027
|
+
rotation: 0,
|
|
6028
|
+
},
|
|
6029
|
+
{
|
|
6030
|
+
faceColor: faceColors.zPlus,
|
|
6031
|
+
text: model.zPlusFaceProperty.text || 'S',
|
|
6032
|
+
textColor: parseFontColor(model.zPlusFaceProperty.fontColor || model.defaultStyle.fontColor),
|
|
6033
|
+
rotation: 0,
|
|
6034
|
+
flipVertical: true,
|
|
6035
|
+
},
|
|
6036
|
+
{
|
|
6037
|
+
faceColor: faceColors.yMinus,
|
|
6038
|
+
text: model.yMinusFaceProperty.text || 'A',
|
|
6039
|
+
textColor: parseFontColor(model.yMinusFaceProperty.fontColor || model.defaultStyle.fontColor),
|
|
6040
|
+
rotation: 180,
|
|
6041
|
+
},
|
|
6042
|
+
{
|
|
6043
|
+
faceColor: faceColors.yPlus,
|
|
6044
|
+
text: model.yPlusFaceProperty.text || 'P',
|
|
6045
|
+
textColor: parseFontColor(model.yPlusFaceProperty.fontColor || model.defaultStyle.fontColor),
|
|
6046
|
+
rotation: 180,
|
|
6047
|
+
},
|
|
6048
|
+
{
|
|
6049
|
+
faceColor: faceColors.xMinus,
|
|
6050
|
+
text: model.xMinusFaceProperty.text || 'L',
|
|
6051
|
+
textColor: parseFontColor(model.xMinusFaceProperty.fontColor || model.defaultStyle.fontColor),
|
|
6052
|
+
rotation: 90,
|
|
6053
|
+
flipVertical: true,
|
|
6054
|
+
},
|
|
6055
|
+
{
|
|
6056
|
+
faceColor: faceColors.xPlus,
|
|
6057
|
+
text: model.xPlusFaceProperty.text || 'R',
|
|
6058
|
+
textColor: parseFontColor(model.xPlusFaceProperty.fontColor || model.defaultStyle.fontColor),
|
|
6059
|
+
rotation: 90,
|
|
6060
|
+
},
|
|
6061
|
+
];
|
|
6062
|
+
const atlasImageData = createTextureAtlas(faceTextureData);
|
|
6063
|
+
const mainData = createMainFacesMesh(sourceScale, faceColors, null);
|
|
6064
|
+
if (mainData) {
|
|
6065
|
+
const mainFacesActor = Actor/* default.newInstance */.Ay.newInstance();
|
|
6066
|
+
const mainMapper = Mapper/* default.newInstance */.Ay.newInstance();
|
|
6067
|
+
mainMapper.setInputData(mainData);
|
|
6068
|
+
mainFacesActor.setMapper(mainMapper);
|
|
6069
|
+
const texture = Texture/* default.newInstance */.Ay.newInstance();
|
|
6070
|
+
texture.setInputData(atlasImageData);
|
|
6071
|
+
texture.setInterpolate(true);
|
|
6072
|
+
mainFacesActor.addTexture(texture);
|
|
6073
|
+
const property = mainFacesActor.getProperty();
|
|
6074
|
+
property.setBackfaceCulling(false);
|
|
6075
|
+
property.setFrontfaceCulling(false);
|
|
6076
|
+
property.setLighting(false);
|
|
6077
|
+
property.setAmbient(1.0);
|
|
6078
|
+
property.setDiffuse(0.0);
|
|
6079
|
+
property.setSpecular(0.0);
|
|
6080
|
+
actors.push(mainFacesActor);
|
|
6081
|
+
}
|
|
6082
|
+
}
|
|
6083
|
+
if (model.showEdgeFaces !== false) {
|
|
6084
|
+
const edgeColor = [200, 200, 200];
|
|
6085
|
+
const edgeData = createEdgeFacesMesh(sourceScale, edgeColor);
|
|
6086
|
+
if (edgeData) {
|
|
6087
|
+
const edgeFacesActor = Actor/* default.newInstance */.Ay.newInstance();
|
|
6088
|
+
const edgeMapper = Mapper/* default.newInstance */.Ay.newInstance();
|
|
6089
|
+
edgeMapper.setInputData(edgeData);
|
|
6090
|
+
edgeMapper.setScalarModeToUseCellData();
|
|
6091
|
+
edgeMapper.setScalarVisibility(true);
|
|
6092
|
+
edgeMapper.setColorModeToDirectScalars();
|
|
6093
|
+
edgeFacesActor.setMapper(edgeMapper);
|
|
6094
|
+
const edgeProperty = edgeFacesActor.getProperty();
|
|
6095
|
+
edgeProperty.setBackfaceCulling(false);
|
|
6096
|
+
edgeProperty.setFrontfaceCulling(false);
|
|
6097
|
+
edgeProperty.setLighting(false);
|
|
6098
|
+
edgeProperty.setAmbient(1.0);
|
|
6099
|
+
edgeProperty.setDiffuse(0.0);
|
|
6100
|
+
edgeProperty.setSpecular(0.0);
|
|
6101
|
+
actors.push(edgeFacesActor);
|
|
6102
|
+
}
|
|
6103
|
+
}
|
|
6104
|
+
if (model.showCornerFaces !== false) {
|
|
6105
|
+
const cornerColor = [150, 150, 150];
|
|
6106
|
+
const cornerData = createCornerFacesMesh(sourceScale, cornerColor);
|
|
6107
|
+
if (cornerData) {
|
|
6108
|
+
const cornerFacesActor = Actor/* default.newInstance */.Ay.newInstance();
|
|
6109
|
+
const cornerMapper = Mapper/* default.newInstance */.Ay.newInstance();
|
|
6110
|
+
cornerMapper.setInputData(cornerData);
|
|
6111
|
+
cornerMapper.setScalarModeToUseCellData();
|
|
6112
|
+
cornerMapper.setScalarVisibility(true);
|
|
6113
|
+
cornerMapper.setColorModeToDirectScalars();
|
|
6114
|
+
cornerFacesActor.setMapper(cornerMapper);
|
|
6115
|
+
const cornerProperty = cornerFacesActor.getProperty();
|
|
6116
|
+
cornerProperty.setBackfaceCulling(false);
|
|
6117
|
+
cornerProperty.setFrontfaceCulling(false);
|
|
6118
|
+
cornerProperty.setLighting(false);
|
|
6119
|
+
cornerProperty.setAmbient(1.0);
|
|
6120
|
+
cornerProperty.setDiffuse(0.0);
|
|
6121
|
+
cornerProperty.setSpecular(0.0);
|
|
6122
|
+
actors.push(cornerFacesActor);
|
|
6123
|
+
}
|
|
6124
|
+
}
|
|
6125
|
+
return actors;
|
|
6126
|
+
}
|
|
6127
|
+
publicAPI.setDefaultStyle = (style) => {
|
|
6128
|
+
model.defaultStyle = { ...model.defaultStyle, ...style };
|
|
6129
|
+
};
|
|
6130
|
+
publicAPI.setXPlusFaceProperty = (prop) => {
|
|
6131
|
+
Object.assign(model.xPlusFaceProperty, prop);
|
|
6132
|
+
publicAPI.modified();
|
|
6133
|
+
};
|
|
6134
|
+
publicAPI.setXMinusFaceProperty = (prop) => {
|
|
6135
|
+
Object.assign(model.xMinusFaceProperty, prop);
|
|
6136
|
+
publicAPI.modified();
|
|
6137
|
+
};
|
|
6138
|
+
publicAPI.setYPlusFaceProperty = (prop) => {
|
|
6139
|
+
Object.assign(model.yPlusFaceProperty, prop);
|
|
6140
|
+
publicAPI.modified();
|
|
6141
|
+
};
|
|
6142
|
+
publicAPI.setYMinusFaceProperty = (prop) => {
|
|
6143
|
+
Object.assign(model.yMinusFaceProperty, prop);
|
|
6144
|
+
publicAPI.modified();
|
|
6145
|
+
};
|
|
6146
|
+
publicAPI.setZPlusFaceProperty = (prop) => {
|
|
6147
|
+
Object.assign(model.zPlusFaceProperty, prop);
|
|
6148
|
+
publicAPI.modified();
|
|
6149
|
+
};
|
|
6150
|
+
publicAPI.setZMinusFaceProperty = (prop) => {
|
|
6151
|
+
Object.assign(model.zMinusFaceProperty, prop);
|
|
6152
|
+
publicAPI.modified();
|
|
6153
|
+
};
|
|
6154
|
+
publicAPI.setShowMainFaces = (show) => {
|
|
6155
|
+
if (model.showMainFaces !== show) {
|
|
6156
|
+
model.showMainFaces = show;
|
|
6157
|
+
updateAllFaceTextures();
|
|
6158
|
+
}
|
|
6159
|
+
};
|
|
6160
|
+
publicAPI.setShowEdgeFaces = (show) => {
|
|
6161
|
+
if (model.showEdgeFaces !== show) {
|
|
6162
|
+
model.showEdgeFaces = show;
|
|
6163
|
+
updateAllFaceTextures();
|
|
6164
|
+
}
|
|
6165
|
+
};
|
|
6166
|
+
publicAPI.setShowCornerFaces = (show) => {
|
|
6167
|
+
if (model.showCornerFaces !== show) {
|
|
6168
|
+
model.showCornerFaces = show;
|
|
6169
|
+
updateAllFaceTextures();
|
|
6170
|
+
}
|
|
6171
|
+
};
|
|
6172
|
+
publicAPI.setRhombScale = (scale) => {
|
|
6173
|
+
if (model.scale !== scale) {
|
|
6174
|
+
model.scale = scale;
|
|
6175
|
+
}
|
|
6176
|
+
};
|
|
6177
|
+
publicAPI.getActors = () => {
|
|
6178
|
+
return createActors();
|
|
6179
|
+
};
|
|
6180
|
+
}
|
|
6181
|
+
const AnnotatedRhombicuboctahedronActor_DEFAULT_VALUES = {
|
|
6182
|
+
defaultStyle: {
|
|
6183
|
+
text: '',
|
|
6184
|
+
faceColor: 'white',
|
|
6185
|
+
faceRotation: 0,
|
|
6186
|
+
fontFamily: 'Arial',
|
|
6187
|
+
fontColor: 'black',
|
|
6188
|
+
fontStyle: 'normal',
|
|
6189
|
+
fontSizeScale: (resolution) => resolution / 1.8,
|
|
6190
|
+
edgeThickness: 0.1,
|
|
6191
|
+
edgeColor: 'black',
|
|
6192
|
+
resolution: 200,
|
|
6193
|
+
},
|
|
6194
|
+
xPlusFaceProperty: {},
|
|
6195
|
+
xMinusFaceProperty: {},
|
|
6196
|
+
yPlusFaceProperty: {},
|
|
6197
|
+
yMinusFaceProperty: {},
|
|
6198
|
+
zPlusFaceProperty: {},
|
|
6199
|
+
zMinusFaceProperty: {},
|
|
6200
|
+
showMainFaces: true,
|
|
6201
|
+
showEdgeFaces: true,
|
|
6202
|
+
showCornerFaces: true,
|
|
6203
|
+
scale: 1.0,
|
|
6204
|
+
};
|
|
6205
|
+
function AnnotatedRhombicuboctahedronActor_extend(publicAPI, model, initialValues = {}) {
|
|
6206
|
+
Object.assign(model, AnnotatedRhombicuboctahedronActor_DEFAULT_VALUES, initialValues);
|
|
6207
|
+
Actor/* default.extend */.Ay.extend(publicAPI, model, initialValues);
|
|
6208
|
+
model.xPlusFaceProperty = { ...model.xPlusFaceProperty };
|
|
6209
|
+
model.xMinusFaceProperty = { ...model.xMinusFaceProperty };
|
|
6210
|
+
model.yPlusFaceProperty = { ...model.yPlusFaceProperty };
|
|
6211
|
+
model.yMinusFaceProperty = { ...model.yMinusFaceProperty };
|
|
6212
|
+
model.zPlusFaceProperty = { ...model.zPlusFaceProperty };
|
|
6213
|
+
model.zMinusFaceProperty = { ...model.zMinusFaceProperty };
|
|
6214
|
+
macros/* default.get */.Ay.get(publicAPI, model, [
|
|
6215
|
+
'defaultStyle',
|
|
6216
|
+
'xPlusFaceProperty',
|
|
6217
|
+
'xMinusFaceProperty',
|
|
6218
|
+
'yPlusFaceProperty',
|
|
6219
|
+
'yMinusFaceProperty',
|
|
6220
|
+
'zPlusFaceProperty',
|
|
6221
|
+
'zMinusFaceProperty',
|
|
6222
|
+
'showMainFaces',
|
|
6223
|
+
'showEdgeFaces',
|
|
6224
|
+
'showCornerFaces',
|
|
6225
|
+
'scale',
|
|
6226
|
+
]);
|
|
6227
|
+
vtkAnnotatedRhombicuboctahedronActor(publicAPI, model);
|
|
6228
|
+
}
|
|
6229
|
+
const AnnotatedRhombicuboctahedronActor_newInstance = macros/* default.newInstance */.Ay.newInstance(AnnotatedRhombicuboctahedronActor_extend, 'vtkAnnotatedRhombicuboctahedronActor');
|
|
6230
|
+
/* harmony default export */ const AnnotatedRhombicuboctahedronActor = ({ newInstance: AnnotatedRhombicuboctahedronActor_newInstance, extend: AnnotatedRhombicuboctahedronActor_extend });
|
|
6231
|
+
|
|
6232
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/vtkjs/OrientationControllerWidget/index.js
|
|
6233
|
+
|
|
6234
|
+
|
|
6235
|
+
|
|
6236
|
+
|
|
6237
|
+
class vtkOrientationControllerWidget {
|
|
6238
|
+
constructor() {
|
|
6239
|
+
this.actors = new Map();
|
|
6240
|
+
this.pickers = new Map();
|
|
6241
|
+
this.highlightedFace = null;
|
|
6242
|
+
this.mouseHandlers = new Map();
|
|
6243
|
+
}
|
|
6244
|
+
createActors(config) {
|
|
6245
|
+
const rgbToHex = (rgb) => {
|
|
6246
|
+
return `#${rgb
|
|
6247
|
+
.map((x) => {
|
|
6248
|
+
const hex = Math.round(x).toString(16);
|
|
6249
|
+
return hex.length === 1 ? '0' + hex : hex;
|
|
6250
|
+
})
|
|
6251
|
+
.join('')}`;
|
|
6252
|
+
};
|
|
6253
|
+
const rgbToHexColor = (rgb) => {
|
|
6254
|
+
return `rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`;
|
|
6255
|
+
};
|
|
6256
|
+
const actorFactory = AnnotatedRhombicuboctahedronActor.newInstance();
|
|
6257
|
+
const defaultStyle = {
|
|
6258
|
+
fontStyle: 'bold',
|
|
6259
|
+
fontFamily: 'Arial',
|
|
6260
|
+
fontColor: 'black',
|
|
6261
|
+
fontSizeScale: (res) => res / 2,
|
|
6262
|
+
faceColor: rgbToHex(config.faceColors.topBottom),
|
|
6263
|
+
edgeThickness: 0.1,
|
|
6264
|
+
edgeColor: 'black',
|
|
6265
|
+
resolution: 400,
|
|
6266
|
+
};
|
|
6267
|
+
actorFactory.setDefaultStyle(defaultStyle);
|
|
6268
|
+
actorFactory.setXPlusFaceProperty({
|
|
6269
|
+
text: 'L',
|
|
6270
|
+
faceColor: rgbToHex(config.faceColors.leftRight),
|
|
6271
|
+
fontColor: rgbToHexColor(config.letterColors.xPlus),
|
|
6272
|
+
faceRotation: 0,
|
|
6273
|
+
});
|
|
6274
|
+
actorFactory.setXMinusFaceProperty({
|
|
6275
|
+
text: 'R',
|
|
6276
|
+
faceColor: rgbToHex(config.faceColors.leftRight),
|
|
6277
|
+
fontColor: rgbToHexColor(config.letterColors.xMinus),
|
|
6278
|
+
faceRotation: 0,
|
|
6279
|
+
});
|
|
6280
|
+
actorFactory.setYPlusFaceProperty({
|
|
6281
|
+
text: 'P',
|
|
6282
|
+
faceColor: rgbToHex(config.faceColors.frontBack),
|
|
6283
|
+
fontColor: rgbToHexColor(config.letterColors.yPlus),
|
|
6284
|
+
faceRotation: 180,
|
|
6285
|
+
});
|
|
6286
|
+
actorFactory.setYMinusFaceProperty({
|
|
6287
|
+
text: 'A',
|
|
6288
|
+
faceColor: rgbToHex(config.faceColors.frontBack),
|
|
6289
|
+
fontColor: rgbToHexColor(config.letterColors.yMinus),
|
|
6290
|
+
faceRotation: 0,
|
|
6291
|
+
});
|
|
6292
|
+
actorFactory.setZPlusFaceProperty({
|
|
6293
|
+
text: 'S',
|
|
6294
|
+
faceColor: rgbToHex(config.faceColors.topBottom),
|
|
6295
|
+
fontColor: rgbToHexColor(config.letterColors.zPlus),
|
|
6296
|
+
});
|
|
6297
|
+
actorFactory.setZMinusFaceProperty({
|
|
6298
|
+
text: 'I',
|
|
6299
|
+
faceColor: rgbToHex(config.faceColors.topBottom),
|
|
6300
|
+
fontColor: rgbToHexColor(config.letterColors.zMinus),
|
|
6301
|
+
});
|
|
6302
|
+
actorFactory.setShowMainFaces(true);
|
|
6303
|
+
actorFactory.setShowEdgeFaces(config.showEdgeFaces);
|
|
6304
|
+
actorFactory.setShowCornerFaces(config.showCornerFaces);
|
|
6305
|
+
const actors = actorFactory.getActors();
|
|
6306
|
+
actors.forEach((actor) => {
|
|
6307
|
+
const property = actor.getProperty();
|
|
6308
|
+
property.setOpacity(config.opacity);
|
|
6309
|
+
actor.setVisibility(true);
|
|
6310
|
+
});
|
|
6311
|
+
return actors;
|
|
6312
|
+
}
|
|
6313
|
+
addActorsToViewport(viewportId, viewport, actors) {
|
|
6314
|
+
const existingActors = this.actors.get(viewportId);
|
|
6315
|
+
if (existingActors) {
|
|
6316
|
+
this.removeActorsFromViewport(viewportId, viewport);
|
|
6317
|
+
}
|
|
6318
|
+
actors.forEach((actor, index) => {
|
|
6319
|
+
const uid = `orientation-controller-${viewportId}-${index}`;
|
|
6320
|
+
viewport.addActor({ actor, uid });
|
|
6321
|
+
});
|
|
6322
|
+
this.actors.set(viewportId, actors);
|
|
6323
|
+
}
|
|
6324
|
+
removeActorsFromViewport(viewportId, viewport) {
|
|
6325
|
+
const actors = this.actors.get(viewportId);
|
|
6326
|
+
if (actors) {
|
|
6327
|
+
const uids = actors.map((_, index) => `orientation-controller-${viewportId}-${index}`);
|
|
6328
|
+
viewport.removeActors(uids);
|
|
6329
|
+
this.actors.delete(viewportId);
|
|
6330
|
+
}
|
|
6331
|
+
}
|
|
6332
|
+
setupPicker(viewportId, actors) {
|
|
6333
|
+
const picker = vtkCellPicker$1.newInstance({ opacityThreshold: 0.0001 });
|
|
6334
|
+
picker.setPickFromList(true);
|
|
6335
|
+
picker.setTolerance(0.001);
|
|
6336
|
+
picker.initializePickList();
|
|
6337
|
+
actors.forEach((actor) => {
|
|
6338
|
+
picker.addPickList(actor);
|
|
6339
|
+
});
|
|
6340
|
+
this.pickers.set(viewportId, picker);
|
|
6341
|
+
return picker;
|
|
6342
|
+
}
|
|
6343
|
+
pickAtPosition(evt, viewportId, viewport, element, actors) {
|
|
6344
|
+
const picker = this.pickers.get(viewportId);
|
|
6345
|
+
if (!picker) {
|
|
6346
|
+
return null;
|
|
6347
|
+
}
|
|
6348
|
+
const mainRenderer = viewport
|
|
6349
|
+
.getRenderingEngine()
|
|
6350
|
+
?.getRenderer(viewportId) ?? viewport.getRenderer();
|
|
6351
|
+
const renderer = mainRenderer;
|
|
6352
|
+
if (!renderer) {
|
|
6353
|
+
return null;
|
|
6354
|
+
}
|
|
6355
|
+
const rect = element.getBoundingClientRect();
|
|
6356
|
+
const x = evt.clientX - rect.left;
|
|
6357
|
+
const y = evt.clientY - rect.top;
|
|
6358
|
+
const devicePixelRatio = window.devicePixelRatio || 1;
|
|
6359
|
+
const canvasPosWithDPR = [x * devicePixelRatio, y * devicePixelRatio];
|
|
6360
|
+
const canvas = viewport.canvas;
|
|
6361
|
+
const { width, height } = canvas;
|
|
6362
|
+
const [xMin, yMin, xMax, yMax] = renderer.getViewport();
|
|
6363
|
+
const viewportWidth = xMax - xMin;
|
|
6364
|
+
const viewportHeight = yMax - yMin;
|
|
6365
|
+
const scaledX = (canvasPosWithDPR[0] / width) * viewportWidth * width;
|
|
6366
|
+
const scaledY = (canvasPosWithDPR[1] / height) * viewportHeight * height;
|
|
6367
|
+
const displayCoord = [scaledX, viewportHeight * height - scaledY];
|
|
6368
|
+
const displayCoords = [
|
|
6369
|
+
displayCoord[0],
|
|
6370
|
+
displayCoord[1],
|
|
6371
|
+
0,
|
|
6372
|
+
];
|
|
6373
|
+
picker.pick(displayCoords, renderer);
|
|
6374
|
+
const pickedActors = picker.getActors();
|
|
6375
|
+
if (pickedActors.length === 0) {
|
|
6376
|
+
return null;
|
|
6377
|
+
}
|
|
6378
|
+
const pickedActor = pickedActors[0];
|
|
6379
|
+
const cellId = picker.getCellId();
|
|
6380
|
+
if (actors.includes(pickedActor) && cellId !== -1) {
|
|
6381
|
+
const actorIndex = actors.indexOf(pickedActor);
|
|
6382
|
+
return { pickedActor, cellId, actorIndex };
|
|
6383
|
+
}
|
|
6384
|
+
return null;
|
|
6385
|
+
}
|
|
6386
|
+
calculateMarkerPosition(viewport, position) {
|
|
6387
|
+
const canvas = viewport.canvas;
|
|
6388
|
+
if (!canvas) {
|
|
6389
|
+
return null;
|
|
6390
|
+
}
|
|
6391
|
+
const devicePixelRatio = window.devicePixelRatio || 1;
|
|
6392
|
+
const canvasWidth = canvas.clientWidth || canvas.width / devicePixelRatio;
|
|
6393
|
+
const canvasHeight = canvas.clientHeight || canvas.height / devicePixelRatio;
|
|
6394
|
+
const cornerOffset = viewport.type === dist_esm.Enums.ViewportType.VOLUME_3D ? 55 : 35;
|
|
6395
|
+
let canvasX;
|
|
6396
|
+
let canvasY;
|
|
6397
|
+
switch (position) {
|
|
6398
|
+
case 'top-left':
|
|
6399
|
+
canvasX = cornerOffset;
|
|
6400
|
+
canvasY = cornerOffset;
|
|
6401
|
+
break;
|
|
6402
|
+
case 'top-right':
|
|
6403
|
+
canvasX = canvasWidth - cornerOffset;
|
|
6404
|
+
canvasY = cornerOffset;
|
|
6405
|
+
break;
|
|
6406
|
+
case 'bottom-left':
|
|
6407
|
+
canvasX = cornerOffset;
|
|
6408
|
+
canvasY = canvasHeight - cornerOffset;
|
|
6409
|
+
break;
|
|
6410
|
+
default:
|
|
6411
|
+
canvasX = canvasWidth - cornerOffset;
|
|
6412
|
+
canvasY = canvasHeight - cornerOffset;
|
|
6413
|
+
}
|
|
6414
|
+
const canvasPos = [canvasX, canvasY];
|
|
6415
|
+
const worldPos = viewport.canvasToWorld(canvasPos);
|
|
6416
|
+
return [worldPos[0], worldPos[1], worldPos[2]];
|
|
6417
|
+
}
|
|
6418
|
+
positionActors(viewport, actors, config) {
|
|
6419
|
+
const canvas = viewport.canvas;
|
|
6420
|
+
if (!canvas) {
|
|
6421
|
+
console.warn('OrientationControllerWidget: No canvas available');
|
|
6422
|
+
return false;
|
|
6423
|
+
}
|
|
6424
|
+
const mainRenderer = viewport
|
|
6425
|
+
.getRenderingEngine()
|
|
6426
|
+
?.getRenderer(viewport.id) ?? viewport.getRenderer();
|
|
6427
|
+
const camera = mainRenderer?.getActiveCamera();
|
|
6428
|
+
if (!camera) {
|
|
6429
|
+
return false;
|
|
6430
|
+
}
|
|
6431
|
+
const parallelScale = camera.getParallelScale();
|
|
6432
|
+
const worldHeight = parallelScale * 2;
|
|
6433
|
+
const devicePixelRatio = window.devicePixelRatio || 1;
|
|
6434
|
+
const canvasHeight = canvas.clientHeight || canvas.height / devicePixelRatio;
|
|
6435
|
+
const canvasWidth = canvas.clientWidth || canvas.width / devicePixelRatio;
|
|
6436
|
+
const worldUnitsPerPixel = worldHeight / canvasHeight;
|
|
6437
|
+
const canvasSize = Math.min(canvasWidth, canvasHeight);
|
|
6438
|
+
const screenSizePixels = canvasSize * config.size;
|
|
6439
|
+
const markerSize = screenSizePixels * worldUnitsPerPixel;
|
|
6440
|
+
actors.forEach((actor) => {
|
|
6441
|
+
actor.setScale(markerSize, markerSize, markerSize);
|
|
6442
|
+
const worldPos = this.calculateMarkerPosition(viewport, config.position);
|
|
6443
|
+
if (!worldPos) {
|
|
6444
|
+
console.warn('OrientationControllerWidget: Could not get world position');
|
|
6445
|
+
return;
|
|
6446
|
+
}
|
|
6447
|
+
actor.setPosition(worldPos[0], worldPos[1], worldPos[2]);
|
|
6448
|
+
actor.setOrientation(0, 0, 0);
|
|
6449
|
+
});
|
|
6450
|
+
return true;
|
|
6451
|
+
}
|
|
6452
|
+
highlightFace(actor, cellId, viewport, isMainFace = false) {
|
|
6453
|
+
if (this.highlightedFace &&
|
|
6454
|
+
this.highlightedFace.actor === actor &&
|
|
6455
|
+
this.highlightedFace.cellId === cellId &&
|
|
6456
|
+
this.highlightedFace.isMainFace === isMainFace) {
|
|
6457
|
+
return;
|
|
6458
|
+
}
|
|
6459
|
+
this.clearHighlight();
|
|
6460
|
+
if (isMainFace) {
|
|
6461
|
+
return;
|
|
6462
|
+
}
|
|
6463
|
+
const mapper = actor.getMapper();
|
|
6464
|
+
const inputData = mapper.getInputData();
|
|
6465
|
+
if (!inputData) {
|
|
6466
|
+
return;
|
|
6467
|
+
}
|
|
6468
|
+
const cellData = inputData.getCellData();
|
|
6469
|
+
const colors = cellData.getScalars();
|
|
6470
|
+
if (!colors) {
|
|
6471
|
+
return;
|
|
6472
|
+
}
|
|
6473
|
+
const colorArray = colors.getData();
|
|
6474
|
+
const offset = cellId * 4;
|
|
6475
|
+
const originalColor = [
|
|
6476
|
+
colorArray[offset],
|
|
6477
|
+
colorArray[offset + 1],
|
|
6478
|
+
colorArray[offset + 2],
|
|
6479
|
+
colorArray[offset + 3],
|
|
6480
|
+
];
|
|
6481
|
+
this.highlightedFace = {
|
|
6482
|
+
actor,
|
|
6483
|
+
cellId,
|
|
6484
|
+
originalColor,
|
|
6485
|
+
viewport,
|
|
6486
|
+
isMainFace: false,
|
|
6487
|
+
};
|
|
6488
|
+
colorArray[offset] = 255;
|
|
6489
|
+
colorArray[offset + 1] = 255;
|
|
6490
|
+
colorArray[offset + 2] = 255;
|
|
6491
|
+
colorArray[offset + 3] = 255;
|
|
6492
|
+
colors.modified();
|
|
6493
|
+
inputData.modified();
|
|
6494
|
+
viewport.render();
|
|
6495
|
+
}
|
|
6496
|
+
clearHighlight() {
|
|
6497
|
+
if (!this.highlightedFace) {
|
|
6498
|
+
return;
|
|
6499
|
+
}
|
|
6500
|
+
const { actor, cellId, originalColor, viewport, isMainFace } = this.highlightedFace;
|
|
6501
|
+
if (isMainFace && this.highlightedFace.originalScale) {
|
|
6502
|
+
const scale = this.highlightedFace.originalScale;
|
|
6503
|
+
actor.setScale(scale[0], scale[1], scale[2]);
|
|
6504
|
+
viewport.render();
|
|
6505
|
+
this.highlightedFace = null;
|
|
6506
|
+
return;
|
|
6507
|
+
}
|
|
6508
|
+
const mapper = actor.getMapper();
|
|
6509
|
+
const inputData = mapper.getInputData();
|
|
6510
|
+
if (!inputData) {
|
|
6511
|
+
this.highlightedFace = null;
|
|
6512
|
+
return;
|
|
6513
|
+
}
|
|
6514
|
+
const cellData = inputData.getCellData();
|
|
6515
|
+
const colors = cellData.getScalars();
|
|
6516
|
+
if (!colors) {
|
|
6517
|
+
this.highlightedFace = null;
|
|
6518
|
+
return;
|
|
6519
|
+
}
|
|
6520
|
+
const colorArray = colors.getData();
|
|
6521
|
+
const offset = cellId * 4;
|
|
6522
|
+
colorArray[offset] = originalColor[0];
|
|
6523
|
+
colorArray[offset + 1] = originalColor[1];
|
|
6524
|
+
colorArray[offset + 2] = originalColor[2];
|
|
6525
|
+
colorArray[offset + 3] = originalColor[3];
|
|
6526
|
+
colors.modified();
|
|
6527
|
+
inputData.modified();
|
|
6528
|
+
viewport.render();
|
|
6529
|
+
this.highlightedFace = null;
|
|
6530
|
+
}
|
|
6531
|
+
setupMouseHandlers(viewportId, element, viewport, actors, callbacks) {
|
|
6532
|
+
let isMouseDown = false;
|
|
6533
|
+
const hoverHandler = (evt) => {
|
|
6534
|
+
if (isMouseDown) {
|
|
6535
|
+
return;
|
|
6536
|
+
}
|
|
6537
|
+
const pickResult = this.pickAtPosition(evt, viewportId, viewport, element, actors);
|
|
6538
|
+
if (pickResult) {
|
|
6539
|
+
const { pickedActor, cellId, actorIndex } = pickResult;
|
|
6540
|
+
if (actorIndex !== 0) {
|
|
6541
|
+
this.highlightFace(pickedActor, cellId, viewport, false);
|
|
6542
|
+
}
|
|
6543
|
+
if (callbacks.onFaceHover) {
|
|
6544
|
+
callbacks.onFaceHover(pickResult);
|
|
6545
|
+
}
|
|
6546
|
+
}
|
|
6547
|
+
else {
|
|
6548
|
+
this.clearHighlight();
|
|
6549
|
+
if (callbacks.onFaceHover) {
|
|
6550
|
+
callbacks.onFaceHover(null);
|
|
6551
|
+
}
|
|
6552
|
+
}
|
|
6553
|
+
};
|
|
6554
|
+
const clickHandler = (evt) => {
|
|
6555
|
+
if (evt.button !== 0) {
|
|
6556
|
+
return;
|
|
6557
|
+
}
|
|
6558
|
+
const pickResult = this.pickAtPosition(evt, viewportId, viewport, element, actors);
|
|
6559
|
+
if (!pickResult) {
|
|
6560
|
+
return;
|
|
6561
|
+
}
|
|
6562
|
+
isMouseDown = true;
|
|
6563
|
+
let globalCellId = pickResult.cellId;
|
|
6564
|
+
if (pickResult.actorIndex === 1) {
|
|
6565
|
+
globalCellId = pickResult.cellId + 6;
|
|
6566
|
+
}
|
|
6567
|
+
else if (pickResult.actorIndex === 2) {
|
|
6568
|
+
globalCellId = pickResult.cellId + 18;
|
|
6569
|
+
}
|
|
6570
|
+
callbacks.onFacePicked({
|
|
6571
|
+
...pickResult,
|
|
6572
|
+
cellId: globalCellId,
|
|
6573
|
+
});
|
|
6574
|
+
evt.preventDefault();
|
|
6575
|
+
evt.stopPropagation();
|
|
6576
|
+
};
|
|
6577
|
+
const mouseUpHandler = () => {
|
|
6578
|
+
isMouseDown = false;
|
|
6579
|
+
this.clearHighlight();
|
|
6580
|
+
};
|
|
6581
|
+
const dblclickHandler = (evt) => {
|
|
6582
|
+
const pickResult = this.pickAtPosition(evt, viewportId, viewport, element, actors);
|
|
6583
|
+
if (pickResult) {
|
|
6584
|
+
evt.preventDefault();
|
|
6585
|
+
evt.stopImmediatePropagation();
|
|
6586
|
+
}
|
|
6587
|
+
};
|
|
6588
|
+
element.addEventListener('mousemove', hoverHandler);
|
|
6589
|
+
element.addEventListener('mousedown', clickHandler);
|
|
6590
|
+
element.addEventListener('mouseup', mouseUpHandler);
|
|
6591
|
+
element.addEventListener('mouseleave', mouseUpHandler);
|
|
6592
|
+
element.addEventListener('dblclick', dblclickHandler, true);
|
|
6593
|
+
const cleanup = () => {
|
|
6594
|
+
element.removeEventListener('mousemove', hoverHandler);
|
|
6595
|
+
element.removeEventListener('mousedown', clickHandler);
|
|
6596
|
+
element.removeEventListener('mouseup', mouseUpHandler);
|
|
6597
|
+
element.removeEventListener('mouseleave', mouseUpHandler);
|
|
6598
|
+
element.removeEventListener('dblclick', dblclickHandler, true);
|
|
6599
|
+
};
|
|
6600
|
+
this.mouseHandlers.set(viewportId, { cleanup });
|
|
6601
|
+
return { cleanup };
|
|
6602
|
+
}
|
|
6603
|
+
getActors(viewportId) {
|
|
6604
|
+
return this.actors.get(viewportId);
|
|
6605
|
+
}
|
|
6606
|
+
syncOverlayViewport(_viewportId, _viewport) {
|
|
6607
|
+
}
|
|
6608
|
+
getOrientationForFace(cellId) {
|
|
6609
|
+
const orientations = new Map();
|
|
6610
|
+
orientations.set(0, { viewPlaneNormal: [0, 0, -1], viewUp: [0, -1, 0] });
|
|
6611
|
+
orientations.set(1, { viewPlaneNormal: [0, 0, 1], viewUp: [0, 1, 0] });
|
|
6612
|
+
orientations.set(2, { viewPlaneNormal: [0, -1, 0], viewUp: [0, 0, 1] });
|
|
6613
|
+
orientations.set(3, { viewPlaneNormal: [0, 1, 0], viewUp: [0, 0, 1] });
|
|
6614
|
+
orientations.set(4, { viewPlaneNormal: [-1, 0, 0], viewUp: [0, 0, 1] });
|
|
6615
|
+
orientations.set(5, { viewPlaneNormal: [1, 0, 0], viewUp: [0, 0, 1] });
|
|
6616
|
+
const sqrt2 = 1 / Math.sqrt(2);
|
|
6617
|
+
orientations.set(6, {
|
|
6618
|
+
viewPlaneNormal: [0, -sqrt2, -sqrt2],
|
|
6619
|
+
viewUp: [0, -sqrt2, sqrt2],
|
|
6620
|
+
});
|
|
6621
|
+
orientations.set(7, {
|
|
6622
|
+
viewPlaneNormal: [sqrt2, 0, -sqrt2],
|
|
6623
|
+
viewUp: [0, 0, 1],
|
|
6624
|
+
});
|
|
6625
|
+
orientations.set(8, {
|
|
6626
|
+
viewPlaneNormal: [0, sqrt2, -sqrt2],
|
|
6627
|
+
viewUp: [0, -sqrt2, -sqrt2],
|
|
6628
|
+
});
|
|
6629
|
+
orientations.set(9, {
|
|
6630
|
+
viewPlaneNormal: [-sqrt2, 0, -sqrt2],
|
|
6631
|
+
viewUp: [0, 0, 1],
|
|
6632
|
+
});
|
|
6633
|
+
orientations.set(10, {
|
|
6634
|
+
viewPlaneNormal: [0, -sqrt2, sqrt2],
|
|
6635
|
+
viewUp: [0, sqrt2, sqrt2],
|
|
6636
|
+
});
|
|
6637
|
+
orientations.set(11, {
|
|
6638
|
+
viewPlaneNormal: [sqrt2, 0, sqrt2],
|
|
6639
|
+
viewUp: [0, 0, 1],
|
|
6640
|
+
});
|
|
6641
|
+
orientations.set(12, {
|
|
6642
|
+
viewPlaneNormal: [0, sqrt2, sqrt2],
|
|
6643
|
+
viewUp: [0, sqrt2, -sqrt2],
|
|
6644
|
+
});
|
|
6645
|
+
orientations.set(13, {
|
|
6646
|
+
viewPlaneNormal: [-sqrt2, 0, sqrt2],
|
|
6647
|
+
viewUp: [0, 0, 1],
|
|
6648
|
+
});
|
|
6649
|
+
orientations.set(14, {
|
|
6650
|
+
viewPlaneNormal: [-sqrt2, -sqrt2, 0],
|
|
6651
|
+
viewUp: [0, 0, 1],
|
|
6652
|
+
});
|
|
6653
|
+
orientations.set(15, {
|
|
6654
|
+
viewPlaneNormal: [sqrt2, -sqrt2, 0],
|
|
6655
|
+
viewUp: [0, 0, 1],
|
|
6656
|
+
});
|
|
6657
|
+
orientations.set(16, {
|
|
6658
|
+
viewPlaneNormal: [sqrt2, sqrt2, 0],
|
|
6659
|
+
viewUp: [0, 0, 1],
|
|
6660
|
+
});
|
|
6661
|
+
orientations.set(17, {
|
|
6662
|
+
viewPlaneNormal: [-sqrt2, sqrt2, 0],
|
|
6663
|
+
viewUp: [0, 0, 1],
|
|
6664
|
+
});
|
|
6665
|
+
const sqrt3 = 1 / Math.sqrt(3);
|
|
6666
|
+
orientations.set(18, {
|
|
6667
|
+
viewPlaneNormal: [-sqrt3, -sqrt3, -sqrt3],
|
|
6668
|
+
viewUp: [0, 0, 1],
|
|
6669
|
+
});
|
|
6670
|
+
orientations.set(19, {
|
|
6671
|
+
viewPlaneNormal: [sqrt3, -sqrt3, -sqrt3],
|
|
6672
|
+
viewUp: [0, 0, 1],
|
|
6673
|
+
});
|
|
6674
|
+
orientations.set(20, {
|
|
6675
|
+
viewPlaneNormal: [sqrt3, sqrt3, -sqrt3],
|
|
6676
|
+
viewUp: [0, 0, 1],
|
|
6677
|
+
});
|
|
6678
|
+
orientations.set(21, {
|
|
6679
|
+
viewPlaneNormal: [-sqrt3, sqrt3, -sqrt3],
|
|
6680
|
+
viewUp: [0, 0, 1],
|
|
6681
|
+
});
|
|
6682
|
+
orientations.set(22, {
|
|
6683
|
+
viewPlaneNormal: [-sqrt3, -sqrt3, sqrt3],
|
|
6684
|
+
viewUp: [0, 0, 1],
|
|
6685
|
+
});
|
|
6686
|
+
orientations.set(23, {
|
|
6687
|
+
viewPlaneNormal: [sqrt3, -sqrt3, sqrt3],
|
|
6688
|
+
viewUp: [0, 0, 1],
|
|
6689
|
+
});
|
|
6690
|
+
orientations.set(24, {
|
|
6691
|
+
viewPlaneNormal: [sqrt3, sqrt3, sqrt3],
|
|
6692
|
+
viewUp: [0, 0, 1],
|
|
6693
|
+
});
|
|
6694
|
+
orientations.set(25, {
|
|
6695
|
+
viewPlaneNormal: [-sqrt3, sqrt3, sqrt3],
|
|
6696
|
+
viewUp: [0, 0, 1],
|
|
6697
|
+
});
|
|
6698
|
+
return orientations.get(cellId) || null;
|
|
6699
|
+
}
|
|
6700
|
+
cleanup(viewportId) {
|
|
6701
|
+
if (viewportId) {
|
|
6702
|
+
const handler = this.mouseHandlers.get(viewportId);
|
|
6703
|
+
if (handler) {
|
|
6704
|
+
handler.cleanup();
|
|
6705
|
+
this.mouseHandlers.delete(viewportId);
|
|
6706
|
+
}
|
|
6707
|
+
this.actors.delete(viewportId);
|
|
6708
|
+
this.pickers.delete(viewportId);
|
|
6709
|
+
}
|
|
6710
|
+
else {
|
|
6711
|
+
this.mouseHandlers.forEach((handler) => handler.cleanup());
|
|
6712
|
+
this.mouseHandlers.clear();
|
|
6713
|
+
this.actors.clear();
|
|
6714
|
+
this.pickers.clear();
|
|
6715
|
+
}
|
|
6716
|
+
this.clearHighlight();
|
|
6717
|
+
}
|
|
6718
|
+
}
|
|
6719
|
+
|
|
6720
|
+
|
|
6721
|
+
/***/ },
|
|
6722
|
+
|
|
6723
|
+
/***/ 44845
|
|
6724
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
6725
|
+
|
|
6726
|
+
"use strict";
|
|
6727
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6728
|
+
/* harmony export */ A: () => (/* binding */ Widget)
|
|
6729
|
+
/* harmony export */ });
|
|
6730
|
+
/* unused harmony export Widget */
|
|
6731
|
+
class Widget {
|
|
6732
|
+
constructor({ id, container }) {
|
|
6733
|
+
this._containerResizeCallback = (entries) => {
|
|
6734
|
+
let width;
|
|
6735
|
+
let height;
|
|
6736
|
+
const { contentRect, contentBoxSize } = entries[0];
|
|
6737
|
+
if (contentRect) {
|
|
6738
|
+
width = contentRect.width;
|
|
6739
|
+
height = contentRect.height;
|
|
6740
|
+
}
|
|
6741
|
+
else if (contentBoxSize?.length) {
|
|
6742
|
+
width = contentBoxSize[0].inlineSize;
|
|
6743
|
+
height = contentBoxSize[0].blockSize;
|
|
6744
|
+
}
|
|
6745
|
+
this._containerSize = { width, height };
|
|
6746
|
+
this.onContainerResize();
|
|
6747
|
+
};
|
|
6748
|
+
this._id = id;
|
|
6749
|
+
this._containerSize = { width: 0, height: 0 };
|
|
6750
|
+
this._rootElement = this.createRootElement(id);
|
|
6751
|
+
this._containerResizeObserver = new ResizeObserver(this._containerResizeCallback);
|
|
6752
|
+
if (container) {
|
|
6753
|
+
this.appendTo(container);
|
|
6754
|
+
}
|
|
6755
|
+
}
|
|
6756
|
+
get id() {
|
|
6757
|
+
return this._id;
|
|
6758
|
+
}
|
|
6759
|
+
get rootElement() {
|
|
6760
|
+
return this._rootElement;
|
|
6761
|
+
}
|
|
6762
|
+
appendTo(container) {
|
|
6763
|
+
const { _rootElement: rootElement, _containerResizeObserver: resizeObserver, } = this;
|
|
6764
|
+
const { parentElement: currentContainer } = rootElement;
|
|
6765
|
+
if (!container || container === currentContainer) {
|
|
6766
|
+
return;
|
|
6767
|
+
}
|
|
6768
|
+
if (currentContainer) {
|
|
6769
|
+
resizeObserver.unobserve(currentContainer);
|
|
6770
|
+
}
|
|
6771
|
+
container.appendChild(rootElement);
|
|
6772
|
+
resizeObserver.observe(container);
|
|
6773
|
+
}
|
|
6774
|
+
destroy() {
|
|
6775
|
+
const { _rootElement: rootElement, _containerResizeObserver: resizeObserver, } = this;
|
|
6776
|
+
const { parentElement } = rootElement;
|
|
6777
|
+
parentElement?.removeChild(rootElement);
|
|
6778
|
+
resizeObserver.disconnect();
|
|
6779
|
+
}
|
|
6780
|
+
get containerSize() {
|
|
6781
|
+
return { ...this._containerSize };
|
|
6782
|
+
}
|
|
6783
|
+
createRootElement(id) {
|
|
6784
|
+
const rootElement = document.createElement('div');
|
|
6785
|
+
rootElement.id = id;
|
|
6786
|
+
rootElement.classList.add('widget');
|
|
6787
|
+
Object.assign(rootElement.style, {
|
|
6788
|
+
width: '100%',
|
|
6789
|
+
height: '100%',
|
|
6790
|
+
});
|
|
6791
|
+
return rootElement;
|
|
6792
|
+
}
|
|
6793
|
+
onContainerResize() {
|
|
6794
|
+
}
|
|
6795
|
+
}
|
|
6796
|
+
|
|
6797
|
+
|
|
6798
|
+
|
|
6799
|
+
/***/ },
|
|
6800
|
+
|
|
6801
|
+
/***/ 74821
|
|
6802
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
6803
|
+
|
|
6804
|
+
"use strict";
|
|
6805
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6806
|
+
/* harmony export */ A: () => (/* binding */ ImageHelper)
|
|
6807
|
+
/* harmony export */ });
|
|
6808
|
+
/* harmony import */ var _DataModel_ImageData_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26393);
|
|
6809
|
+
/* harmony import */ var _DataArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(445);
|
|
6810
|
+
|
|
6811
|
+
|
|
6812
|
+
|
|
6813
|
+
/**
|
|
6814
|
+
* Takes a canvas and converts it to a vtkImageData.
|
|
6815
|
+
*
|
|
6816
|
+
* Optionally supply a bounding box to get a particular subset of the canvas.
|
|
6817
|
+
*
|
|
6818
|
+
* @param canvas The HTML canvas to convert
|
|
6819
|
+
* @param boundingBox A bounding box of type [top, left, width, height]
|
|
6820
|
+
*/
|
|
6821
|
+
function canvasToImageData(canvas) {
|
|
6822
|
+
let boundingBox = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0, 0];
|
|
6823
|
+
const [top, left, width, height] = boundingBox;
|
|
6824
|
+
const ctxt = canvas.getContext('2d');
|
|
6825
|
+
const idata = ctxt.getImageData(top, left, width || canvas.width, height || canvas.height);
|
|
6826
|
+
const imageData = _DataModel_ImageData_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].newInstance */ .Ay.newInstance({
|
|
6827
|
+
type: 'vtkImageData'
|
|
6828
|
+
});
|
|
6829
|
+
imageData.setOrigin(0, 0, 0);
|
|
6830
|
+
imageData.setSpacing(1, 1, 1);
|
|
6831
|
+
imageData.setExtent(0, (width || canvas.width) - 1, 0, (height || canvas.height) - 1, 0, 0);
|
|
6832
|
+
const scalars = _DataArray_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"].newInstance */ .Ay.newInstance({
|
|
6833
|
+
numberOfComponents: 4,
|
|
6834
|
+
values: new Uint8Array(idata.data.buffer)
|
|
6835
|
+
});
|
|
6836
|
+
scalars.setName('scalars');
|
|
6837
|
+
imageData.getPointData().setScalars(scalars);
|
|
6838
|
+
return imageData;
|
|
6839
|
+
}
|
|
6840
|
+
|
|
6841
|
+
/**
|
|
6842
|
+
* Converts an Image object to a vtkImageData.
|
|
6843
|
+
*/
|
|
6844
|
+
function imageToImageData(image) {
|
|
6845
|
+
let transform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
6846
|
+
flipX: false,
|
|
6847
|
+
flipY: false,
|
|
6848
|
+
rotate: 0
|
|
6849
|
+
};
|
|
6850
|
+
const canvas = document.createElement('canvas');
|
|
6851
|
+
canvas.width = image.width;
|
|
6852
|
+
canvas.height = image.height;
|
|
6853
|
+
const ctx = canvas.getContext('2d');
|
|
6854
|
+
const {
|
|
6855
|
+
flipX,
|
|
6856
|
+
flipY,
|
|
6857
|
+
rotate
|
|
6858
|
+
} = transform;
|
|
6859
|
+
ctx.translate(canvas.width / 2, canvas.height / 2);
|
|
6860
|
+
ctx.scale(flipX ? -1 : 1, flipY ? -1 : 1);
|
|
6861
|
+
ctx.rotate(rotate * Math.PI / 180);
|
|
6862
|
+
ctx.drawImage(image, -image.width / 2, -image.height / 2);
|
|
6863
|
+
return canvasToImageData(canvas);
|
|
6864
|
+
}
|
|
6865
|
+
var ImageHelper = {
|
|
6866
|
+
canvasToImageData,
|
|
6867
|
+
imageToImageData
|
|
6868
|
+
};
|
|
6869
|
+
|
|
6870
|
+
|
|
6871
|
+
|
|
6872
|
+
|
|
6873
|
+
/***/ },
|
|
6874
|
+
|
|
6875
|
+
/***/ 73435
|
|
6876
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
6877
|
+
|
|
6878
|
+
"use strict";
|
|
6879
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6880
|
+
/* harmony export */ Ay: () => (/* binding */ vtkSphereSource$1)
|
|
6881
|
+
/* harmony export */ });
|
|
6882
|
+
/* unused harmony exports extend, newInstance */
|
|
6883
|
+
/* harmony import */ var _macros2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(90027);
|
|
6884
|
+
/* harmony import */ var _Common_DataModel_PolyData_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27480);
|
|
6885
|
+
/* harmony import */ var _Common_Core_DataArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(445);
|
|
6886
|
+
|
|
6887
|
+
|
|
6888
|
+
|
|
6889
|
+
|
|
6890
|
+
// ----------------------------------------------------------------------------
|
|
6891
|
+
// vtkSphereSource methods
|
|
6892
|
+
// ----------------------------------------------------------------------------
|
|
6893
|
+
|
|
6894
|
+
function vtkSphereSource(publicAPI, model) {
|
|
6895
|
+
// Set our className
|
|
6896
|
+
model.classHierarchy.push('vtkSphereSource');
|
|
6897
|
+
publicAPI.requestData = (inData, outData) => {
|
|
6898
|
+
let dataset = outData[0];
|
|
6899
|
+
const pointDataType = dataset ? dataset.getPoints().getDataType() : model.pointType;
|
|
6900
|
+
dataset = dataset?.initialize() || _Common_DataModel_PolyData_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"].newInstance */ .Ay.newInstance();
|
|
6901
|
+
|
|
6902
|
+
// ----------------------------------------------------------------------
|
|
6903
|
+
let numPoles = 0;
|
|
6904
|
+
|
|
6905
|
+
// Check data, determine increments, and convert to radians
|
|
6906
|
+
let {
|
|
6907
|
+
thetaResolution
|
|
6908
|
+
} = model;
|
|
6909
|
+
let startTheta = model.startTheta < model.endTheta ? model.startTheta : model.endTheta;
|
|
6910
|
+
startTheta *= Math.PI / 180.0;
|
|
6911
|
+
let endTheta = model.endTheta > model.startTheta ? model.endTheta : model.startTheta;
|
|
6912
|
+
endTheta *= Math.PI / 180.0;
|
|
6913
|
+
let startPhi = model.startPhi < model.endPhi ? model.startPhi : model.endPhi;
|
|
6914
|
+
startPhi *= Math.PI / 180.0;
|
|
6915
|
+
let endPhi = model.endPhi > model.startPhi ? model.endPhi : model.startPhi;
|
|
6916
|
+
endPhi *= Math.PI / 180.0;
|
|
6917
|
+
if (Math.abs(startTheta - endTheta) < 2.0 * Math.PI) {
|
|
6918
|
+
++thetaResolution;
|
|
6919
|
+
}
|
|
6920
|
+
const deltaTheta = (endTheta - startTheta) / model.thetaResolution;
|
|
6921
|
+
const jStart = model.startPhi <= 0.0 ? 1 : 0;
|
|
6922
|
+
const jEnd = model.phiResolution + (model.endPhi >= 180.0 ? -1 : 0);
|
|
6923
|
+
const numPts = model.phiResolution * thetaResolution + 2;
|
|
6924
|
+
const numPolys = model.phiResolution * 2 * model.thetaResolution;
|
|
6925
|
+
|
|
6926
|
+
// Points
|
|
6927
|
+
let pointIdx = 0;
|
|
6928
|
+
let points = _macros2_js__WEBPACK_IMPORTED_MODULE_0__.m.newTypedArray(pointDataType, numPts * 3);
|
|
6929
|
+
|
|
6930
|
+
// Normals
|
|
6931
|
+
let normals = new Float32Array(numPts * 3);
|
|
6932
|
+
|
|
6933
|
+
// Cells
|
|
6934
|
+
let cellLocation = 0;
|
|
6935
|
+
let polys = new Uint32Array(numPolys * 5);
|
|
6936
|
+
|
|
6937
|
+
// Create north pole if needed
|
|
6938
|
+
if (model.startPhi <= 0.0) {
|
|
6939
|
+
points[pointIdx * 3 + 0] = model.center[0];
|
|
6940
|
+
points[pointIdx * 3 + 1] = model.center[1];
|
|
6941
|
+
points[pointIdx * 3 + 2] = model.center[2] + model.radius;
|
|
6942
|
+
normals[pointIdx * 3 + 0] = 0;
|
|
6943
|
+
normals[pointIdx * 3 + 1] = 0;
|
|
6944
|
+
normals[pointIdx * 3 + 2] = 1;
|
|
6945
|
+
pointIdx++;
|
|
6946
|
+
numPoles++;
|
|
6947
|
+
}
|
|
6948
|
+
|
|
6949
|
+
// Create south pole if needed
|
|
6950
|
+
if (model.endPhi >= 180.0) {
|
|
4392
6951
|
points[pointIdx * 3 + 0] = model.center[0];
|
|
4393
6952
|
points[pointIdx * 3 + 1] = model.center[1];
|
|
4394
6953
|
points[pointIdx * 3 + 2] = model.center[2] - model.radius;
|
|
@@ -4542,6 +7101,7 @@ var vtkSphereSource$1 = {
|
|
|
4542
7101
|
/***/ 53489
|
|
4543
7102
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
4544
7103
|
|
|
7104
|
+
"use strict";
|
|
4545
7105
|
|
|
4546
7106
|
// EXPORTS
|
|
4547
7107
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -4847,9 +7407,10 @@ var vtkOrientationMarkerWidget$1 = {
|
|
|
4847
7407
|
|
|
4848
7408
|
/***/ },
|
|
4849
7409
|
|
|
4850
|
-
/***/
|
|
7410
|
+
/***/ 91960
|
|
4851
7411
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
4852
7412
|
|
|
7413
|
+
"use strict";
|
|
4853
7414
|
|
|
4854
7415
|
// EXPORTS
|
|
4855
7416
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -4868,73 +7429,8 @@ var Mapper = __webpack_require__(81418);
|
|
|
4868
7429
|
var Texture = __webpack_require__(41090);
|
|
4869
7430
|
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Filters/Sources/CubeSource.js
|
|
4870
7431
|
var CubeSource = __webpack_require__(90011);
|
|
4871
|
-
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/
|
|
4872
|
-
var
|
|
4873
|
-
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/DataArray.js
|
|
4874
|
-
var DataArray = __webpack_require__(445);
|
|
4875
|
-
;// ../../../node_modules/@kitware/vtk.js/Common/Core/ImageHelper.js
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
/**
|
|
4880
|
-
* Takes a canvas and converts it to a vtkImageData.
|
|
4881
|
-
*
|
|
4882
|
-
* Optionally supply a bounding box to get a particular subset of the canvas.
|
|
4883
|
-
*
|
|
4884
|
-
* @param canvas The HTML canvas to convert
|
|
4885
|
-
* @param boundingBox A bounding box of type [top, left, width, height]
|
|
4886
|
-
*/
|
|
4887
|
-
function canvasToImageData(canvas) {
|
|
4888
|
-
let boundingBox = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0, 0];
|
|
4889
|
-
const [top, left, width, height] = boundingBox;
|
|
4890
|
-
const ctxt = canvas.getContext('2d');
|
|
4891
|
-
const idata = ctxt.getImageData(top, left, width || canvas.width, height || canvas.height);
|
|
4892
|
-
const imageData = ImageData/* default.newInstance */.Ay.newInstance({
|
|
4893
|
-
type: 'vtkImageData'
|
|
4894
|
-
});
|
|
4895
|
-
imageData.setOrigin(0, 0, 0);
|
|
4896
|
-
imageData.setSpacing(1, 1, 1);
|
|
4897
|
-
imageData.setExtent(0, (width || canvas.width) - 1, 0, (height || canvas.height) - 1, 0, 0);
|
|
4898
|
-
const scalars = DataArray/* default.newInstance */.Ay.newInstance({
|
|
4899
|
-
numberOfComponents: 4,
|
|
4900
|
-
values: new Uint8Array(idata.data.buffer)
|
|
4901
|
-
});
|
|
4902
|
-
scalars.setName('scalars');
|
|
4903
|
-
imageData.getPointData().setScalars(scalars);
|
|
4904
|
-
return imageData;
|
|
4905
|
-
}
|
|
4906
|
-
|
|
4907
|
-
/**
|
|
4908
|
-
* Converts an Image object to a vtkImageData.
|
|
4909
|
-
*/
|
|
4910
|
-
function imageToImageData(image) {
|
|
4911
|
-
let transform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
4912
|
-
flipX: false,
|
|
4913
|
-
flipY: false,
|
|
4914
|
-
rotate: 0
|
|
4915
|
-
};
|
|
4916
|
-
const canvas = document.createElement('canvas');
|
|
4917
|
-
canvas.width = image.width;
|
|
4918
|
-
canvas.height = image.height;
|
|
4919
|
-
const ctx = canvas.getContext('2d');
|
|
4920
|
-
const {
|
|
4921
|
-
flipX,
|
|
4922
|
-
flipY,
|
|
4923
|
-
rotate
|
|
4924
|
-
} = transform;
|
|
4925
|
-
ctx.translate(canvas.width / 2, canvas.height / 2);
|
|
4926
|
-
ctx.scale(flipX ? -1 : 1, flipY ? -1 : 1);
|
|
4927
|
-
ctx.rotate(rotate * Math.PI / 180);
|
|
4928
|
-
ctx.drawImage(image, -image.width / 2, -image.height / 2);
|
|
4929
|
-
return canvasToImageData(canvas);
|
|
4930
|
-
}
|
|
4931
|
-
var ImageHelper = {
|
|
4932
|
-
canvasToImageData,
|
|
4933
|
-
imageToImageData
|
|
4934
|
-
};
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
7432
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/ImageHelper.js
|
|
7433
|
+
var ImageHelper = __webpack_require__(74821);
|
|
4938
7434
|
;// ../../../node_modules/@kitware/vtk.js/Rendering/Core/AnnotatedCubeActor/Presets.js
|
|
4939
7435
|
const STYLES = {
|
|
4940
7436
|
default: {
|
|
@@ -5116,7 +7612,7 @@ function vtkAnnotatedCubeActor(publicAPI, model) {
|
|
|
5116
7612
|
ctxt.font = `${prop.fontStyle} ${textSize}px "${prop.fontFamily}"`;
|
|
5117
7613
|
ctxt.fillText(prop.text, 0, 0);
|
|
5118
7614
|
ctxt.restore();
|
|
5119
|
-
const vtkImage = ImageHelper.canvasToImageData(canvas);
|
|
7615
|
+
const vtkImage = ImageHelper/* default */.A.canvasToImageData(canvas);
|
|
5120
7616
|
texture.setInputData(vtkImage, FACE_TO_INDEX[faceName]);
|
|
5121
7617
|
publicAPI.modified();
|
|
5122
7618
|
}
|
|
@@ -5220,6 +7716,7 @@ var vtkAnnotatedCubeActor$1 = {
|
|
|
5220
7716
|
/***/ 10341
|
|
5221
7717
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
5222
7718
|
|
|
7719
|
+
"use strict";
|
|
5223
7720
|
|
|
5224
7721
|
// EXPORTS
|
|
5225
7722
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -5240,8 +7737,8 @@ var Actor = __webpack_require__(44404);
|
|
|
5240
7737
|
var Mapper = __webpack_require__(81418);
|
|
5241
7738
|
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/Points.js
|
|
5242
7739
|
var Points = __webpack_require__(74973);
|
|
5243
|
-
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/PolyData.js +
|
|
5244
|
-
var PolyData = __webpack_require__(
|
|
7740
|
+
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/PolyData.js + 7 modules
|
|
7741
|
+
var PolyData = __webpack_require__(27480);
|
|
5245
7742
|
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/DataSetAttributes/Constants.js
|
|
5246
7743
|
var Constants = __webpack_require__(5695);
|
|
5247
7744
|
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/DataArray/Constants.js
|