@ohif/app 3.11.0-beta.98 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{2676.bundle.7e194265450db9aa1e98.js → 1402.bundle.e5306db9171c6c9793a7.js} +1379 -857
- package/dist/{9625.bundle.d2ab59c3dc4bf4139e1a.js → 1447.bundle.976ce9f69636f66a9eab.js} +2401 -2422
- package/dist/{147.bundle.a28710f442d91d98ee60.js → 147.bundle.e22bae08eb10c0a51314.js} +45 -122
- package/dist/{1919.bundle.a80e1fa53f199f8862dd.js → 1919.bundle.ca1ffebd2ee775dc2d82.js} +6 -4
- package/dist/{2011.bundle.c44c0094525a51b528f4.js → 2011.bundle.12539f6bbbfc20a372e9.js} +2726 -197
- package/dist/{6216.bundle.48ff7813b6b3b8aba5f0.js → 2345.bundle.1fedf5750caf46ce99d9.js} +1 -35
- package/dist/{2701.bundle.d5c7ef6ec8b6cd9c2dfa.js → 2701.bundle.f2c7a5ab4a8b49d73bff.js} +9 -9
- package/dist/{2974.bundle.54d5903a8b29f1b09299.js → 2974.bundle.ec95e58b346dbe30a362.js} +2 -0
- package/dist/{7750.bundle.216dafe3c87d611928da.js → 319.bundle.45c1c250b562a3feefa5.js} +296 -62
- package/dist/{3658.bundle.6093e112080735acc799.js → 3658.bundle.4b03e3bc783328aab18f.js} +2 -2
- package/dist/{9594.bundle.e623f61b984d7ff3b4b6.js → 4019.bundle.e07cc2a71b6e189a706a.js} +31 -157
- package/dist/{4113.bundle.e31f07e5967b95da38ec.js → 4113.bundle.3b3fed48ad784ccda1a1.js} +268 -67
- package/dist/{414.bundle.447355abfbdee0fcd226.js → 414.bundle.fac8463232edcfda0b6c.js} +15 -15
- package/dist/{4202.bundle.aa4161a7b8cb7c691072.js → 4202.bundle.f804c72fb887b9543506.js} +1 -1
- package/dist/{4759.bundle.4da90b9346bb5e377ac6.js → 4759.bundle.8686abdd7bcf4aa7d107.js} +2 -0
- package/dist/{5349.bundle.be4b2d9a58412788944e.js → 5349.bundle.c117cc60ab5ff40eed14.js} +2 -2
- package/dist/{6972.bundle.62729ec60365a1713e6e.js → 557.bundle.a0344a04ae7a43642402.js} +5541 -5283
- package/dist/{5674.bundle.6c0d445cbd151b6e7aa1.js → 5674.bundle.4e40a906351477a2a193.js} +2 -0
- package/dist/{6201.bundle.cf4e864bab13348add49.js → 6201.bundle.5d7b8937f331f965d1aa.js} +4 -4
- package/dist/{6376.bundle.de4abf332424cba7513e.js → 6376.bundle.24e14fa9bf28c7c86e7c.js} +1 -1
- package/dist/{1943.bundle.f020846851b7cc84afe7.js → 6991.bundle.08967b6f5698660e3a19.js} +67 -51
- package/dist/{7190.bundle.a35063abb9cb95986e67.js → 7190.bundle.4448c5a66a997bea24ca.js} +45 -8
- package/dist/{7197.bundle.e1e4eae326cae4231427.js → 7197.bundle.b8ce1b612ab1eff5d3ee.js} +5 -5
- package/dist/{810.bundle.b6c91b9eba0ed85abf1d.js → 810.bundle.84fc54342c180b8a3023.js} +6 -6
- package/dist/{8228.bundle.2df7b5c0e4e0fdbb3654.js → 8228.bundle.ec3557eae81cafaed8c9.js} +2 -2
- package/dist/{85.bundle.d741fbbde9d23cfd9bf3.js → 85.bundle.f9908f1f7350e5027d37.js} +3 -2
- package/dist/{8558.bundle.77bfe4e629eba4e4f807.js → 8558.bundle.ead200c0f2518d73739f.js} +3 -1
- package/dist/{860.bundle.736e07c64aeb9bfca8cb.js → 860.bundle.f90055bfb2088bf17617.js} +24 -1
- package/dist/{8740.bundle.d0f554795adaecf0292c.js → 8740.bundle.9e567165a05c863b9698.js} +18 -5
- package/dist/{8815.bundle.8f8b971e04e3c185fab2.js → 8815.bundle.9999a630034893a74508.js} +32 -10
- package/dist/{934.bundle.7267819612a1949b4985.js → 934.bundle.e620a43102a8abf8a1e3.js} +4 -2
- package/dist/{963.bundle.2742aa726a247a166628.js → 963.bundle.b2434897acfb3e8abee5.js} +29 -9
- package/dist/{1443.bundle.405ff549a88a585906f3.js → 9732.bundle.91cb05748bef4e4f67c2.js} +883 -1731
- package/dist/{9560.bundle.203976e64c9a0202e247.js → 9856.bundle.c34e4165e91ef095aa9f.js} +5853 -5649
- package/dist/{9862.bundle.11d2a0f6528e9e916e25.js → 9862.bundle.e404cb5f0e762fbf6a03.js} +2 -14
- package/dist/{5886.bundle.181e673d6d5a9333039a.js → 9892.bundle.364aba175ce50baeb46c.js} +35397 -32968
- package/dist/app-config.js +8 -0
- package/dist/{app.bundle.e65d04bbe0c78ac953b7.js → app.bundle.804c5a4cd283acda540d.js} +2239 -1468
- package/dist/{compute.bundle.06ee8311038e4ac2d34d.js → compute.bundle.a1c8365c4732e8b82ca3.js} +3 -3
- package/dist/index.html +1 -1
- package/dist/{interpolation.bundle.6b3b374f2888d3744e61.js → interpolation.bundle.488206d0a2c4fa1dd6c5.js} +1 -1
- package/dist/{polySeg.bundle.d8a36b40716862d016de.js → polySeg.bundle.02258624e0ec30e9934c.js} +3 -3
- package/dist/sw.js +1 -1
- package/package.json +22 -22
- /package/dist/{1459.bundle.1355d3eba175caed4bed.js → 1459.bundle.163c80965265cae11781.js} +0 -0
- /package/dist/{1807.bundle.7f4c8bba871a129c0ac4.js → 1807.bundle.d79c83317de38e4cffbd.js} +0 -0
- /package/dist/{213.bundle.42a97fecb41efdbe544e.js → 213.bundle.f8b1fd7851428f0fa02f.js} +0 -0
- /package/dist/{2424.bundle.54b1697ec7d23199a852.js → 2424.bundle.7469c5960e905196f646.js} +0 -0
- /package/dist/{6027.bundle.15c09b0276585fc58ef2.js → 6027.bundle.ab73f6c39c04c7662744.js} +0 -0
- /package/dist/{7431.bundle.503dc3262479de76225b.js → 7431.bundle.494b080a8141ef60067a.js} +0 -0
- /package/dist/{7639.bundle.390d70032154dd95344d.js → 7639.bundle.664fc584f04ca34a4bf1.js} +0 -0
|
@@ -386,6 +386,8 @@ class SegmentLabelTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .BaseTool */
|
|
|
386
386
|
configuration: {
|
|
387
387
|
hoverTimeout: 100,
|
|
388
388
|
searchRadius: 6,
|
|
389
|
+
color: null,
|
|
390
|
+
background: null,
|
|
389
391
|
},
|
|
390
392
|
}) {
|
|
391
393
|
super(toolProps, defaultToolProps);
|
|
@@ -450,7 +452,8 @@ class SegmentLabelTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .BaseTool */
|
|
|
450
452
|
viewport,
|
|
451
453
|
});
|
|
452
454
|
const segment = activeSegmentation.segments[hoveredSegmentIndex];
|
|
453
|
-
const color =
|
|
455
|
+
const color = this.configuration.color ??
|
|
456
|
+
_stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_1__.config.color.getSegmentIndexColor(viewport.id, segmentationId, hoveredSegmentIndex);
|
|
454
457
|
const label = segment?.label;
|
|
455
458
|
const canvasCoordinates = viewport.worldToCanvas(worldPoint);
|
|
456
459
|
this._editData = {
|
|
@@ -483,6 +486,7 @@ class SegmentLabelTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .BaseTool */
|
|
|
483
486
|
];
|
|
484
487
|
const boundingBox = (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_8__.drawTextBox)(svgDrawingHelper, 'segmentSelectLabelAnnotation', 'segmentSelectLabelTextBox', [hoveredSegmentLabel ?? '(unnamed segment)'], textBoxPosition, {
|
|
485
488
|
color: `rgba(${color[0]}, ${color[1]}, ${color[2]}, ${color[3]})`,
|
|
489
|
+
background: this.configuration.background ?? undefined,
|
|
486
490
|
});
|
|
487
491
|
const left = canvasCoordinates[0];
|
|
488
492
|
const top = canvasCoordinates[1];
|
|
@@ -2658,6 +2662,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2658
2662
|
/* harmony export */ UltrasoundDirectionalTool: () => (/* reexport safe */ _tools__WEBPACK_IMPORTED_MODULE_13__.oi),
|
|
2659
2663
|
/* harmony export */ UltrasoundPleuraBLineTool: () => (/* reexport safe */ _tools__WEBPACK_IMPORTED_MODULE_13__.T8),
|
|
2660
2664
|
/* harmony export */ VideoRedactionTool: () => (/* reexport safe */ _tools_annotation_VideoRedactionTool__WEBPACK_IMPORTED_MODULE_14__.A),
|
|
2665
|
+
/* harmony export */ VolumeCroppingControlTool: () => (/* reexport safe */ _tools__WEBPACK_IMPORTED_MODULE_13__.Eb),
|
|
2666
|
+
/* harmony export */ VolumeCroppingTool: () => (/* reexport safe */ _tools__WEBPACK_IMPORTED_MODULE_13__.NF),
|
|
2661
2667
|
/* harmony export */ VolumeRotateTool: () => (/* reexport safe */ _tools__WEBPACK_IMPORTED_MODULE_13__.Oh),
|
|
2662
2668
|
/* harmony export */ WholeBodySegmentTool: () => (/* reexport safe */ _tools__WEBPACK_IMPORTED_MODULE_13__.Tc),
|
|
2663
2669
|
/* harmony export */ WindowLevelRegionTool: () => (/* reexport safe */ _tools__WEBPACK_IMPORTED_MODULE_13__.TG),
|
|
@@ -3027,7 +3033,7 @@ class Colorbar extends _widgets_Widget__WEBPACK_IMPORTED_MODULE_7__/* ["default"
|
|
|
3027
3033
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3028
3034
|
/* harmony export */ r: () => (/* binding */ version)
|
|
3029
3035
|
/* harmony export */ });
|
|
3030
|
-
const version = '3.
|
|
3036
|
+
const version = '3.32.5';
|
|
3031
3037
|
|
|
3032
3038
|
|
|
3033
3039
|
/***/ }),
|
|
@@ -6029,15 +6035,9 @@ function slabThicknessSyncCallback(_synchronizerInstance, sourceViewport, target
|
|
|
6029
6035
|
/* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3823);
|
|
6030
6036
|
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15327);
|
|
6031
6037
|
/* harmony import */ var _utilities_boundingBox__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(72282);
|
|
6032
|
-
/* harmony import */ var
|
|
6033
|
-
/* harmony import */ var
|
|
6034
|
-
/* harmony import */ var
|
|
6035
|
-
/* harmony import */ var _BrushStrategy__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(55887);
|
|
6036
|
-
/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(99737);
|
|
6037
|
-
/* harmony import */ var _compositions__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(11990);
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6038
|
+
/* harmony import */ var _BrushStrategy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(55887);
|
|
6039
|
+
/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(99737);
|
|
6040
|
+
/* harmony import */ var _compositions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(11990);
|
|
6041
6041
|
|
|
6042
6042
|
|
|
6043
6043
|
|
|
@@ -6046,8 +6046,8 @@ function slabThicknessSyncCallback(_synchronizerInstance, sourceViewport, target
|
|
|
6046
6046
|
|
|
6047
6047
|
const { transformWorldToIndex } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities;
|
|
6048
6048
|
const initializeRectangle = {
|
|
6049
|
-
[
|
|
6050
|
-
const { points,
|
|
6049
|
+
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Initialize]: (operationData) => {
|
|
6050
|
+
const { points, viewport, segmentationImageData, } = operationData;
|
|
6051
6051
|
if (!points) {
|
|
6052
6052
|
return;
|
|
6053
6053
|
}
|
|
@@ -6073,8 +6073,18 @@ function createPointInRectangle(viewport, points, segmentationImageData) {
|
|
|
6073
6073
|
});
|
|
6074
6074
|
});
|
|
6075
6075
|
const boundsIJK = (0,_utilities_boundingBox__WEBPACK_IMPORTED_MODULE_2__.getBoundingBoxAroundShapeIJK)(rectangleCornersIJK, segmentationImageData.getDimensions());
|
|
6076
|
-
const
|
|
6077
|
-
const
|
|
6076
|
+
const [p0, p1, p2, p3] = points;
|
|
6077
|
+
const axisU = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
|
|
6078
|
+
const axisV = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
|
|
6079
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.subtract */ .eR.subtract(axisU, p1, p0);
|
|
6080
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.subtract */ .eR.subtract(axisV, p3, p0);
|
|
6081
|
+
const uLen = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.length */ .eR.length(axisU);
|
|
6082
|
+
const vLen = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.length */ .eR.length(axisV);
|
|
6083
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.normalize */ .eR.normalize(axisU, axisU);
|
|
6084
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.normalize */ .eR.normalize(axisV, axisV);
|
|
6085
|
+
const normal = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
|
|
6086
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.cross */ .eR.cross(normal, axisU, axisV);
|
|
6087
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.normalize */ .eR.normalize(normal, normal);
|
|
6078
6088
|
const direction = segmentationImageData.getDirection();
|
|
6079
6089
|
const spacing = segmentationImageData.getSpacing();
|
|
6080
6090
|
const { viewPlaneNormal } = viewport.getCamera();
|
|
@@ -6082,27 +6092,22 @@ function createPointInRectangle(viewport, points, segmentationImageData) {
|
|
|
6082
6092
|
direction,
|
|
6083
6093
|
spacing,
|
|
6084
6094
|
}, viewPlaneNormal);
|
|
6085
|
-
const
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
const xInside = x >= xMin && x <= xMax;
|
|
6098
|
-
const yInside = y >= yMin && y <= yMax;
|
|
6099
|
-
const zInside = z >= zMin && z <= zMax;
|
|
6100
|
-
return xInside && yInside && zInside;
|
|
6101
|
-
};
|
|
6095
|
+
const pointInShapeFn = (pointLPS) => {
|
|
6096
|
+
const v = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
|
|
6097
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.subtract */ .eR.subtract(v, pointLPS, p0);
|
|
6098
|
+
const u = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dot */ .eR.dot(v, axisU);
|
|
6099
|
+
const vproj = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dot */ .eR.dot(v, axisV);
|
|
6100
|
+
const d = Math.abs(gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dot */ .eR.dot(v, normal));
|
|
6101
|
+
return (u >= -EPS &&
|
|
6102
|
+
u <= uLen + EPS &&
|
|
6103
|
+
vproj >= -EPS &&
|
|
6104
|
+
vproj <= vLen + EPS &&
|
|
6105
|
+
d <= EPS);
|
|
6106
|
+
};
|
|
6102
6107
|
return { boundsIJK, pointInShapeFn };
|
|
6103
6108
|
}
|
|
6104
|
-
const RECTANGLE_STRATEGY = new
|
|
6105
|
-
const RECTANGLE_THRESHOLD_STRATEGY = new
|
|
6109
|
+
const RECTANGLE_STRATEGY = new _BrushStrategy__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A('Rectangle', _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.regionFill, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.setValue, initializeRectangle, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.determineSegmentIndex, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.preview, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.labelmapStatistics);
|
|
6110
|
+
const RECTANGLE_THRESHOLD_STRATEGY = new _BrushStrategy__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A('RectangleThreshold', _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.regionFill, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.setValue, initializeRectangle, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.determineSegmentIndex, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.dynamicThreshold, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.threshold, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.preview, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.islandRemoval, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.labelmapStatistics);
|
|
6106
6111
|
const fillInsideRectangle = RECTANGLE_STRATEGY.strategyFunction;
|
|
6107
6112
|
const thresholdInsideRectangle = RECTANGLE_THRESHOLD_STRATEGY.strategyFunction;
|
|
6108
6113
|
|
|
@@ -6890,7 +6895,7 @@ class VideoRedactionTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .Annotatio
|
|
|
6890
6895
|
data.handles.activeHandleIndex = null;
|
|
6891
6896
|
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .A)(viewportUIDsToRender);
|
|
6892
6897
|
this.editData = null;
|
|
6893
|
-
return annotation.
|
|
6898
|
+
return annotation.annotationUID;
|
|
6894
6899
|
}
|
|
6895
6900
|
_getImageVolumeFromTargetUID(targetUID, renderingEngine) {
|
|
6896
6901
|
let imageVolume, viewport;
|
|
@@ -7855,7 +7860,6 @@ const OPERATION = {
|
|
|
7855
7860
|
ROTATE: 2,
|
|
7856
7861
|
SLAB: 3,
|
|
7857
7862
|
};
|
|
7858
|
-
const EPSILON = 1e-3;
|
|
7859
7863
|
class CrosshairsTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .AnnotationTool */ .EC {
|
|
7860
7864
|
constructor(toolProps = {}, defaultToolProps = {
|
|
7861
7865
|
supportedInteractionTypes: ['Mouse'],
|
|
@@ -8875,7 +8879,7 @@ class CrosshairsTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .AnnotationToo
|
|
|
8875
8879
|
];
|
|
8876
8880
|
const viewportDraggableRotatable = this._getReferenceLineDraggableRotatable(otherViewport.id);
|
|
8877
8881
|
if (!viewportDraggableRotatable) {
|
|
8878
|
-
const { rotationPoints } = this.editData.annotation.data.handles;
|
|
8882
|
+
const { rotationPoints } = (this.editData.annotation.data).handles;
|
|
8879
8883
|
const otherViewportRotationPoints = rotationPoints.filter((point) => point[1].uid === otherViewport.id);
|
|
8880
8884
|
if (otherViewportRotationPoints.length === 2) {
|
|
8881
8885
|
const point1 = viewport.canvasToWorld(otherViewportRotationPoints[0][3]);
|
|
@@ -14855,6 +14859,41 @@ function _drawTextBackground(group, color) {
|
|
|
14855
14859
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (drawTextBox);
|
|
14856
14860
|
|
|
14857
14861
|
|
|
14862
|
+
/***/ }),
|
|
14863
|
+
|
|
14864
|
+
/***/ 26384:
|
|
14865
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
14866
|
+
|
|
14867
|
+
"use strict";
|
|
14868
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
14869
|
+
/* harmony export */ l: () => (/* binding */ isAxisAlignedRectangle)
|
|
14870
|
+
/* harmony export */ });
|
|
14871
|
+
/* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3823);
|
|
14872
|
+
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15327);
|
|
14873
|
+
|
|
14874
|
+
|
|
14875
|
+
const { isEqual } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities;
|
|
14876
|
+
const iAxis = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.fromValues */ .eR.fromValues(1, 0, 0);
|
|
14877
|
+
const jAxis = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.fromValues */ .eR.fromValues(0, 1, 0);
|
|
14878
|
+
const kAxis = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.fromValues */ .eR.fromValues(0, 0, 1);
|
|
14879
|
+
const axisList = [iAxis, jAxis, kAxis];
|
|
14880
|
+
function isAxisAlignedRectangle(rectangleCornersIJK) {
|
|
14881
|
+
const rectangleVec1 = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.subtract */ .eR.subtract(gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create(), rectangleCornersIJK[0], rectangleCornersIJK[1]);
|
|
14882
|
+
const rectangleVec2 = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.subtract */ .eR.subtract(gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create(), rectangleCornersIJK[0], rectangleCornersIJK[2]);
|
|
14883
|
+
const anglesVec1 = calculateAnglesWithAxes(rectangleVec1, axisList);
|
|
14884
|
+
const anglesVec2 = calculateAnglesWithAxes(rectangleVec2, axisList);
|
|
14885
|
+
const isAligned = [...anglesVec1, ...anglesVec2].every((angle) => isEqual(angle, 0) ||
|
|
14886
|
+
isEqual(angle, 90) ||
|
|
14887
|
+
isEqual(angle, 180) ||
|
|
14888
|
+
isEqual(angle, 270));
|
|
14889
|
+
return isAligned;
|
|
14890
|
+
}
|
|
14891
|
+
function calculateAnglesWithAxes(vec, axes) {
|
|
14892
|
+
return axes.map((axis) => (gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.angle */ .eR.angle(vec, axis) * 180) / Math.PI);
|
|
14893
|
+
}
|
|
14894
|
+
|
|
14895
|
+
|
|
14896
|
+
|
|
14858
14897
|
/***/ }),
|
|
14859
14898
|
|
|
14860
14899
|
/***/ 26795:
|
|
@@ -16879,7 +16918,7 @@ function createPresentationViewSynchronizer(synchronizerName, options) {
|
|
|
16879
16918
|
/* harmony import */ var _utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(40634);
|
|
16880
16919
|
/* harmony import */ var _utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(18990);
|
|
16881
16920
|
/* harmony import */ var _utilities_math_circle__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(77081);
|
|
16882
|
-
/* harmony import */ var _utilities_math_ellipse__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(
|
|
16921
|
+
/* harmony import */ var _utilities_math_ellipse__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(87009);
|
|
16883
16922
|
/* harmony import */ var _utilities_math_basic__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(73262);
|
|
16884
16923
|
/* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(3823);
|
|
16885
16924
|
|
|
@@ -17925,7 +17964,7 @@ class SegmentationIntersectionTool extends _base_AnnotationDisplayTool__WEBPACK_
|
|
|
17925
17964
|
}
|
|
17926
17965
|
const annotation = annotations[0];
|
|
17927
17966
|
const { annotationUID } = annotation;
|
|
17928
|
-
const actorsWorldPointsMap = annotation.data.actorsWorldPointsMap;
|
|
17967
|
+
const actorsWorldPointsMap = (annotation).data.actorsWorldPointsMap;
|
|
17929
17968
|
calculateSurfaceSegmentationIntersectionsForViewport(actorsWorldPointsMap, viewport);
|
|
17930
17969
|
const actorEntries = viewport.getActors();
|
|
17931
17970
|
const cacheId = getCacheId(viewport);
|
|
@@ -18843,6 +18882,1240 @@ const createStackImageSynchronizer = _synchronizers_createImageSliceSynchronizer
|
|
|
18843
18882
|
|
|
18844
18883
|
|
|
18845
18884
|
|
|
18885
|
+
/***/ }),
|
|
18886
|
+
|
|
18887
|
+
/***/ 35300:
|
|
18888
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
18889
|
+
|
|
18890
|
+
"use strict";
|
|
18891
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
18892
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
18893
|
+
/* harmony export */ });
|
|
18894
|
+
/* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3823);
|
|
18895
|
+
/* harmony import */ var _kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84607);
|
|
18896
|
+
/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(85817);
|
|
18897
|
+
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(15327);
|
|
18898
|
+
/* harmony import */ var _store_ToolGroupManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(77609);
|
|
18899
|
+
/* harmony import */ var _stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(82056);
|
|
18900
|
+
/* harmony import */ var _drawingSvg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(74347);
|
|
18901
|
+
/* harmony import */ var _store_state__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(85204);
|
|
18902
|
+
/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(99737);
|
|
18903
|
+
/* harmony import */ var _utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(60810);
|
|
18904
|
+
/* harmony import */ var _cursors_elementCursor__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(7001);
|
|
18905
|
+
/* harmony import */ var _utilities_math_vec2_liangBarksyClip__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(35381);
|
|
18906
|
+
/* harmony import */ var _utilities_math_line__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(93258);
|
|
18907
|
+
/* harmony import */ var _stateManagement_annotation_annotationLocking__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(2076);
|
|
18908
|
+
/* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(58640);
|
|
18909
|
+
|
|
18910
|
+
|
|
18911
|
+
|
|
18912
|
+
|
|
18913
|
+
|
|
18914
|
+
|
|
18915
|
+
|
|
18916
|
+
|
|
18917
|
+
|
|
18918
|
+
|
|
18919
|
+
|
|
18920
|
+
|
|
18921
|
+
|
|
18922
|
+
|
|
18923
|
+
|
|
18924
|
+
const { RENDERING_DEFAULTS } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.CONSTANTS;
|
|
18925
|
+
function defaultReferenceLineColor() {
|
|
18926
|
+
return 'rgb(0, 200, 0)';
|
|
18927
|
+
}
|
|
18928
|
+
function defaultReferenceLineControllable() {
|
|
18929
|
+
return true;
|
|
18930
|
+
}
|
|
18931
|
+
const OPERATION = {
|
|
18932
|
+
DRAG: 1,
|
|
18933
|
+
ROTATE: 2,
|
|
18934
|
+
SLAB: 3,
|
|
18935
|
+
};
|
|
18936
|
+
class VolumeCroppingControlTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */ .EC {
|
|
18937
|
+
constructor(toolProps = {}, defaultToolProps = {
|
|
18938
|
+
supportedInteractionTypes: ['Mouse'],
|
|
18939
|
+
configuration: {
|
|
18940
|
+
viewportIndicators: false,
|
|
18941
|
+
viewportIndicatorsConfig: {
|
|
18942
|
+
radius: 5,
|
|
18943
|
+
x: null,
|
|
18944
|
+
y: null,
|
|
18945
|
+
},
|
|
18946
|
+
extendReferenceLines: true,
|
|
18947
|
+
initialCropFactor: 0.2,
|
|
18948
|
+
mobile: {
|
|
18949
|
+
enabled: false,
|
|
18950
|
+
opacity: 0.8,
|
|
18951
|
+
},
|
|
18952
|
+
lineColors: {
|
|
18953
|
+
AXIAL: [1.0, 0.0, 0.0],
|
|
18954
|
+
CORONAL: [0.0, 1.0, 0.0],
|
|
18955
|
+
SAGITTAL: [1.0, 1.0, 0.0],
|
|
18956
|
+
UNKNOWN: [0.0, 0.0, 1.0],
|
|
18957
|
+
},
|
|
18958
|
+
lineWidth: 1.5,
|
|
18959
|
+
lineWidthActive: 2.5,
|
|
18960
|
+
},
|
|
18961
|
+
}) {
|
|
18962
|
+
super(toolProps, defaultToolProps);
|
|
18963
|
+
this._virtualAnnotations = [];
|
|
18964
|
+
this.sphereStates = [];
|
|
18965
|
+
this.draggingSphereIndex = null;
|
|
18966
|
+
this.toolCenter = [0, 0, 0];
|
|
18967
|
+
this.toolCenterMin = [0, 0, 0];
|
|
18968
|
+
this.toolCenterMax = [0, 0, 0];
|
|
18969
|
+
this.initializeViewport = ({ renderingEngineId, viewportId, }) => {
|
|
18970
|
+
if (!renderingEngineId || !viewportId) {
|
|
18971
|
+
console.warn('VolumeCroppingControlTool: Missing renderingEngineId or viewportId');
|
|
18972
|
+
return;
|
|
18973
|
+
}
|
|
18974
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getEnabledElementByIds)(viewportId, renderingEngineId);
|
|
18975
|
+
if (!enabledElement) {
|
|
18976
|
+
return;
|
|
18977
|
+
}
|
|
18978
|
+
const { viewport } = enabledElement;
|
|
18979
|
+
this._updateToolCentersFromViewport(viewport);
|
|
18980
|
+
const { element } = viewport;
|
|
18981
|
+
const { position, focalPoint, viewPlaneNormal } = viewport.getCamera();
|
|
18982
|
+
let annotations = this._getAnnotations(enabledElement);
|
|
18983
|
+
annotations = this.filterInteractableAnnotationsForElement(element, annotations);
|
|
18984
|
+
if (annotations?.length) {
|
|
18985
|
+
(0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.removeAnnotation)(annotations[0].annotationUID);
|
|
18986
|
+
}
|
|
18987
|
+
const orientation = this._getOrientationFromNormal(viewport.getCamera().viewPlaneNormal);
|
|
18988
|
+
const annotation = {
|
|
18989
|
+
highlighted: false,
|
|
18990
|
+
metadata: {
|
|
18991
|
+
cameraPosition: [...position],
|
|
18992
|
+
cameraFocalPoint: [...focalPoint],
|
|
18993
|
+
toolName: this.getToolName(),
|
|
18994
|
+
},
|
|
18995
|
+
data: {
|
|
18996
|
+
handles: {
|
|
18997
|
+
toolCenter: this.toolCenter,
|
|
18998
|
+
toolCenterMin: this.toolCenterMin,
|
|
18999
|
+
toolCenterMax: this.toolCenterMax,
|
|
19000
|
+
},
|
|
19001
|
+
activeOperation: null,
|
|
19002
|
+
activeViewportIds: [],
|
|
19003
|
+
viewportId,
|
|
19004
|
+
referenceLines: [],
|
|
19005
|
+
orientation,
|
|
19006
|
+
},
|
|
19007
|
+
};
|
|
19008
|
+
(0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.addAnnotation)(annotation, element);
|
|
19009
|
+
return {
|
|
19010
|
+
normal: viewPlaneNormal,
|
|
19011
|
+
point: viewport.canvasToWorld([100, 100]),
|
|
19012
|
+
};
|
|
19013
|
+
};
|
|
19014
|
+
this._getViewportsInfo = () => {
|
|
19015
|
+
const viewports = (0,_store_ToolGroupManager__WEBPACK_IMPORTED_MODULE_4__.getToolGroup)(this.toolGroupId).viewportsInfo;
|
|
19016
|
+
return viewports;
|
|
19017
|
+
};
|
|
19018
|
+
this.resetCroppingSpheres = () => {
|
|
19019
|
+
const viewportsInfo = this._getViewportsInfo();
|
|
19020
|
+
for (const viewportInfo of viewportsInfo) {
|
|
19021
|
+
const { viewportId, renderingEngineId } = viewportInfo;
|
|
19022
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getEnabledElementByIds)(viewportId, renderingEngineId);
|
|
19023
|
+
const viewport = enabledElement.viewport;
|
|
19024
|
+
const resetPan = true;
|
|
19025
|
+
const resetZoom = true;
|
|
19026
|
+
const resetToCenter = true;
|
|
19027
|
+
const resetRotation = true;
|
|
19028
|
+
const suppressEvents = true;
|
|
19029
|
+
viewport.resetCamera({
|
|
19030
|
+
resetPan,
|
|
19031
|
+
resetZoom,
|
|
19032
|
+
resetToCenter,
|
|
19033
|
+
resetRotation,
|
|
19034
|
+
suppressEvents,
|
|
19035
|
+
});
|
|
19036
|
+
viewport.resetSlabThickness();
|
|
19037
|
+
const { element } = viewport;
|
|
19038
|
+
let annotations = this._getAnnotations(enabledElement);
|
|
19039
|
+
annotations = this.filterInteractableAnnotationsForElement(element, annotations);
|
|
19040
|
+
if (annotations.length) {
|
|
19041
|
+
(0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.removeAnnotation)(annotations[0].annotationUID);
|
|
19042
|
+
}
|
|
19043
|
+
viewport.render();
|
|
19044
|
+
}
|
|
19045
|
+
this._computeToolCenter(viewportsInfo);
|
|
19046
|
+
};
|
|
19047
|
+
this.computeToolCenter = () => {
|
|
19048
|
+
const viewportsInfo = this._getViewportsInfo();
|
|
19049
|
+
};
|
|
19050
|
+
this._computeToolCenter = (viewportsInfo) => {
|
|
19051
|
+
if (!viewportsInfo || !viewportsInfo[0]) {
|
|
19052
|
+
console.warn(' _computeToolCenter : No valid viewportsInfo for computeToolCenter.');
|
|
19053
|
+
return;
|
|
19054
|
+
}
|
|
19055
|
+
const orientationIds = ['AXIAL', 'CORONAL', 'SAGITTAL'];
|
|
19056
|
+
const presentOrientations = viewportsInfo
|
|
19057
|
+
.map((vp) => {
|
|
19058
|
+
if (vp.renderingEngineId) {
|
|
19059
|
+
const renderingEngine = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getRenderingEngine)(vp.renderingEngineId);
|
|
19060
|
+
const viewport = renderingEngine.getViewport(vp.viewportId);
|
|
19061
|
+
if (viewport && viewport.getCamera) {
|
|
19062
|
+
const orientation = this._getOrientationFromNormal(viewport.getCamera().viewPlaneNormal);
|
|
19063
|
+
if (orientation) {
|
|
19064
|
+
return orientation;
|
|
19065
|
+
}
|
|
19066
|
+
}
|
|
19067
|
+
}
|
|
19068
|
+
return null;
|
|
19069
|
+
})
|
|
19070
|
+
.filter(Boolean);
|
|
19071
|
+
const missingOrientation = orientationIds.find((id) => !presentOrientations.includes(id));
|
|
19072
|
+
const presentNormals = [];
|
|
19073
|
+
const presentCenters = [];
|
|
19074
|
+
const presentViewportInfos = viewportsInfo.filter((vp) => {
|
|
19075
|
+
let orientation = null;
|
|
19076
|
+
if (vp.renderingEngineId) {
|
|
19077
|
+
const renderingEngine = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getRenderingEngine)(vp.renderingEngineId);
|
|
19078
|
+
const viewport = renderingEngine.getViewport(vp.viewportId);
|
|
19079
|
+
if (viewport && viewport.getCamera) {
|
|
19080
|
+
orientation = this._getOrientationFromNormal(viewport.getCamera().viewPlaneNormal);
|
|
19081
|
+
}
|
|
19082
|
+
}
|
|
19083
|
+
return orientation && orientationIds.includes(orientation);
|
|
19084
|
+
});
|
|
19085
|
+
presentViewportInfos.forEach((vpInfo) => {
|
|
19086
|
+
const { normal, point } = this.initializeViewport(vpInfo);
|
|
19087
|
+
presentNormals.push(normal);
|
|
19088
|
+
presentCenters.push(point);
|
|
19089
|
+
});
|
|
19090
|
+
if (presentViewportInfos.length === 2 && missingOrientation) {
|
|
19091
|
+
const virtualNormal = [0, 0, 0];
|
|
19092
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.cross */ .eR.cross(virtualNormal, presentNormals[0], presentNormals[1]);
|
|
19093
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.normalize */ .eR.normalize(virtualNormal, virtualNormal);
|
|
19094
|
+
const virtualCenter = [
|
|
19095
|
+
(presentCenters[0][0] + presentCenters[1][0]) / 2,
|
|
19096
|
+
(presentCenters[0][1] + presentCenters[1][1]) / 2,
|
|
19097
|
+
(presentCenters[0][2] + presentCenters[1][2]) / 2,
|
|
19098
|
+
];
|
|
19099
|
+
const orientation = null;
|
|
19100
|
+
const virtualAnnotation = {
|
|
19101
|
+
highlighted: false,
|
|
19102
|
+
metadata: {
|
|
19103
|
+
cameraPosition: [...virtualCenter],
|
|
19104
|
+
cameraFocalPoint: [...virtualCenter],
|
|
19105
|
+
toolName: this.getToolName(),
|
|
19106
|
+
},
|
|
19107
|
+
data: {
|
|
19108
|
+
handles: {
|
|
19109
|
+
activeOperation: null,
|
|
19110
|
+
toolCenter: this.toolCenter,
|
|
19111
|
+
toolCenterMin: this.toolCenterMin,
|
|
19112
|
+
toolCenterMax: this.toolCenterMax,
|
|
19113
|
+
},
|
|
19114
|
+
activeViewportIds: [],
|
|
19115
|
+
viewportId: missingOrientation,
|
|
19116
|
+
referenceLines: [],
|
|
19117
|
+
orientation,
|
|
19118
|
+
},
|
|
19119
|
+
isVirtual: true,
|
|
19120
|
+
virtualNormal,
|
|
19121
|
+
};
|
|
19122
|
+
this._virtualAnnotations = [virtualAnnotation];
|
|
19123
|
+
}
|
|
19124
|
+
else if (presentViewportInfos.length === 1) {
|
|
19125
|
+
let presentOrientation = null;
|
|
19126
|
+
const vpInfo = presentViewportInfos[0];
|
|
19127
|
+
if (vpInfo.renderingEngineId) {
|
|
19128
|
+
const renderingEngine = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getRenderingEngine)(vpInfo.renderingEngineId);
|
|
19129
|
+
const viewport = renderingEngine.getViewport(vpInfo.viewportId);
|
|
19130
|
+
if (viewport && viewport.getCamera) {
|
|
19131
|
+
presentOrientation = this._getOrientationFromNormal(viewport.getCamera().viewPlaneNormal);
|
|
19132
|
+
}
|
|
19133
|
+
}
|
|
19134
|
+
const presentCenter = presentCenters[0];
|
|
19135
|
+
const canonicalNormals = {
|
|
19136
|
+
AXIAL: [0, 0, 1],
|
|
19137
|
+
CORONAL: [0, 1, 0],
|
|
19138
|
+
SAGITTAL: [1, 0, 0],
|
|
19139
|
+
};
|
|
19140
|
+
const missingIds = orientationIds.filter((id) => id !== presentOrientation);
|
|
19141
|
+
const virtualAnnotations = missingIds.map((orientation) => {
|
|
19142
|
+
const normal = canonicalNormals[orientation];
|
|
19143
|
+
const virtualAnnotation = {
|
|
19144
|
+
highlighted: false,
|
|
19145
|
+
metadata: {
|
|
19146
|
+
cameraPosition: [...presentCenter],
|
|
19147
|
+
cameraFocalPoint: [...presentCenter],
|
|
19148
|
+
toolName: this.getToolName(),
|
|
19149
|
+
},
|
|
19150
|
+
data: {
|
|
19151
|
+
handles: {
|
|
19152
|
+
activeOperation: null,
|
|
19153
|
+
toolCenter: this.toolCenter,
|
|
19154
|
+
toolCenterMin: this.toolCenterMin,
|
|
19155
|
+
toolCenterMax: this.toolCenterMax,
|
|
19156
|
+
},
|
|
19157
|
+
activeViewportIds: [],
|
|
19158
|
+
viewportId: orientation,
|
|
19159
|
+
referenceLines: [],
|
|
19160
|
+
orientation,
|
|
19161
|
+
},
|
|
19162
|
+
isVirtual: true,
|
|
19163
|
+
virtualNormal: normal,
|
|
19164
|
+
};
|
|
19165
|
+
return virtualAnnotation;
|
|
19166
|
+
});
|
|
19167
|
+
this._virtualAnnotations = virtualAnnotations;
|
|
19168
|
+
}
|
|
19169
|
+
if (viewportsInfo && viewportsInfo.length) {
|
|
19170
|
+
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .A)(viewportsInfo.map(({ viewportId }) => viewportId));
|
|
19171
|
+
}
|
|
19172
|
+
};
|
|
19173
|
+
this.cancel = () => {
|
|
19174
|
+
console.log('Not implemented yet');
|
|
19175
|
+
};
|
|
19176
|
+
this.isPointNearTool = (element, annotation, canvasCoords, proximity) => {
|
|
19177
|
+
if (this._pointNearTool(element, annotation, canvasCoords, 6)) {
|
|
19178
|
+
return true;
|
|
19179
|
+
}
|
|
19180
|
+
return false;
|
|
19181
|
+
};
|
|
19182
|
+
this.toolSelectedCallback = (evt, annotation, interactionType) => {
|
|
19183
|
+
const eventDetail = evt.detail;
|
|
19184
|
+
const { element } = eventDetail;
|
|
19185
|
+
annotation.highlighted = true;
|
|
19186
|
+
this._activateModify(element);
|
|
19187
|
+
(0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_10__.hideElementCursor)(element);
|
|
19188
|
+
evt.preventDefault();
|
|
19189
|
+
};
|
|
19190
|
+
this.onResetCamera = (evt) => {
|
|
19191
|
+
this.resetCroppingSpheres();
|
|
19192
|
+
};
|
|
19193
|
+
this.mouseMoveCallback = (evt, filteredToolAnnotations) => {
|
|
19194
|
+
if (!filteredToolAnnotations) {
|
|
19195
|
+
return;
|
|
19196
|
+
}
|
|
19197
|
+
const { element, currentPoints } = evt.detail;
|
|
19198
|
+
const canvasCoords = currentPoints.canvas;
|
|
19199
|
+
let imageNeedsUpdate = false;
|
|
19200
|
+
for (let i = 0; i < filteredToolAnnotations.length; i++) {
|
|
19201
|
+
const annotation = filteredToolAnnotations[i];
|
|
19202
|
+
if ((0,_stateManagement_annotation_annotationLocking__WEBPACK_IMPORTED_MODULE_13__.isAnnotationLocked)(annotation.annotationUID)) {
|
|
19203
|
+
continue;
|
|
19204
|
+
}
|
|
19205
|
+
const { data, highlighted } = annotation;
|
|
19206
|
+
if (!data.handles) {
|
|
19207
|
+
continue;
|
|
19208
|
+
}
|
|
19209
|
+
const previousActiveOperation = data.handles.activeOperation;
|
|
19210
|
+
const previousActiveViewportIds = data.activeViewportIds && data.activeViewportIds.length > 0
|
|
19211
|
+
? [...data.activeViewportIds]
|
|
19212
|
+
: [];
|
|
19213
|
+
data.activeViewportIds = [];
|
|
19214
|
+
let near = false;
|
|
19215
|
+
near = this._pointNearTool(element, annotation, canvasCoords, 6);
|
|
19216
|
+
const nearToolAndNotMarkedActive = near && !highlighted;
|
|
19217
|
+
const notNearToolAndMarkedActive = !near && highlighted;
|
|
19218
|
+
if (nearToolAndNotMarkedActive || notNearToolAndMarkedActive) {
|
|
19219
|
+
annotation.highlighted = !highlighted;
|
|
19220
|
+
imageNeedsUpdate = true;
|
|
19221
|
+
}
|
|
19222
|
+
}
|
|
19223
|
+
return imageNeedsUpdate;
|
|
19224
|
+
};
|
|
19225
|
+
this.filterInteractableAnnotationsForElement = (element, annotations) => {
|
|
19226
|
+
if (!annotations || !annotations.length) {
|
|
19227
|
+
return [];
|
|
19228
|
+
}
|
|
19229
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getEnabledElement)(element);
|
|
19230
|
+
let orientation = null;
|
|
19231
|
+
if (enabledElement.viewport && enabledElement.viewport.getCamera) {
|
|
19232
|
+
orientation = this._getOrientationFromNormal(enabledElement.viewport.getCamera().viewPlaneNormal);
|
|
19233
|
+
}
|
|
19234
|
+
const filtered = annotations.filter((annotation) => {
|
|
19235
|
+
if (annotation.isVirtual) {
|
|
19236
|
+
return true;
|
|
19237
|
+
}
|
|
19238
|
+
if (annotation.data.orientation &&
|
|
19239
|
+
orientation &&
|
|
19240
|
+
annotation.data.orientation === orientation) {
|
|
19241
|
+
return true;
|
|
19242
|
+
}
|
|
19243
|
+
return false;
|
|
19244
|
+
});
|
|
19245
|
+
return filtered;
|
|
19246
|
+
};
|
|
19247
|
+
this.renderAnnotation = (enabledElement, svgDrawingHelper) => {
|
|
19248
|
+
function lineIntersection2D(p1, p2, q1, q2) {
|
|
19249
|
+
const s1_x = p2[0] - p1[0];
|
|
19250
|
+
const s1_y = p2[1] - p1[1];
|
|
19251
|
+
const s2_x = q2[0] - q1[0];
|
|
19252
|
+
const s2_y = q2[1] - q1[1];
|
|
19253
|
+
const denom = -s2_x * s1_y + s1_x * s2_y;
|
|
19254
|
+
if (Math.abs(denom) < 1e-8) {
|
|
19255
|
+
return null;
|
|
19256
|
+
}
|
|
19257
|
+
const s = (-s1_y * (p1[0] - q1[0]) + s1_x * (p1[1] - q1[1])) / denom;
|
|
19258
|
+
const t = (s2_x * (p1[1] - q1[1]) - s2_y * (p1[0] - q1[0])) / denom;
|
|
19259
|
+
if (s >= 0 && s <= 1 && t >= 0 && t <= 1) {
|
|
19260
|
+
return [p1[0] + t * s1_x, p1[1] + t * s1_y];
|
|
19261
|
+
}
|
|
19262
|
+
return null;
|
|
19263
|
+
}
|
|
19264
|
+
const viewportsInfo = this._getViewportsInfo();
|
|
19265
|
+
if (!viewportsInfo || viewportsInfo.length === 0) {
|
|
19266
|
+
return false;
|
|
19267
|
+
}
|
|
19268
|
+
let renderStatus = false;
|
|
19269
|
+
const { viewport, renderingEngine } = enabledElement;
|
|
19270
|
+
const { element } = viewport;
|
|
19271
|
+
let annotations = this._getAnnotations(enabledElement);
|
|
19272
|
+
if (this._virtualAnnotations && this._virtualAnnotations.length) {
|
|
19273
|
+
annotations = annotations.concat(this._virtualAnnotations);
|
|
19274
|
+
}
|
|
19275
|
+
const camera = viewport.getCamera();
|
|
19276
|
+
const filteredToolAnnotations = this.filterInteractableAnnotationsForElement(element, annotations);
|
|
19277
|
+
const viewportAnnotation = filteredToolAnnotations[0];
|
|
19278
|
+
if (!viewportAnnotation || !viewportAnnotation.data) {
|
|
19279
|
+
return renderStatus;
|
|
19280
|
+
}
|
|
19281
|
+
const annotationUID = viewportAnnotation.annotationUID;
|
|
19282
|
+
const { clientWidth, clientHeight } = viewport.canvas;
|
|
19283
|
+
const canvasDiagonalLength = Math.sqrt(clientWidth * clientWidth + clientHeight * clientHeight);
|
|
19284
|
+
const data = viewportAnnotation.data;
|
|
19285
|
+
const otherViewportAnnotations = annotations;
|
|
19286
|
+
const volumeCroppingCenterCanvasMin = viewport.worldToCanvas(this.toolCenterMin);
|
|
19287
|
+
const volumeCroppingCenterCanvasMax = viewport.worldToCanvas(this.toolCenterMax);
|
|
19288
|
+
const referenceLines = [];
|
|
19289
|
+
const canvasBox = [0, 0, clientWidth, clientHeight];
|
|
19290
|
+
otherViewportAnnotations.forEach((annotation) => {
|
|
19291
|
+
const data = annotation.data;
|
|
19292
|
+
const isVirtual = 'isVirtual' in annotation &&
|
|
19293
|
+
annotation.isVirtual === true;
|
|
19294
|
+
data.handles.toolCenter = this.toolCenter;
|
|
19295
|
+
let otherViewport, otherCamera, clientWidth, clientHeight, otherCanvasDiagonalLength, otherCanvasCenter, otherViewportCenterWorld;
|
|
19296
|
+
if (isVirtual) {
|
|
19297
|
+
const realViewports = viewportsInfo.filter((vp) => vp.viewportId !== data.viewportId);
|
|
19298
|
+
if (realViewports.length === 2) {
|
|
19299
|
+
const vp1 = renderingEngine.getViewport(realViewports[0].viewportId);
|
|
19300
|
+
const vp2 = renderingEngine.getViewport(realViewports[1].viewportId);
|
|
19301
|
+
const normal1 = vp1.getCamera().viewPlaneNormal;
|
|
19302
|
+
const normal2 = vp2.getCamera().viewPlaneNormal;
|
|
19303
|
+
const virtualNormal = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
|
|
19304
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.cross */ .eR.cross(virtualNormal, normal1, normal2);
|
|
19305
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.normalize */ .eR.normalize(virtualNormal, virtualNormal);
|
|
19306
|
+
otherCamera = {
|
|
19307
|
+
viewPlaneNormal: virtualNormal,
|
|
19308
|
+
position: data.handles.toolCenter,
|
|
19309
|
+
focalPoint: data.handles.toolCenter,
|
|
19310
|
+
viewUp: [0, 1, 0],
|
|
19311
|
+
};
|
|
19312
|
+
clientWidth = viewport.canvas.clientWidth;
|
|
19313
|
+
clientHeight = viewport.canvas.clientHeight;
|
|
19314
|
+
otherCanvasDiagonalLength = Math.sqrt(clientWidth * clientWidth + clientHeight * clientHeight);
|
|
19315
|
+
otherCanvasCenter = [clientWidth * 0.5, clientHeight * 0.5];
|
|
19316
|
+
otherViewportCenterWorld = data.handles.toolCenter;
|
|
19317
|
+
otherViewport = {
|
|
19318
|
+
id: data.viewportId,
|
|
19319
|
+
canvas: viewport.canvas,
|
|
19320
|
+
canvasToWorld: () => data.handles.toolCenter,
|
|
19321
|
+
};
|
|
19322
|
+
}
|
|
19323
|
+
else {
|
|
19324
|
+
const virtualNormal = annotation
|
|
19325
|
+
.virtualNormal ?? [0, 0, 1];
|
|
19326
|
+
otherCamera = {
|
|
19327
|
+
viewPlaneNormal: virtualNormal,
|
|
19328
|
+
position: data.handles.toolCenter,
|
|
19329
|
+
focalPoint: data.handles.toolCenter,
|
|
19330
|
+
viewUp: [0, 1, 0],
|
|
19331
|
+
};
|
|
19332
|
+
clientWidth = viewport.canvas.clientWidth;
|
|
19333
|
+
clientHeight = viewport.canvas.clientHeight;
|
|
19334
|
+
otherCanvasDiagonalLength = Math.sqrt(clientWidth * clientWidth + clientHeight * clientHeight);
|
|
19335
|
+
otherCanvasCenter = [clientWidth * 0.5, clientHeight * 0.5];
|
|
19336
|
+
otherViewportCenterWorld = data.handles.toolCenter;
|
|
19337
|
+
otherViewport = {
|
|
19338
|
+
id: data.viewportId,
|
|
19339
|
+
canvas: viewport.canvas,
|
|
19340
|
+
canvasToWorld: () => data.handles.toolCenter,
|
|
19341
|
+
};
|
|
19342
|
+
}
|
|
19343
|
+
}
|
|
19344
|
+
else {
|
|
19345
|
+
otherViewport = renderingEngine.getViewport(data.viewportId);
|
|
19346
|
+
otherCamera = otherViewport.getCamera();
|
|
19347
|
+
clientWidth = otherViewport.canvas.clientWidth;
|
|
19348
|
+
clientHeight = otherViewport.canvas.clientHeight;
|
|
19349
|
+
otherCanvasDiagonalLength = Math.sqrt(clientWidth * clientWidth + clientHeight * clientHeight);
|
|
19350
|
+
otherCanvasCenter = [clientWidth * 0.5, clientHeight * 0.5];
|
|
19351
|
+
otherViewportCenterWorld =
|
|
19352
|
+
otherViewport.canvasToWorld(otherCanvasCenter);
|
|
19353
|
+
}
|
|
19354
|
+
const otherViewportControllable = this._getReferenceLineControllable(otherViewport.id);
|
|
19355
|
+
const direction = [0, 0, 0];
|
|
19356
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_1__/* ["default"].cross */ .Ay.cross(camera.viewPlaneNormal, otherCamera.viewPlaneNormal, direction);
|
|
19357
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_1__/* ["default"].normalize */ .Ay.normalize(direction);
|
|
19358
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_1__/* ["default"].multiplyScalar */ .Ay.multiplyScalar(direction, otherCanvasDiagonalLength);
|
|
19359
|
+
const pointWorld0 = [0, 0, 0];
|
|
19360
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_1__/* ["default"].add */ .Ay.add(otherViewportCenterWorld, direction, pointWorld0);
|
|
19361
|
+
const pointWorld1 = [0, 0, 0];
|
|
19362
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_1__/* ["default"].subtract */ .Ay.subtract(otherViewportCenterWorld, direction, pointWorld1);
|
|
19363
|
+
const pointCanvas0 = viewport.worldToCanvas(pointWorld0);
|
|
19364
|
+
const otherViewportCenterCanvas = viewport.worldToCanvas([
|
|
19365
|
+
otherViewportCenterWorld[0] ?? 0,
|
|
19366
|
+
otherViewportCenterWorld[1] ?? 0,
|
|
19367
|
+
otherViewportCenterWorld[2] ?? 0,
|
|
19368
|
+
]);
|
|
19369
|
+
const canvasUnitVectorFromCenter = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.create */ .Zc.create();
|
|
19370
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.subtract */ .Zc.subtract(canvasUnitVectorFromCenter, pointCanvas0, otherViewportCenterCanvas);
|
|
19371
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.normalize */ .Zc.normalize(canvasUnitVectorFromCenter, canvasUnitVectorFromCenter);
|
|
19372
|
+
const canvasVectorFromCenterLong = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.create */ .Zc.create();
|
|
19373
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.scale */ .Zc.scale(canvasVectorFromCenterLong, canvasUnitVectorFromCenter, canvasDiagonalLength * 100);
|
|
19374
|
+
const refLinesCenterMin = otherViewportControllable
|
|
19375
|
+
? gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.clone */ .Zc.clone(volumeCroppingCenterCanvasMin)
|
|
19376
|
+
: gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.clone */ .Zc.clone(otherViewportCenterCanvas);
|
|
19377
|
+
const refLinePointMinOne = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.create */ .Zc.create();
|
|
19378
|
+
const refLinePointMinTwo = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.create */ .Zc.create();
|
|
19379
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.add */ .Zc.add(refLinePointMinOne, refLinesCenterMin, canvasVectorFromCenterLong);
|
|
19380
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.subtract */ .Zc.subtract(refLinePointMinTwo, refLinesCenterMin, canvasVectorFromCenterLong);
|
|
19381
|
+
(0,_utilities_math_vec2_liangBarksyClip__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .A)(refLinePointMinOne, refLinePointMinTwo, canvasBox);
|
|
19382
|
+
referenceLines.push([
|
|
19383
|
+
otherViewport,
|
|
19384
|
+
refLinePointMinOne,
|
|
19385
|
+
refLinePointMinTwo,
|
|
19386
|
+
'min',
|
|
19387
|
+
]);
|
|
19388
|
+
const refLinesCenterMax = otherViewportControllable
|
|
19389
|
+
? gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.clone */ .Zc.clone(volumeCroppingCenterCanvasMax)
|
|
19390
|
+
: gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.clone */ .Zc.clone(otherViewportCenterCanvas);
|
|
19391
|
+
const refLinePointMaxOne = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.create */ .Zc.create();
|
|
19392
|
+
const refLinePointMaxTwo = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.create */ .Zc.create();
|
|
19393
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.add */ .Zc.add(refLinePointMaxOne, refLinesCenterMax, canvasVectorFromCenterLong);
|
|
19394
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.subtract */ .Zc.subtract(refLinePointMaxTwo, refLinesCenterMax, canvasVectorFromCenterLong);
|
|
19395
|
+
(0,_utilities_math_vec2_liangBarksyClip__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .A)(refLinePointMaxOne, refLinePointMaxTwo, canvasBox);
|
|
19396
|
+
referenceLines.push([
|
|
19397
|
+
otherViewport,
|
|
19398
|
+
refLinePointMaxOne,
|
|
19399
|
+
refLinePointMaxTwo,
|
|
19400
|
+
'max',
|
|
19401
|
+
]);
|
|
19402
|
+
});
|
|
19403
|
+
data.referenceLines = referenceLines;
|
|
19404
|
+
const viewportColor = this._getReferenceLineColor(viewport.id);
|
|
19405
|
+
const color = viewportColor !== undefined ? viewportColor : 'rgb(200, 200, 200)';
|
|
19406
|
+
referenceLines.forEach((line, lineIndex) => {
|
|
19407
|
+
const intersections = [];
|
|
19408
|
+
for (let j = 0; j < referenceLines.length; ++j) {
|
|
19409
|
+
if (j === lineIndex) {
|
|
19410
|
+
continue;
|
|
19411
|
+
}
|
|
19412
|
+
const otherLine = referenceLines[j];
|
|
19413
|
+
const intersection = lineIntersection2D(line[1], line[2], otherLine[1], otherLine[2]);
|
|
19414
|
+
if (intersection) {
|
|
19415
|
+
intersections.push({
|
|
19416
|
+
with: otherLine[3],
|
|
19417
|
+
point: intersection,
|
|
19418
|
+
});
|
|
19419
|
+
}
|
|
19420
|
+
}
|
|
19421
|
+
const otherViewport = line[0];
|
|
19422
|
+
let orientation = null;
|
|
19423
|
+
if (otherViewport && otherViewport.id) {
|
|
19424
|
+
const annotationForViewport = annotations.find((a) => a.data.viewportId === otherViewport.id);
|
|
19425
|
+
if (annotationForViewport && annotationForViewport.data.orientation) {
|
|
19426
|
+
orientation = String(annotationForViewport.data.orientation).toUpperCase();
|
|
19427
|
+
}
|
|
19428
|
+
else {
|
|
19429
|
+
const idUpper = otherViewport.id.toUpperCase();
|
|
19430
|
+
if (idUpper.includes('AXIAL')) {
|
|
19431
|
+
orientation = 'AXIAL';
|
|
19432
|
+
}
|
|
19433
|
+
else if (idUpper.includes('CORONAL')) {
|
|
19434
|
+
orientation = 'CORONAL';
|
|
19435
|
+
}
|
|
19436
|
+
else if (idUpper.includes('SAGITTAL')) {
|
|
19437
|
+
orientation = 'SAGITTAL';
|
|
19438
|
+
}
|
|
19439
|
+
}
|
|
19440
|
+
}
|
|
19441
|
+
const lineColors = this.configuration.lineColors || {};
|
|
19442
|
+
const colorArr = lineColors[orientation] ||
|
|
19443
|
+
lineColors.unknown || [1.0, 0.0, 0.0];
|
|
19444
|
+
const color = Array.isArray(colorArr)
|
|
19445
|
+
? `rgb(${colorArr.map((v) => Math.round(v * 255)).join(',')})`
|
|
19446
|
+
: colorArr;
|
|
19447
|
+
const viewportControllable = this._getReferenceLineControllable(otherViewport.id);
|
|
19448
|
+
const selectedViewportId = data.activeViewportIds.find((id) => id === otherViewport.id);
|
|
19449
|
+
let lineWidth = this.configuration.lineWidth ?? 1.5;
|
|
19450
|
+
const lineActive = data.handles.activeOperation !== null &&
|
|
19451
|
+
data.handles.activeOperation === OPERATION.DRAG &&
|
|
19452
|
+
selectedViewportId;
|
|
19453
|
+
if (lineActive) {
|
|
19454
|
+
lineWidth = this.configuration.activeLineWidth ?? 2.5;
|
|
19455
|
+
}
|
|
19456
|
+
const lineUID = `${lineIndex}`;
|
|
19457
|
+
if (viewportControllable) {
|
|
19458
|
+
if (intersections.length === 2) {
|
|
19459
|
+
(0,_drawingSvg__WEBPACK_IMPORTED_MODULE_6__.drawLine)(svgDrawingHelper, annotationUID, lineUID, intersections[0].point, intersections[1].point, {
|
|
19460
|
+
color,
|
|
19461
|
+
lineWidth,
|
|
19462
|
+
});
|
|
19463
|
+
}
|
|
19464
|
+
if (this.configuration.extendReferenceLines &&
|
|
19465
|
+
intersections.length === 2) {
|
|
19466
|
+
if (this.configuration.extendReferenceLines &&
|
|
19467
|
+
intersections.length === 2) {
|
|
19468
|
+
const sortedIntersections = intersections
|
|
19469
|
+
.map((intersection) => ({
|
|
19470
|
+
...intersection,
|
|
19471
|
+
distance: gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec2.distance */ .Zc.distance(line[1], intersection.point),
|
|
19472
|
+
}))
|
|
19473
|
+
.sort((a, b) => a.distance - b.distance);
|
|
19474
|
+
(0,_drawingSvg__WEBPACK_IMPORTED_MODULE_6__.drawLine)(svgDrawingHelper, annotationUID, lineUID + '_dashed_before', line[1], sortedIntersections[0].point, { color, lineWidth, lineDash: [4, 4] });
|
|
19475
|
+
(0,_drawingSvg__WEBPACK_IMPORTED_MODULE_6__.drawLine)(svgDrawingHelper, annotationUID, lineUID + '_dashed_after', sortedIntersections[1].point, line[2], { color, lineWidth, lineDash: [4, 4] });
|
|
19476
|
+
}
|
|
19477
|
+
}
|
|
19478
|
+
}
|
|
19479
|
+
});
|
|
19480
|
+
renderStatus = true;
|
|
19481
|
+
if (this.configuration.viewportIndicators) {
|
|
19482
|
+
const { viewportIndicatorsConfig } = this.configuration;
|
|
19483
|
+
const xOffset = viewportIndicatorsConfig?.xOffset || 0.95;
|
|
19484
|
+
const yOffset = viewportIndicatorsConfig?.yOffset || 0.05;
|
|
19485
|
+
const referenceColorCoordinates = [
|
|
19486
|
+
clientWidth * xOffset,
|
|
19487
|
+
clientHeight * yOffset,
|
|
19488
|
+
];
|
|
19489
|
+
const circleRadius = viewportIndicatorsConfig?.circleRadius || canvasDiagonalLength * 0.01;
|
|
19490
|
+
const circleUID = '0';
|
|
19491
|
+
(0,_drawingSvg__WEBPACK_IMPORTED_MODULE_6__.drawCircle)(svgDrawingHelper, annotationUID, circleUID, referenceColorCoordinates, circleRadius, { color, fill: color });
|
|
19492
|
+
}
|
|
19493
|
+
return renderStatus;
|
|
19494
|
+
};
|
|
19495
|
+
this._getAnnotations = (enabledElement) => {
|
|
19496
|
+
const { viewport } = enabledElement;
|
|
19497
|
+
const annotations = (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.getAnnotations)(this.getToolName(), viewport.element) || [];
|
|
19498
|
+
const viewportIds = this._getViewportsInfo().map(({ viewportId }) => viewportId);
|
|
19499
|
+
const toolGroupAnnotations = annotations.filter((annotation) => {
|
|
19500
|
+
const { data } = annotation;
|
|
19501
|
+
return viewportIds.includes(data.viewportId);
|
|
19502
|
+
});
|
|
19503
|
+
return toolGroupAnnotations;
|
|
19504
|
+
};
|
|
19505
|
+
this._onSphereMoved = (evt) => {
|
|
19506
|
+
if (evt.detail.originalClippingPlanes) {
|
|
19507
|
+
this._syncWithVolumeCroppingTool(evt.detail.originalClippingPlanes);
|
|
19508
|
+
}
|
|
19509
|
+
else {
|
|
19510
|
+
if (evt.detail.seriesInstanceUID !== this.seriesInstanceUID) {
|
|
19511
|
+
return;
|
|
19512
|
+
}
|
|
19513
|
+
const { draggingSphereIndex, toolCenter } = evt.detail;
|
|
19514
|
+
const newMin = [...this.toolCenterMin];
|
|
19515
|
+
const newMax = [...this.toolCenterMax];
|
|
19516
|
+
if (draggingSphereIndex >= 0 && draggingSphereIndex <= 5) {
|
|
19517
|
+
const axis = Math.floor(draggingSphereIndex / 2);
|
|
19518
|
+
const isMin = draggingSphereIndex % 2 === 0;
|
|
19519
|
+
(isMin ? newMin : newMax)[axis] = toolCenter[axis];
|
|
19520
|
+
this.setToolCenter(newMin, 'min');
|
|
19521
|
+
this.setToolCenter(newMax, 'max');
|
|
19522
|
+
return;
|
|
19523
|
+
}
|
|
19524
|
+
if (draggingSphereIndex >= 6 && draggingSphereIndex <= 13) {
|
|
19525
|
+
const idx = draggingSphereIndex;
|
|
19526
|
+
if (idx < 10) {
|
|
19527
|
+
newMin[0] = toolCenter[0];
|
|
19528
|
+
}
|
|
19529
|
+
else {
|
|
19530
|
+
newMax[0] = toolCenter[0];
|
|
19531
|
+
}
|
|
19532
|
+
if ([6, 7, 10, 11].includes(idx)) {
|
|
19533
|
+
newMin[1] = toolCenter[1];
|
|
19534
|
+
}
|
|
19535
|
+
else {
|
|
19536
|
+
newMax[1] = toolCenter[1];
|
|
19537
|
+
}
|
|
19538
|
+
if (idx % 2 === 0) {
|
|
19539
|
+
newMin[2] = toolCenter[2];
|
|
19540
|
+
}
|
|
19541
|
+
else {
|
|
19542
|
+
newMax[2] = toolCenter[2];
|
|
19543
|
+
}
|
|
19544
|
+
this.setToolCenter(newMin, 'min');
|
|
19545
|
+
this.setToolCenter(newMax, 'max');
|
|
19546
|
+
}
|
|
19547
|
+
}
|
|
19548
|
+
};
|
|
19549
|
+
this._onNewVolume = () => {
|
|
19550
|
+
const viewportsInfo = this._getViewportsInfo();
|
|
19551
|
+
if (viewportsInfo && viewportsInfo.length > 0) {
|
|
19552
|
+
const { viewportId, renderingEngineId } = viewportsInfo[0];
|
|
19553
|
+
const renderingEngine = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getRenderingEngine)(renderingEngineId);
|
|
19554
|
+
const viewport = renderingEngine.getViewport(viewportId);
|
|
19555
|
+
const volumeActors = viewport.getActors();
|
|
19556
|
+
if (volumeActors.length > 0) {
|
|
19557
|
+
const imageData = volumeActors[0].actor.getMapper().getInputData();
|
|
19558
|
+
if (imageData) {
|
|
19559
|
+
this.seriesInstanceUID = imageData.seriesInstanceUID;
|
|
19560
|
+
this._updateToolCentersFromViewport(viewport);
|
|
19561
|
+
const annotations = (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.getAnnotations)(this.getToolName(), viewportId) || [];
|
|
19562
|
+
annotations.forEach((annotation) => {
|
|
19563
|
+
if (annotation.data && annotation.data.handles) {
|
|
19564
|
+
annotation.data.handles.toolCenter = [...this.toolCenter];
|
|
19565
|
+
}
|
|
19566
|
+
});
|
|
19567
|
+
}
|
|
19568
|
+
}
|
|
19569
|
+
}
|
|
19570
|
+
this._computeToolCenter(viewportsInfo);
|
|
19571
|
+
(0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.triggerEvent)(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.eventTarget, _enums__WEBPACK_IMPORTED_MODULE_8__.Events.VOLUMECROPPINGCONTROL_TOOL_CHANGED, {
|
|
19572
|
+
toolGroupId: this.toolGroupId,
|
|
19573
|
+
viewportsInfo: viewportsInfo,
|
|
19574
|
+
seriesInstanceUID: this.seriesInstanceUID,
|
|
19575
|
+
});
|
|
19576
|
+
};
|
|
19577
|
+
this._getAnnotationsForViewportsWithDifferentCameras = (enabledElement, annotations) => {
|
|
19578
|
+
const { viewportId, renderingEngine, viewport } = enabledElement;
|
|
19579
|
+
const otherViewportAnnotations = annotations.filter((annotation) => annotation.data.viewportId !== viewportId);
|
|
19580
|
+
if (!otherViewportAnnotations || !otherViewportAnnotations.length) {
|
|
19581
|
+
return [];
|
|
19582
|
+
}
|
|
19583
|
+
const camera = viewport.getCamera();
|
|
19584
|
+
const { viewPlaneNormal, position } = camera;
|
|
19585
|
+
const viewportsWithDifferentCameras = otherViewportAnnotations.filter((annotation) => {
|
|
19586
|
+
const { viewportId } = annotation.data;
|
|
19587
|
+
const targetViewport = renderingEngine.getViewport(viewportId);
|
|
19588
|
+
const cameraOfTarget = targetViewport.getCamera();
|
|
19589
|
+
return !(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.utilities.isEqual(cameraOfTarget.viewPlaneNormal, viewPlaneNormal, 1e-2) && _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.utilities.isEqual(cameraOfTarget.position, position, 1));
|
|
19590
|
+
});
|
|
19591
|
+
return viewportsWithDifferentCameras;
|
|
19592
|
+
};
|
|
19593
|
+
this._filterViewportWithSameOrientation = (enabledElement, referenceAnnotation, annotations) => {
|
|
19594
|
+
const { renderingEngine } = enabledElement;
|
|
19595
|
+
const { data } = referenceAnnotation;
|
|
19596
|
+
const viewport = renderingEngine.getViewport(data.viewportId);
|
|
19597
|
+
const linkedViewportAnnotations = annotations.filter((annotation) => {
|
|
19598
|
+
const { data } = annotation;
|
|
19599
|
+
const otherViewport = renderingEngine.getViewport(data.viewportId);
|
|
19600
|
+
const otherViewportControllable = this._getReferenceLineControllable(otherViewport.id);
|
|
19601
|
+
return otherViewportControllable === true;
|
|
19602
|
+
});
|
|
19603
|
+
if (!linkedViewportAnnotations || !linkedViewportAnnotations.length) {
|
|
19604
|
+
return [];
|
|
19605
|
+
}
|
|
19606
|
+
const camera = viewport.getCamera();
|
|
19607
|
+
const viewPlaneNormal = camera.viewPlaneNormal;
|
|
19608
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_1__/* ["default"].normalize */ .Ay.normalize(viewPlaneNormal);
|
|
19609
|
+
const otherViewportsAnnotationsWithSameCameraDirection = linkedViewportAnnotations.filter((annotation) => {
|
|
19610
|
+
const { viewportId } = annotation.data;
|
|
19611
|
+
const otherViewport = renderingEngine.getViewport(viewportId);
|
|
19612
|
+
const otherCamera = otherViewport.getCamera();
|
|
19613
|
+
const otherViewPlaneNormal = otherCamera.viewPlaneNormal;
|
|
19614
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_1__/* ["default"].normalize */ .Ay.normalize(otherViewPlaneNormal);
|
|
19615
|
+
return (_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.utilities.isEqual(viewPlaneNormal, otherViewPlaneNormal, 1e-2) &&
|
|
19616
|
+
_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.utilities.isEqual(camera.viewUp, otherCamera.viewUp, 1e-2));
|
|
19617
|
+
});
|
|
19618
|
+
return otherViewportsAnnotationsWithSameCameraDirection;
|
|
19619
|
+
};
|
|
19620
|
+
this._activateModify = (element) => {
|
|
19621
|
+
_store_state__WEBPACK_IMPORTED_MODULE_7__/* .state */ .wk.isInteractingWithTool = !this.configuration.mobile?.enabled;
|
|
19622
|
+
element.addEventListener(_enums__WEBPACK_IMPORTED_MODULE_8__.Events.MOUSE_UP, this._endCallback);
|
|
19623
|
+
element.addEventListener(_enums__WEBPACK_IMPORTED_MODULE_8__.Events.MOUSE_DRAG, this._dragCallback);
|
|
19624
|
+
element.addEventListener(_enums__WEBPACK_IMPORTED_MODULE_8__.Events.MOUSE_CLICK, this._endCallback);
|
|
19625
|
+
element.addEventListener(_enums__WEBPACK_IMPORTED_MODULE_8__.Events.TOUCH_END, this._endCallback);
|
|
19626
|
+
element.addEventListener(_enums__WEBPACK_IMPORTED_MODULE_8__.Events.TOUCH_DRAG, this._dragCallback);
|
|
19627
|
+
element.addEventListener(_enums__WEBPACK_IMPORTED_MODULE_8__.Events.TOUCH_TAP, this._endCallback);
|
|
19628
|
+
};
|
|
19629
|
+
this._deactivateModify = (element) => {
|
|
19630
|
+
_store_state__WEBPACK_IMPORTED_MODULE_7__/* .state */ .wk.isInteractingWithTool = false;
|
|
19631
|
+
element.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_8__.Events.MOUSE_UP, this._endCallback);
|
|
19632
|
+
element.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_8__.Events.MOUSE_DRAG, this._dragCallback);
|
|
19633
|
+
element.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_8__.Events.MOUSE_CLICK, this._endCallback);
|
|
19634
|
+
element.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_8__.Events.TOUCH_END, this._endCallback);
|
|
19635
|
+
element.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_8__.Events.TOUCH_DRAG, this._dragCallback);
|
|
19636
|
+
element.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_8__.Events.TOUCH_TAP, this._endCallback);
|
|
19637
|
+
};
|
|
19638
|
+
this._endCallback = (evt) => {
|
|
19639
|
+
const eventDetail = evt.detail;
|
|
19640
|
+
const { element } = eventDetail;
|
|
19641
|
+
this.editData.annotation.data.handles.activeOperation = null;
|
|
19642
|
+
this.editData.annotation.data.activeViewportIds = [];
|
|
19643
|
+
this._deactivateModify(element);
|
|
19644
|
+
(0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_10__.resetElementCursor)(element);
|
|
19645
|
+
this.editData = null;
|
|
19646
|
+
const requireSameOrientation = false;
|
|
19647
|
+
const viewportIdsToRender = (0,_utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_9__.getViewportIdsWithToolToRender)(element, this.getToolName(), requireSameOrientation);
|
|
19648
|
+
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .A)(viewportIdsToRender);
|
|
19649
|
+
};
|
|
19650
|
+
this._dragCallback = (evt) => {
|
|
19651
|
+
const eventDetail = evt.detail;
|
|
19652
|
+
const delta = eventDetail.deltaPoints.world;
|
|
19653
|
+
if (Math.abs(delta[0]) < 1e-3 &&
|
|
19654
|
+
Math.abs(delta[1]) < 1e-3 &&
|
|
19655
|
+
Math.abs(delta[2]) < 1e-3) {
|
|
19656
|
+
return;
|
|
19657
|
+
}
|
|
19658
|
+
const { element } = eventDetail;
|
|
19659
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getEnabledElement)(element);
|
|
19660
|
+
const { viewport } = enabledElement;
|
|
19661
|
+
if (viewport.type === _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.Enums.ViewportType.VOLUME_3D) {
|
|
19662
|
+
return;
|
|
19663
|
+
}
|
|
19664
|
+
const annotations = this._getAnnotations(enabledElement);
|
|
19665
|
+
const filteredToolAnnotations = this.filterInteractableAnnotationsForElement(element, annotations);
|
|
19666
|
+
const viewportAnnotation = filteredToolAnnotations[0];
|
|
19667
|
+
if (!viewportAnnotation) {
|
|
19668
|
+
return;
|
|
19669
|
+
}
|
|
19670
|
+
const { handles } = viewportAnnotation.data;
|
|
19671
|
+
if (handles.activeOperation === OPERATION.DRAG) {
|
|
19672
|
+
if (handles.activeType === 'min') {
|
|
19673
|
+
this.toolCenterMin[0] += delta[0];
|
|
19674
|
+
this.toolCenterMin[1] += delta[1];
|
|
19675
|
+
this.toolCenterMin[2] += delta[2];
|
|
19676
|
+
}
|
|
19677
|
+
else if (handles.activeType === 'max') {
|
|
19678
|
+
this.toolCenterMax[0] += delta[0];
|
|
19679
|
+
this.toolCenterMax[1] += delta[1];
|
|
19680
|
+
this.toolCenterMax[2] += delta[2];
|
|
19681
|
+
}
|
|
19682
|
+
else {
|
|
19683
|
+
this.toolCenter[0] += delta[0];
|
|
19684
|
+
this.toolCenter[1] += delta[1];
|
|
19685
|
+
this.toolCenter[2] += delta[2];
|
|
19686
|
+
}
|
|
19687
|
+
const viewportsInfo = this._getViewportsInfo();
|
|
19688
|
+
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .A)(viewportsInfo.map(({ viewportId }) => viewportId));
|
|
19689
|
+
(0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.triggerEvent)(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.eventTarget, _enums__WEBPACK_IMPORTED_MODULE_8__.Events.VOLUMECROPPINGCONTROL_TOOL_CHANGED, {
|
|
19690
|
+
toolGroupId: this.toolGroupId,
|
|
19691
|
+
toolCenter: this.toolCenter,
|
|
19692
|
+
toolCenterMin: this.toolCenterMin,
|
|
19693
|
+
toolCenterMax: this.toolCenterMax,
|
|
19694
|
+
handleType: handles.activeType,
|
|
19695
|
+
viewportOrientation: [],
|
|
19696
|
+
seriesInstanceUID: this.seriesInstanceUID,
|
|
19697
|
+
});
|
|
19698
|
+
}
|
|
19699
|
+
};
|
|
19700
|
+
this._getReferenceLineColor =
|
|
19701
|
+
toolProps.configuration?.getReferenceLineColor ||
|
|
19702
|
+
defaultReferenceLineColor;
|
|
19703
|
+
this._getReferenceLineControllable =
|
|
19704
|
+
toolProps.configuration?.getReferenceLineControllable ||
|
|
19705
|
+
defaultReferenceLineControllable;
|
|
19706
|
+
const viewportsInfo = (0,_store_ToolGroupManager__WEBPACK_IMPORTED_MODULE_4__.getToolGroup)(this.toolGroupId)?.viewportsInfo;
|
|
19707
|
+
_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.eventTarget.addEventListener(_enums__WEBPACK_IMPORTED_MODULE_8__.Events.VOLUMECROPPING_TOOL_CHANGED, this._onSphereMoved);
|
|
19708
|
+
if (viewportsInfo && viewportsInfo.length > 0) {
|
|
19709
|
+
const { viewportId, renderingEngineId } = viewportsInfo[0];
|
|
19710
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getEnabledElementByIds)(viewportId, renderingEngineId);
|
|
19711
|
+
const renderingEngine = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getRenderingEngine)(renderingEngineId);
|
|
19712
|
+
const viewport = renderingEngine.getViewport(viewportId);
|
|
19713
|
+
const volumeActors = viewport.getActors();
|
|
19714
|
+
if (!volumeActors || !volumeActors.length) {
|
|
19715
|
+
console.warn(`VolumeCroppingControlTool: No volume actors found in viewport ${viewportId}.`);
|
|
19716
|
+
return;
|
|
19717
|
+
}
|
|
19718
|
+
const imageData = volumeActors[0].actor.getMapper().getInputData();
|
|
19719
|
+
if (imageData) {
|
|
19720
|
+
const dimensions = imageData.getDimensions();
|
|
19721
|
+
const spacing = imageData.getSpacing();
|
|
19722
|
+
const origin = imageData.getOrigin();
|
|
19723
|
+
this.seriesInstanceUID = imageData.seriesInstanceUID || 'unknown';
|
|
19724
|
+
const cropFactor = this.configuration.initialCropFactor ?? 0.2;
|
|
19725
|
+
this.toolCenter = [
|
|
19726
|
+
origin[0] + cropFactor * (dimensions[0] - 1) * spacing[0],
|
|
19727
|
+
origin[1] + cropFactor * (dimensions[1] - 1) * spacing[1],
|
|
19728
|
+
origin[2] + cropFactor * (dimensions[2] - 1) * spacing[2],
|
|
19729
|
+
];
|
|
19730
|
+
const maxCropFactor = 1 - cropFactor;
|
|
19731
|
+
this.toolCenterMin = [
|
|
19732
|
+
origin[0] + cropFactor * (dimensions[0] - 1) * spacing[0],
|
|
19733
|
+
origin[1] + cropFactor * (dimensions[1] - 1) * spacing[1],
|
|
19734
|
+
origin[2] + cropFactor * (dimensions[2] - 1) * spacing[2],
|
|
19735
|
+
];
|
|
19736
|
+
this.toolCenterMax = [
|
|
19737
|
+
origin[0] + maxCropFactor * (dimensions[0] - 1) * spacing[0],
|
|
19738
|
+
origin[1] + maxCropFactor * (dimensions[1] - 1) * spacing[1],
|
|
19739
|
+
origin[2] + maxCropFactor * (dimensions[2] - 1) * spacing[2],
|
|
19740
|
+
];
|
|
19741
|
+
}
|
|
19742
|
+
}
|
|
19743
|
+
}
|
|
19744
|
+
_updateToolCentersFromViewport(viewport) {
|
|
19745
|
+
const volumeActors = viewport.getActors();
|
|
19746
|
+
if (!volumeActors || !volumeActors.length) {
|
|
19747
|
+
return;
|
|
19748
|
+
}
|
|
19749
|
+
const imageData = volumeActors[0].actor.getMapper().getInputData();
|
|
19750
|
+
if (!imageData) {
|
|
19751
|
+
return;
|
|
19752
|
+
}
|
|
19753
|
+
this.seriesInstanceUID = imageData.seriesInstanceUID || 'unknown';
|
|
19754
|
+
const dimensions = imageData.getDimensions();
|
|
19755
|
+
const spacing = imageData.getSpacing();
|
|
19756
|
+
const origin = imageData.getOrigin();
|
|
19757
|
+
const cropFactor = this.configuration.initialCropFactor ?? 0.2;
|
|
19758
|
+
const cropStart = cropFactor / 2;
|
|
19759
|
+
const cropEnd = 1 - cropFactor / 2;
|
|
19760
|
+
this.toolCenter = [
|
|
19761
|
+
origin[0] +
|
|
19762
|
+
((cropStart + cropEnd) / 2) * (dimensions[0] - 1) * spacing[0],
|
|
19763
|
+
origin[1] +
|
|
19764
|
+
((cropStart + cropEnd) / 2) * (dimensions[1] - 1) * spacing[1],
|
|
19765
|
+
origin[2] +
|
|
19766
|
+
((cropStart + cropEnd) / 2) * (dimensions[2] - 1) * spacing[2],
|
|
19767
|
+
];
|
|
19768
|
+
this.toolCenterMin = [
|
|
19769
|
+
origin[0] + cropStart * (dimensions[0] - 1) * spacing[0],
|
|
19770
|
+
origin[1] + cropStart * (dimensions[1] - 1) * spacing[1],
|
|
19771
|
+
origin[2] + cropStart * (dimensions[2] - 1) * spacing[2],
|
|
19772
|
+
];
|
|
19773
|
+
this.toolCenterMax = [
|
|
19774
|
+
origin[0] + cropEnd * (dimensions[0] - 1) * spacing[0],
|
|
19775
|
+
origin[1] + cropEnd * (dimensions[1] - 1) * spacing[1],
|
|
19776
|
+
origin[2] + cropEnd * (dimensions[2] - 1) * spacing[2],
|
|
19777
|
+
];
|
|
19778
|
+
}
|
|
19779
|
+
onSetToolInactive() {
|
|
19780
|
+
console.debug(`VolumeCroppingControlTool: onSetToolInactive called for tool ${this.getToolName()}`);
|
|
19781
|
+
}
|
|
19782
|
+
onSetToolActive() {
|
|
19783
|
+
const viewportsInfo = this._getViewportsInfo();
|
|
19784
|
+
let anyAnnotationExists = false;
|
|
19785
|
+
for (const vpInfo of viewportsInfo) {
|
|
19786
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getEnabledElementByIds)(vpInfo.viewportId, vpInfo.renderingEngineId);
|
|
19787
|
+
const annotations = this._getAnnotations(enabledElement);
|
|
19788
|
+
if (annotations && annotations.length > 0) {
|
|
19789
|
+
anyAnnotationExists = true;
|
|
19790
|
+
break;
|
|
19791
|
+
}
|
|
19792
|
+
}
|
|
19793
|
+
if (!anyAnnotationExists) {
|
|
19794
|
+
this._unsubscribeToViewportNewVolumeSet(viewportsInfo);
|
|
19795
|
+
this._subscribeToViewportNewVolumeSet(viewportsInfo);
|
|
19796
|
+
this._computeToolCenter(viewportsInfo);
|
|
19797
|
+
(0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.triggerEvent)(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.eventTarget, _enums__WEBPACK_IMPORTED_MODULE_8__.Events.VOLUMECROPPINGCONTROL_TOOL_CHANGED, {
|
|
19798
|
+
toolGroupId: this.toolGroupId,
|
|
19799
|
+
viewportsInfo: viewportsInfo,
|
|
19800
|
+
seriesInstanceUID: this.seriesInstanceUID,
|
|
19801
|
+
});
|
|
19802
|
+
}
|
|
19803
|
+
else {
|
|
19804
|
+
for (const vpInfo of viewportsInfo) {
|
|
19805
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getEnabledElementByIds)(vpInfo.viewportId, vpInfo.renderingEngineId);
|
|
19806
|
+
if (!enabledElement) {
|
|
19807
|
+
continue;
|
|
19808
|
+
}
|
|
19809
|
+
const annotations = this._getAnnotations(enabledElement);
|
|
19810
|
+
if (annotations && annotations.length > 0) {
|
|
19811
|
+
annotations.forEach((annotation) => {
|
|
19812
|
+
(0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.removeAnnotation)(annotation.annotationUID);
|
|
19813
|
+
});
|
|
19814
|
+
}
|
|
19815
|
+
enabledElement.viewport.render();
|
|
19816
|
+
}
|
|
19817
|
+
}
|
|
19818
|
+
}
|
|
19819
|
+
onSetToolEnabled() {
|
|
19820
|
+
console.debug(`VolumeCroppingControlTool: onSetToolEnabled called for tool ${this.getToolName()}`);
|
|
19821
|
+
const viewportsInfo = this._getViewportsInfo();
|
|
19822
|
+
}
|
|
19823
|
+
onSetToolDisabled() {
|
|
19824
|
+
console.debug(`VolumeCroppingControlTool: onSetToolDisabled called for tool ${this.getToolName()}`);
|
|
19825
|
+
const viewportsInfo = this._getViewportsInfo();
|
|
19826
|
+
this._unsubscribeToViewportNewVolumeSet(viewportsInfo);
|
|
19827
|
+
viewportsInfo.forEach(({ renderingEngineId, viewportId }) => {
|
|
19828
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getEnabledElementByIds)(viewportId, renderingEngineId);
|
|
19829
|
+
if (!enabledElement) {
|
|
19830
|
+
return;
|
|
19831
|
+
}
|
|
19832
|
+
const annotations = this._getAnnotations(enabledElement);
|
|
19833
|
+
if (annotations?.length) {
|
|
19834
|
+
annotations.forEach((annotation) => {
|
|
19835
|
+
(0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.removeAnnotation)(annotation.annotationUID);
|
|
19836
|
+
});
|
|
19837
|
+
}
|
|
19838
|
+
});
|
|
19839
|
+
}
|
|
19840
|
+
_getOrientationFromNormal(normal) {
|
|
19841
|
+
if (!normal) {
|
|
19842
|
+
return null;
|
|
19843
|
+
}
|
|
19844
|
+
const canonical = {
|
|
19845
|
+
AXIAL: [0, 0, 1],
|
|
19846
|
+
CORONAL: [0, 1, 0],
|
|
19847
|
+
SAGITTAL: [1, 0, 0],
|
|
19848
|
+
};
|
|
19849
|
+
const tol = 1e-2;
|
|
19850
|
+
for (const [key, value] of Object.entries(canonical)) {
|
|
19851
|
+
if (Math.abs(normal[0] - value[0]) < tol &&
|
|
19852
|
+
Math.abs(normal[1] - value[1]) < tol &&
|
|
19853
|
+
Math.abs(normal[2] - value[2]) < tol) {
|
|
19854
|
+
return key;
|
|
19855
|
+
}
|
|
19856
|
+
if (Math.abs(normal[0] + value[0]) < tol &&
|
|
19857
|
+
Math.abs(normal[1] + value[1]) < tol &&
|
|
19858
|
+
Math.abs(normal[2] + value[2]) < tol) {
|
|
19859
|
+
return key;
|
|
19860
|
+
}
|
|
19861
|
+
}
|
|
19862
|
+
return null;
|
|
19863
|
+
}
|
|
19864
|
+
_syncWithVolumeCroppingTool(originalClippingPlanes) {
|
|
19865
|
+
const planes = originalClippingPlanes;
|
|
19866
|
+
if (planes.length >= 6) {
|
|
19867
|
+
this.toolCenterMin = [
|
|
19868
|
+
planes[0].origin[0],
|
|
19869
|
+
planes[2].origin[1],
|
|
19870
|
+
planes[4].origin[2],
|
|
19871
|
+
];
|
|
19872
|
+
this.toolCenterMax = [
|
|
19873
|
+
planes[1].origin[0],
|
|
19874
|
+
planes[3].origin[1],
|
|
19875
|
+
planes[5].origin[2],
|
|
19876
|
+
];
|
|
19877
|
+
this.toolCenter = [
|
|
19878
|
+
(this.toolCenterMin[0] + this.toolCenterMax[0]) / 2,
|
|
19879
|
+
(this.toolCenterMin[1] + this.toolCenterMax[1]) / 2,
|
|
19880
|
+
(this.toolCenterMin[2] + this.toolCenterMax[2]) / 2,
|
|
19881
|
+
];
|
|
19882
|
+
const viewportsInfo = this._getViewportsInfo();
|
|
19883
|
+
viewportsInfo.forEach(({ viewportId, renderingEngineId }) => {
|
|
19884
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getEnabledElementByIds)(viewportId, renderingEngineId);
|
|
19885
|
+
if (enabledElement) {
|
|
19886
|
+
const annotations = this._getAnnotations(enabledElement);
|
|
19887
|
+
annotations.forEach((annotation) => {
|
|
19888
|
+
if (annotation.data &&
|
|
19889
|
+
annotation.data.handles &&
|
|
19890
|
+
annotation.data.orientation) {
|
|
19891
|
+
const orientation = annotation.data.orientation;
|
|
19892
|
+
if (orientation === 'AXIAL') {
|
|
19893
|
+
annotation.data.handles.toolCenterMin = [
|
|
19894
|
+
planes[0].origin[0],
|
|
19895
|
+
planes[2].origin[1],
|
|
19896
|
+
annotation.data.handles.toolCenterMin[2],
|
|
19897
|
+
];
|
|
19898
|
+
annotation.data.handles.toolCenterMax = [
|
|
19899
|
+
planes[1].origin[0],
|
|
19900
|
+
planes[3].origin[1],
|
|
19901
|
+
annotation.data.handles.toolCenterMax[2],
|
|
19902
|
+
];
|
|
19903
|
+
}
|
|
19904
|
+
else if (orientation === 'CORONAL') {
|
|
19905
|
+
annotation.data.handles.toolCenterMin = [
|
|
19906
|
+
planes[0].origin[0],
|
|
19907
|
+
annotation.data.handles.toolCenterMin[1],
|
|
19908
|
+
planes[4].origin[2],
|
|
19909
|
+
];
|
|
19910
|
+
annotation.data.handles.toolCenterMax = [
|
|
19911
|
+
planes[1].origin[0],
|
|
19912
|
+
annotation.data.handles.toolCenterMax[1],
|
|
19913
|
+
planes[5].origin[2],
|
|
19914
|
+
];
|
|
19915
|
+
}
|
|
19916
|
+
else if (orientation === 'SAGITTAL') {
|
|
19917
|
+
annotation.data.handles.toolCenterMin = [
|
|
19918
|
+
annotation.data.handles.toolCenterMin[0],
|
|
19919
|
+
planes[2].origin[1],
|
|
19920
|
+
planes[4].origin[2],
|
|
19921
|
+
];
|
|
19922
|
+
annotation.data.handles.toolCenterMax = [
|
|
19923
|
+
annotation.data.handles.toolCenterMax[0],
|
|
19924
|
+
planes[3].origin[1],
|
|
19925
|
+
planes[5].origin[2],
|
|
19926
|
+
];
|
|
19927
|
+
}
|
|
19928
|
+
annotation.data.handles.toolCenter = [
|
|
19929
|
+
(annotation.data.handles.toolCenterMin[0] +
|
|
19930
|
+
annotation.data.handles.toolCenterMax[0]) /
|
|
19931
|
+
2,
|
|
19932
|
+
(annotation.data.handles.toolCenterMin[1] +
|
|
19933
|
+
annotation.data.handles.toolCenterMax[1]) /
|
|
19934
|
+
2,
|
|
19935
|
+
(annotation.data.handles.toolCenterMin[2] +
|
|
19936
|
+
annotation.data.handles.toolCenterMax[2]) /
|
|
19937
|
+
2,
|
|
19938
|
+
];
|
|
19939
|
+
}
|
|
19940
|
+
});
|
|
19941
|
+
}
|
|
19942
|
+
});
|
|
19943
|
+
if (this._virtualAnnotations && this._virtualAnnotations.length > 0) {
|
|
19944
|
+
this._virtualAnnotations.forEach((annotation) => {
|
|
19945
|
+
if (annotation.data &&
|
|
19946
|
+
annotation.data.handles &&
|
|
19947
|
+
annotation.data.orientation) {
|
|
19948
|
+
const orientation = annotation.data.orientation.toUpperCase();
|
|
19949
|
+
if (orientation === 'AXIAL') {
|
|
19950
|
+
annotation.data.handles.toolCenterMin = [
|
|
19951
|
+
planes[0].origin[0],
|
|
19952
|
+
planes[2].origin[1],
|
|
19953
|
+
annotation.data.handles.toolCenterMin[2],
|
|
19954
|
+
];
|
|
19955
|
+
annotation.data.handles.toolCenterMax = [
|
|
19956
|
+
planes[1].origin[0],
|
|
19957
|
+
planes[3].origin[1],
|
|
19958
|
+
annotation.data.handles.toolCenterMax[2],
|
|
19959
|
+
];
|
|
19960
|
+
}
|
|
19961
|
+
else if (orientation === 'CORONAL') {
|
|
19962
|
+
annotation.data.handles.toolCenterMin = [
|
|
19963
|
+
planes[0].origin[0],
|
|
19964
|
+
annotation.data.handles.toolCenterMin[1],
|
|
19965
|
+
planes[4].origin[2],
|
|
19966
|
+
];
|
|
19967
|
+
annotation.data.handles.toolCenterMax = [
|
|
19968
|
+
planes[1].origin[0],
|
|
19969
|
+
annotation.data.handles.toolCenterMax[1],
|
|
19970
|
+
planes[5].origin[2],
|
|
19971
|
+
];
|
|
19972
|
+
}
|
|
19973
|
+
else if (orientation === 'SAGITTAL') {
|
|
19974
|
+
annotation.data.handles.toolCenterMin = [
|
|
19975
|
+
annotation.data.handles.toolCenterMin[0],
|
|
19976
|
+
planes[2].origin[1],
|
|
19977
|
+
planes[4].origin[2],
|
|
19978
|
+
];
|
|
19979
|
+
annotation.data.handles.toolCenterMax = [
|
|
19980
|
+
annotation.data.handles.toolCenterMax[0],
|
|
19981
|
+
planes[3].origin[1],
|
|
19982
|
+
planes[5].origin[2],
|
|
19983
|
+
];
|
|
19984
|
+
}
|
|
19985
|
+
annotation.data.handles.toolCenter = [
|
|
19986
|
+
(annotation.data.handles.toolCenterMin[0] +
|
|
19987
|
+
annotation.data.handles.toolCenterMax[0]) /
|
|
19988
|
+
2,
|
|
19989
|
+
(annotation.data.handles.toolCenterMin[1] +
|
|
19990
|
+
annotation.data.handles.toolCenterMax[1]) /
|
|
19991
|
+
2,
|
|
19992
|
+
(annotation.data.handles.toolCenterMin[2] +
|
|
19993
|
+
annotation.data.handles.toolCenterMax[2]) /
|
|
19994
|
+
2,
|
|
19995
|
+
];
|
|
19996
|
+
}
|
|
19997
|
+
});
|
|
19998
|
+
}
|
|
19999
|
+
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .A)(viewportsInfo.map(({ viewportId }) => viewportId));
|
|
20000
|
+
}
|
|
20001
|
+
}
|
|
20002
|
+
setToolCenter(toolCenter, handleType) {
|
|
20003
|
+
if (handleType === 'min') {
|
|
20004
|
+
this.toolCenterMin = [...toolCenter];
|
|
20005
|
+
}
|
|
20006
|
+
else if (handleType === 'max') {
|
|
20007
|
+
this.toolCenterMax = [...toolCenter];
|
|
20008
|
+
}
|
|
20009
|
+
const viewportsInfo = this._getViewportsInfo();
|
|
20010
|
+
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .A)(viewportsInfo.map(({ viewportId }) => viewportId));
|
|
20011
|
+
}
|
|
20012
|
+
addNewAnnotation(evt) {
|
|
20013
|
+
const eventDetail = evt.detail;
|
|
20014
|
+
const { element } = eventDetail;
|
|
20015
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getEnabledElement)(element);
|
|
20016
|
+
const { viewport } = enabledElement;
|
|
20017
|
+
const annotations = this._getAnnotations(enabledElement);
|
|
20018
|
+
const filteredAnnotations = this.filterInteractableAnnotationsForElement(viewport.element, annotations);
|
|
20019
|
+
if (!filteredAnnotations ||
|
|
20020
|
+
filteredAnnotations.length === 0 ||
|
|
20021
|
+
!filteredAnnotations[0]) {
|
|
20022
|
+
return null;
|
|
20023
|
+
}
|
|
20024
|
+
const { data } = filteredAnnotations[0];
|
|
20025
|
+
const viewportIdArray = [];
|
|
20026
|
+
const referenceLines = data.referenceLines || [];
|
|
20027
|
+
for (let i = 0; i < referenceLines.length; ++i) {
|
|
20028
|
+
const otherViewport = referenceLines[i][0];
|
|
20029
|
+
const viewportControllable = this._getReferenceLineControllable(otherViewport.id);
|
|
20030
|
+
if (!viewportControllable) {
|
|
20031
|
+
continue;
|
|
20032
|
+
}
|
|
20033
|
+
viewportIdArray.push(otherViewport.id);
|
|
20034
|
+
i++;
|
|
20035
|
+
}
|
|
20036
|
+
data.activeViewportIds = [...viewportIdArray];
|
|
20037
|
+
data.handles.activeOperation = OPERATION.DRAG;
|
|
20038
|
+
evt.preventDefault();
|
|
20039
|
+
(0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_10__.hideElementCursor)(element);
|
|
20040
|
+
this._activateModify(element);
|
|
20041
|
+
return filteredAnnotations[0];
|
|
20042
|
+
}
|
|
20043
|
+
handleSelectedCallback(evt, annotation, handle, interactionType) {
|
|
20044
|
+
this.toolSelectedCallback(evt, annotation, interactionType);
|
|
20045
|
+
}
|
|
20046
|
+
_unsubscribeToViewportNewVolumeSet(viewportsInfo) {
|
|
20047
|
+
viewportsInfo.forEach(({ viewportId, renderingEngineId }) => {
|
|
20048
|
+
const { viewport } = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getEnabledElementByIds)(viewportId, renderingEngineId);
|
|
20049
|
+
const { element } = viewport;
|
|
20050
|
+
element.removeEventListener(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.Enums.Events.VOLUME_VIEWPORT_NEW_VOLUME, this._onNewVolume);
|
|
20051
|
+
});
|
|
20052
|
+
}
|
|
20053
|
+
_subscribeToViewportNewVolumeSet(viewports) {
|
|
20054
|
+
viewports.forEach(({ viewportId, renderingEngineId }) => {
|
|
20055
|
+
const { viewport } = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.getEnabledElementByIds)(viewportId, renderingEngineId);
|
|
20056
|
+
const { element } = viewport;
|
|
20057
|
+
element.addEventListener(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_3__.Enums.Events.VOLUME_VIEWPORT_NEW_VOLUME, this._onNewVolume);
|
|
20058
|
+
});
|
|
20059
|
+
}
|
|
20060
|
+
_applyDeltaShiftToSelectedViewportCameras(renderingEngine, viewportsAnnotationsToUpdate, delta) {
|
|
20061
|
+
viewportsAnnotationsToUpdate.forEach((annotation) => {
|
|
20062
|
+
this._applyDeltaShiftToViewportCamera(renderingEngine, annotation, delta);
|
|
20063
|
+
});
|
|
20064
|
+
}
|
|
20065
|
+
_applyDeltaShiftToViewportCamera(renderingEngine, annotation, delta) {
|
|
20066
|
+
const { data } = annotation;
|
|
20067
|
+
const viewport = renderingEngine.getViewport(data.viewportId);
|
|
20068
|
+
const camera = viewport.getCamera();
|
|
20069
|
+
const normal = camera.viewPlaneNormal;
|
|
20070
|
+
const dotProd = _kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_1__/* ["default"].dot */ .Ay.dot(delta, normal);
|
|
20071
|
+
const projectedDelta = [...normal];
|
|
20072
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_1__/* ["default"].multiplyScalar */ .Ay.multiplyScalar(projectedDelta, dotProd);
|
|
20073
|
+
if (Math.abs(projectedDelta[0]) > 1e-3 ||
|
|
20074
|
+
Math.abs(projectedDelta[1]) > 1e-3 ||
|
|
20075
|
+
Math.abs(projectedDelta[2]) > 1e-3) {
|
|
20076
|
+
const newFocalPoint = [0, 0, 0];
|
|
20077
|
+
const newPosition = [0, 0, 0];
|
|
20078
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_1__/* ["default"].add */ .Ay.add(camera.focalPoint, projectedDelta, newFocalPoint);
|
|
20079
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_1__/* ["default"].add */ .Ay.add(camera.position, projectedDelta, newPosition);
|
|
20080
|
+
viewport.setCamera({
|
|
20081
|
+
focalPoint: newFocalPoint,
|
|
20082
|
+
position: newPosition,
|
|
20083
|
+
});
|
|
20084
|
+
viewport.render();
|
|
20085
|
+
}
|
|
20086
|
+
}
|
|
20087
|
+
_pointNearTool(element, annotation, canvasCoords, proximity) {
|
|
20088
|
+
const { data } = annotation;
|
|
20089
|
+
const referenceLines = data.referenceLines;
|
|
20090
|
+
const viewportIdArray = [];
|
|
20091
|
+
if (referenceLines) {
|
|
20092
|
+
for (let i = 0; i < referenceLines.length; ++i) {
|
|
20093
|
+
const otherViewport = referenceLines[i][0];
|
|
20094
|
+
const start1 = referenceLines[i][1];
|
|
20095
|
+
const end1 = referenceLines[i][2];
|
|
20096
|
+
const type = referenceLines[i][3];
|
|
20097
|
+
const distance1 = _utilities_math_line__WEBPACK_IMPORTED_MODULE_12__.distanceToPoint(start1, end1, [
|
|
20098
|
+
canvasCoords[0],
|
|
20099
|
+
canvasCoords[1],
|
|
20100
|
+
]);
|
|
20101
|
+
if (distance1 <= proximity) {
|
|
20102
|
+
viewportIdArray.push(otherViewport.id);
|
|
20103
|
+
data.handles.activeOperation = 1;
|
|
20104
|
+
data.handles.activeType = type;
|
|
20105
|
+
}
|
|
20106
|
+
}
|
|
20107
|
+
}
|
|
20108
|
+
data.activeViewportIds = [...viewportIdArray];
|
|
20109
|
+
this.editData = {
|
|
20110
|
+
annotation,
|
|
20111
|
+
};
|
|
20112
|
+
return data.handles.activeOperation === 1 ? true : false;
|
|
20113
|
+
}
|
|
20114
|
+
}
|
|
20115
|
+
VolumeCroppingControlTool.toolName = 'VolumeCroppingControl';
|
|
20116
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (VolumeCroppingControlTool);
|
|
20117
|
+
|
|
20118
|
+
|
|
18846
20119
|
/***/ }),
|
|
18847
20120
|
|
|
18848
20121
|
/***/ 35706:
|
|
@@ -21334,6 +22607,131 @@ function _handlePTModality(imageId, options) {
|
|
|
21334
22607
|
|
|
21335
22608
|
|
|
21336
22609
|
|
|
22610
|
+
/***/ }),
|
|
22611
|
+
|
|
22612
|
+
/***/ 40905:
|
|
22613
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
22614
|
+
|
|
22615
|
+
"use strict";
|
|
22616
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
22617
|
+
/* harmony export */ S: () => (/* binding */ getStrategyData)
|
|
22618
|
+
/* harmony export */ });
|
|
22619
|
+
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
|
|
22620
|
+
/* harmony import */ var _stateManagement_segmentation_segmentationState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(98870);
|
|
22621
|
+
/* harmony import */ var _stateManagement_segmentation_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(91963);
|
|
22622
|
+
/* harmony import */ var _utilities_segmentation_getReferenceVolumeForSegmentationVolume__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12853);
|
|
22623
|
+
|
|
22624
|
+
|
|
22625
|
+
|
|
22626
|
+
|
|
22627
|
+
function getStrategyDataForVolumeViewport({ operationData }) {
|
|
22628
|
+
const { volumeId } = operationData;
|
|
22629
|
+
if (!volumeId) {
|
|
22630
|
+
const event = new CustomEvent(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.Enums.Events.ERROR_EVENT, {
|
|
22631
|
+
detail: {
|
|
22632
|
+
type: 'Segmentation',
|
|
22633
|
+
message: 'No volume id found for the segmentation',
|
|
22634
|
+
},
|
|
22635
|
+
cancelable: true,
|
|
22636
|
+
});
|
|
22637
|
+
_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.eventTarget.dispatchEvent(event);
|
|
22638
|
+
return null;
|
|
22639
|
+
}
|
|
22640
|
+
const segmentationVolume = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getVolume(volumeId);
|
|
22641
|
+
const imageVolume = (0,_utilities_segmentation_getReferenceVolumeForSegmentationVolume__WEBPACK_IMPORTED_MODULE_3__/* .getReferenceVolumeForSegmentationVolume */ .b)(volumeId);
|
|
22642
|
+
if (!segmentationVolume || !imageVolume) {
|
|
22643
|
+
return null;
|
|
22644
|
+
}
|
|
22645
|
+
const { imageData: segmentationImageData } = segmentationVolume;
|
|
22646
|
+
const { voxelManager: segmentationVoxelManager } = segmentationVolume;
|
|
22647
|
+
const { voxelManager: imageVoxelManager, imageData } = imageVolume;
|
|
22648
|
+
return {
|
|
22649
|
+
segmentationImageData,
|
|
22650
|
+
segmentationVoxelManager,
|
|
22651
|
+
segmentationScalarData: null,
|
|
22652
|
+
imageScalarData: null,
|
|
22653
|
+
imageVoxelManager,
|
|
22654
|
+
imageData,
|
|
22655
|
+
};
|
|
22656
|
+
}
|
|
22657
|
+
function getStrategyDataForStackViewport({ operationData, viewport, strategy, }) {
|
|
22658
|
+
const { segmentationId } = operationData;
|
|
22659
|
+
let segmentationImageData;
|
|
22660
|
+
let segmentationVoxelManager;
|
|
22661
|
+
let segmentationScalarData;
|
|
22662
|
+
let imageScalarData;
|
|
22663
|
+
let imageVoxelManager;
|
|
22664
|
+
let imageData;
|
|
22665
|
+
if (strategy.ensureSegmentationVolumeFor3DManipulation) {
|
|
22666
|
+
strategy.ensureSegmentationVolumeFor3DManipulation({
|
|
22667
|
+
operationData,
|
|
22668
|
+
viewport,
|
|
22669
|
+
});
|
|
22670
|
+
segmentationVoxelManager = operationData.segmentationVoxelManager;
|
|
22671
|
+
segmentationImageData = operationData.segmentationImageData;
|
|
22672
|
+
segmentationScalarData = null;
|
|
22673
|
+
}
|
|
22674
|
+
else {
|
|
22675
|
+
const labelmapImageId = (0,_stateManagement_segmentation_segmentationState__WEBPACK_IMPORTED_MODULE_1__.getCurrentLabelmapImageIdForViewport)(viewport.id, segmentationId);
|
|
22676
|
+
if (!labelmapImageId) {
|
|
22677
|
+
return null;
|
|
22678
|
+
}
|
|
22679
|
+
const actorEntry = (0,_stateManagement_segmentation_helpers__WEBPACK_IMPORTED_MODULE_2__/* .getLabelmapActorEntry */ .wV)(viewport.id, segmentationId);
|
|
22680
|
+
if (!actorEntry) {
|
|
22681
|
+
return null;
|
|
22682
|
+
}
|
|
22683
|
+
const currentSegImage = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getImage(labelmapImageId);
|
|
22684
|
+
segmentationImageData = actorEntry.actor.getMapper().getInputData();
|
|
22685
|
+
segmentationVoxelManager = currentSegImage.voxelManager;
|
|
22686
|
+
const currentSegmentationImageId = operationData.imageId;
|
|
22687
|
+
const segmentationImage = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getImage(currentSegmentationImageId);
|
|
22688
|
+
if (!segmentationImage) {
|
|
22689
|
+
return null;
|
|
22690
|
+
}
|
|
22691
|
+
segmentationScalarData = segmentationImage.getPixelData?.();
|
|
22692
|
+
}
|
|
22693
|
+
if (strategy.ensureImageVolumeFor3DManipulation) {
|
|
22694
|
+
strategy.ensureImageVolumeFor3DManipulation({
|
|
22695
|
+
operationData,
|
|
22696
|
+
viewport,
|
|
22697
|
+
});
|
|
22698
|
+
imageVoxelManager = operationData.imageVoxelManager;
|
|
22699
|
+
imageScalarData = operationData.imageScalarData;
|
|
22700
|
+
imageData = operationData.imageData;
|
|
22701
|
+
}
|
|
22702
|
+
else {
|
|
22703
|
+
const currentImageId = viewport.getCurrentImageId();
|
|
22704
|
+
if (!currentImageId) {
|
|
22705
|
+
return null;
|
|
22706
|
+
}
|
|
22707
|
+
const image = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getImage(currentImageId);
|
|
22708
|
+
imageData = image ? null : viewport.getImageData();
|
|
22709
|
+
imageScalarData = image?.getPixelData() || imageData.getScalarData();
|
|
22710
|
+
imageVoxelManager = image?.voxelManager;
|
|
22711
|
+
}
|
|
22712
|
+
return {
|
|
22713
|
+
segmentationImageData,
|
|
22714
|
+
segmentationScalarData,
|
|
22715
|
+
imageScalarData,
|
|
22716
|
+
segmentationVoxelManager,
|
|
22717
|
+
imageVoxelManager,
|
|
22718
|
+
imageData,
|
|
22719
|
+
};
|
|
22720
|
+
}
|
|
22721
|
+
function getStrategyData({ operationData, viewport, strategy, }) {
|
|
22722
|
+
if (!operationData) {
|
|
22723
|
+
return null;
|
|
22724
|
+
}
|
|
22725
|
+
if (('volumeId' in operationData && operationData.volumeId != null) ||
|
|
22726
|
+
('referencedVolumeId' in operationData &&
|
|
22727
|
+
operationData.referencedVolumeId != null)) {
|
|
22728
|
+
return getStrategyDataForVolumeViewport({ operationData });
|
|
22729
|
+
}
|
|
22730
|
+
return getStrategyDataForStackViewport({ operationData, viewport, strategy });
|
|
22731
|
+
}
|
|
22732
|
+
|
|
22733
|
+
|
|
22734
|
+
|
|
21337
22735
|
/***/ }),
|
|
21338
22736
|
|
|
21339
22737
|
/***/ 41293:
|
|
@@ -24257,128 +25655,134 @@ function updateViewportsForAnnotations(viewport, annotations) {
|
|
|
24257
25655
|
|
|
24258
25656
|
"use strict";
|
|
24259
25657
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
24260
|
-
/* harmony export */ A5: () => (/* reexport safe */
|
|
25658
|
+
/* harmony export */ A5: () => (/* reexport safe */ _PlanarRotateTool__WEBPACK_IMPORTED_MODULE_8__.A),
|
|
24261
25659
|
/* harmony export */ CH: () => (/* reexport safe */ _PanTool__WEBPACK_IMPORTED_MODULE_1__.A),
|
|
24262
|
-
/* harmony export */ Du: () => (/* reexport safe */
|
|
24263
|
-
/* harmony export */ E0: () => (/* reexport safe */
|
|
25660
|
+
/* harmony export */ Du: () => (/* reexport safe */ _WindowLevelTool__WEBPACK_IMPORTED_MODULE_5__.A),
|
|
25661
|
+
/* harmony export */ E0: () => (/* reexport safe */ _annotation_RectangleROITool__WEBPACK_IMPORTED_MODULE_27__.A),
|
|
24264
25662
|
/* harmony export */ EC: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.EC),
|
|
24265
|
-
/* harmony export */ EV: () => (/* reexport safe */
|
|
24266
|
-
/* harmony export */
|
|
24267
|
-
/* harmony export */
|
|
24268
|
-
/* harmony export */
|
|
24269
|
-
/* harmony export */
|
|
24270
|
-
/* harmony export */
|
|
24271
|
-
/* harmony export */
|
|
24272
|
-
/* harmony export */
|
|
24273
|
-
/* harmony export */
|
|
24274
|
-
/* harmony export */
|
|
24275
|
-
/* harmony export */
|
|
24276
|
-
/* harmony export */
|
|
24277
|
-
/* harmony export */
|
|
24278
|
-
/* harmony export */
|
|
24279
|
-
/* harmony export */
|
|
24280
|
-
/* harmony export */
|
|
24281
|
-
/* harmony export */
|
|
25663
|
+
/* harmony export */ EV: () => (/* reexport safe */ _annotation_CobbAngleTool__WEBPACK_IMPORTED_MODULE_39__.A),
|
|
25664
|
+
/* harmony export */ Eb: () => (/* reexport safe */ _VolumeCroppingControlTool__WEBPACK_IMPORTED_MODULE_4__.A),
|
|
25665
|
+
/* harmony export */ FE: () => (/* reexport safe */ _ScaleOverlayTool__WEBPACK_IMPORTED_MODULE_18__.A),
|
|
25666
|
+
/* harmony export */ Fz: () => (/* reexport safe */ _segmentation_SegmentBidirectionalTool__WEBPACK_IMPORTED_MODULE_58__.A),
|
|
25667
|
+
/* harmony export */ G2: () => (/* reexport safe */ _segmentation_CircleScissorsTool__WEBPACK_IMPORTED_MODULE_49__.A),
|
|
25668
|
+
/* harmony export */ IX: () => (/* reexport safe */ _segmentation_SegmentSelectTool__WEBPACK_IMPORTED_MODULE_57__.A),
|
|
25669
|
+
/* harmony export */ Ix: () => (/* reexport safe */ _annotation_LivewireContourSegmentationTool__WEBPACK_IMPORTED_MODULE_36__.A),
|
|
25670
|
+
/* harmony export */ J2: () => (/* reexport safe */ _annotation_SplineROITool__WEBPACK_IMPORTED_MODULE_31__.A),
|
|
25671
|
+
/* harmony export */ LK: () => (/* reexport safe */ _segmentation_LabelmapEditWithContour__WEBPACK_IMPORTED_MODULE_61__.A),
|
|
25672
|
+
/* harmony export */ LW: () => (/* reexport safe */ _annotation_LengthTool__WEBPACK_IMPORTED_MODULE_23__.A),
|
|
25673
|
+
/* harmony export */ M$: () => (/* reexport safe */ _AdvancedMagnifyTool__WEBPACK_IMPORTED_MODULE_13__.A),
|
|
25674
|
+
/* harmony export */ Mu: () => (/* reexport safe */ _annotation_BidirectionalTool__WEBPACK_IMPORTED_MODULE_21__.A),
|
|
25675
|
+
/* harmony export */ N: () => (/* reexport safe */ _SculptorTool__WEBPACK_IMPORTED_MODULE_19__.A),
|
|
25676
|
+
/* harmony export */ N7: () => (/* reexport safe */ _annotation_ProbeTool__WEBPACK_IMPORTED_MODULE_25__.A),
|
|
25677
|
+
/* harmony export */ NF: () => (/* reexport safe */ _VolumeCroppingTool__WEBPACK_IMPORTED_MODULE_3__.A),
|
|
25678
|
+
/* harmony export */ Nk: () => (/* reexport safe */ _OverlayGridTool__WEBPACK_IMPORTED_MODULE_15__.A),
|
|
25679
|
+
/* harmony export */ Np: () => (/* reexport safe */ _annotation_KeyImageTool__WEBPACK_IMPORTED_MODULE_42__.A),
|
|
25680
|
+
/* harmony export */ OQ: () => (/* reexport safe */ _ZoomTool__WEBPACK_IMPORTED_MODULE_9__.A),
|
|
25681
|
+
/* harmony export */ Oh: () => (/* reexport safe */ _VolumeRotateTool__WEBPACK_IMPORTED_MODULE_20__.A),
|
|
24282
25682
|
/* harmony export */ So: () => (/* reexport safe */ _TrackballRotateTool__WEBPACK_IMPORTED_MODULE_2__.A),
|
|
24283
|
-
/* harmony export */ T8: () => (/* reexport safe */
|
|
24284
|
-
/* harmony export */ TG: () => (/* reexport safe */
|
|
24285
|
-
/* harmony export */ TR: () => (/* reexport safe */
|
|
24286
|
-
/* harmony export */ Tc: () => (/* reexport safe */
|
|
24287
|
-
/* harmony export */ Uj: () => (/* reexport safe */
|
|
24288
|
-
/* harmony export */ Vl: () => (/* reexport safe */
|
|
24289
|
-
/* harmony export */ X8: () => (/* reexport safe */
|
|
24290
|
-
/* harmony export */ Xr: () => (/* reexport safe */
|
|
24291
|
-
/* harmony export */ Ys: () => (/* reexport safe */
|
|
24292
|
-
/* harmony export */ ae: () => (/* reexport safe */
|
|
24293
|
-
/* harmony export */ ao: () => (/* reexport safe */
|
|
24294
|
-
/* harmony export */ cN: () => (/* reexport safe */
|
|
24295
|
-
/* harmony export */ dB: () => (/* reexport safe */
|
|
24296
|
-
/* harmony export */ eh: () => (/* reexport safe */
|
|
24297
|
-
/* harmony export */ ep: () => (/* reexport safe */
|
|
24298
|
-
/* harmony export */ ex: () => (/* reexport safe */
|
|
24299
|
-
/* harmony export */ hz: () => (/* reexport safe */
|
|
24300
|
-
/* harmony export */ il: () => (/* reexport safe */
|
|
24301
|
-
/* harmony export */ j$: () => (/* reexport safe */
|
|
24302
|
-
/* harmony export */ ls: () => (/* reexport safe */
|
|
24303
|
-
/* harmony export */ m8: () => (/* reexport safe */
|
|
24304
|
-
/* harmony export */ mX: () => (/* reexport safe */
|
|
24305
|
-
/* harmony export */ nJ: () => (/* reexport safe */
|
|
25683
|
+
/* harmony export */ T8: () => (/* reexport safe */ _annotation_UltrasoundPleuraBLineTool_UltrasoundPleuraBLineTool__WEBPACK_IMPORTED_MODULE_41__.A),
|
|
25684
|
+
/* harmony export */ TG: () => (/* reexport safe */ _WindowLevelRegionTool__WEBPACK_IMPORTED_MODULE_6__.A),
|
|
25685
|
+
/* harmony export */ TR: () => (/* reexport safe */ _segmentation_RectangleROIThresholdTool__WEBPACK_IMPORTED_MODULE_51__.A),
|
|
25686
|
+
/* harmony export */ Tc: () => (/* reexport safe */ _annotation_WholeBodySegmentTool__WEBPACK_IMPORTED_MODULE_46__.A),
|
|
25687
|
+
/* harmony export */ Uj: () => (/* reexport safe */ _segmentation_PaintFillTool__WEBPACK_IMPORTED_MODULE_55__.A),
|
|
25688
|
+
/* harmony export */ Vl: () => (/* reexport safe */ _annotation_CircleROITool__WEBPACK_IMPORTED_MODULE_29__.A),
|
|
25689
|
+
/* harmony export */ X8: () => (/* reexport safe */ _ReferenceLinesTool__WEBPACK_IMPORTED_MODULE_14__.A),
|
|
25690
|
+
/* harmony export */ Xr: () => (/* reexport safe */ _OrientationMarkerTool__WEBPACK_IMPORTED_MODULE_56__.A),
|
|
25691
|
+
/* harmony export */ Ys: () => (/* reexport safe */ _annotation_LivewireContourTool__WEBPACK_IMPORTED_MODULE_35__.A),
|
|
25692
|
+
/* harmony export */ ae: () => (/* reexport safe */ _StackScrollTool__WEBPACK_IMPORTED_MODULE_7__.A),
|
|
25693
|
+
/* harmony export */ ao: () => (/* reexport safe */ _annotation_ArrowAnnotateTool__WEBPACK_IMPORTED_MODULE_37__.A),
|
|
25694
|
+
/* harmony export */ cN: () => (/* reexport safe */ _SegmentationIntersectionTool__WEBPACK_IMPORTED_MODULE_16__.A),
|
|
25695
|
+
/* harmony export */ dB: () => (/* reexport safe */ _AnnotationEraserTool__WEBPACK_IMPORTED_MODULE_43__.A),
|
|
25696
|
+
/* harmony export */ eh: () => (/* reexport safe */ _MagnifyTool__WEBPACK_IMPORTED_MODULE_12__.A),
|
|
25697
|
+
/* harmony export */ ep: () => (/* reexport safe */ _CrosshairsTool__WEBPACK_IMPORTED_MODULE_11__.A),
|
|
25698
|
+
/* harmony export */ ex: () => (/* reexport safe */ _annotation_PlanarFreehandROITool__WEBPACK_IMPORTED_MODULE_33__.A),
|
|
25699
|
+
/* harmony export */ hz: () => (/* reexport safe */ _annotation_LabelTool__WEBPACK_IMPORTED_MODULE_22__.A),
|
|
25700
|
+
/* harmony export */ il: () => (/* reexport safe */ _segmentation_LabelmapBaseTool__WEBPACK_IMPORTED_MODULE_47__.A),
|
|
25701
|
+
/* harmony export */ j$: () => (/* reexport safe */ _annotation_DragProbeTool__WEBPACK_IMPORTED_MODULE_26__.A),
|
|
25702
|
+
/* harmony export */ ls: () => (/* reexport safe */ _segmentation_BrushTool__WEBPACK_IMPORTED_MODULE_54__.A),
|
|
25703
|
+
/* harmony export */ m8: () => (/* reexport safe */ _annotation_HeightTool__WEBPACK_IMPORTED_MODULE_24__.A),
|
|
25704
|
+
/* harmony export */ mX: () => (/* reexport safe */ _segmentation_RectangleROIStartEndThresholdTool__WEBPACK_IMPORTED_MODULE_52__.A),
|
|
25705
|
+
/* harmony export */ nJ: () => (/* reexport safe */ _annotation_ETDRSGridTool__WEBPACK_IMPORTED_MODULE_30__.A),
|
|
24306
25706
|
/* harmony export */ oS: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.oS),
|
|
24307
|
-
/* harmony export */ oi: () => (/* reexport safe */
|
|
24308
|
-
/* harmony export */ pq: () => (/* reexport safe */
|
|
24309
|
-
/* harmony export */ qD: () => (/* reexport safe */
|
|
24310
|
-
/* harmony export */ qT: () => (/* reexport safe */
|
|
24311
|
-
/* harmony export */ qi: () => (/* reexport safe */
|
|
24312
|
-
/* harmony export */ sR: () => (/* reexport safe */
|
|
24313
|
-
/* harmony export */ td: () => (/* reexport safe */
|
|
24314
|
-
/* harmony export */ u9: () => (/* reexport safe */
|
|
24315
|
-
/* harmony export */ uJ: () => (/* reexport safe */
|
|
24316
|
-
/* harmony export */ wR: () => (/* reexport safe */
|
|
25707
|
+
/* harmony export */ oi: () => (/* reexport safe */ _annotation_UltrasoundDirectionalTool__WEBPACK_IMPORTED_MODULE_40__.A),
|
|
25708
|
+
/* harmony export */ pq: () => (/* reexport safe */ _segmentation_CircleROIStartEndThresholdTool__WEBPACK_IMPORTED_MODULE_53__.A),
|
|
25709
|
+
/* harmony export */ qD: () => (/* reexport safe */ _annotation_EllipticalROITool__WEBPACK_IMPORTED_MODULE_28__.A),
|
|
25710
|
+
/* harmony export */ qT: () => (/* reexport safe */ _annotation_SplineContourSegmentationTool__WEBPACK_IMPORTED_MODULE_32__.A),
|
|
25711
|
+
/* harmony export */ qi: () => (/* reexport safe */ _annotation_PlanarFreehandContourSegmentationTool__WEBPACK_IMPORTED_MODULE_34__.A),
|
|
25712
|
+
/* harmony export */ sR: () => (/* reexport safe */ _annotation_RegionSegmentPlusTool__WEBPACK_IMPORTED_MODULE_45__.A),
|
|
25713
|
+
/* harmony export */ td: () => (/* reexport safe */ _segmentation_RectangleScissorsTool__WEBPACK_IMPORTED_MODULE_48__.A),
|
|
25714
|
+
/* harmony export */ u9: () => (/* reexport safe */ _segmentation_SegmentLabelTool__WEBPACK_IMPORTED_MODULE_60__.A),
|
|
25715
|
+
/* harmony export */ uJ: () => (/* reexport safe */ _MIPJumpToClickTool__WEBPACK_IMPORTED_MODULE_10__.A),
|
|
25716
|
+
/* harmony export */ wR: () => (/* reexport safe */ _annotation_RegionSegmentTool__WEBPACK_IMPORTED_MODULE_44__.A),
|
|
24317
25717
|
/* harmony export */ wh: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.wh),
|
|
24318
|
-
/* harmony export */ xI: () => (/* reexport safe */
|
|
24319
|
-
/* harmony export */ yT: () => (/* reexport safe */
|
|
24320
|
-
/* harmony export */ zH: () => (/* reexport safe */
|
|
25718
|
+
/* harmony export */ xI: () => (/* reexport safe */ _ReferenceCursors__WEBPACK_IMPORTED_MODULE_17__.A),
|
|
25719
|
+
/* harmony export */ yT: () => (/* reexport safe */ _annotation_AngleTool__WEBPACK_IMPORTED_MODULE_38__.A),
|
|
25720
|
+
/* harmony export */ zH: () => (/* reexport safe */ _segmentation_SphereScissorsTool__WEBPACK_IMPORTED_MODULE_50__.A)
|
|
24321
25721
|
/* harmony export */ });
|
|
24322
25722
|
/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85817);
|
|
24323
25723
|
/* harmony import */ var _PanTool__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(38782);
|
|
24324
25724
|
/* harmony import */ var _TrackballRotateTool__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(26884);
|
|
24325
|
-
/* harmony import */ var
|
|
24326
|
-
/* harmony import */ var
|
|
24327
|
-
/* harmony import */ var
|
|
24328
|
-
/* harmony import */ var
|
|
24329
|
-
/* harmony import */ var
|
|
24330
|
-
/* harmony import */ var
|
|
24331
|
-
/* harmony import */ var
|
|
24332
|
-
/* harmony import */ var
|
|
24333
|
-
/* harmony import */ var
|
|
24334
|
-
/* harmony import */ var
|
|
24335
|
-
/* harmony import */ var
|
|
24336
|
-
/* harmony import */ var
|
|
24337
|
-
/* harmony import */ var
|
|
24338
|
-
/* harmony import */ var
|
|
24339
|
-
/* harmony import */ var
|
|
24340
|
-
/* harmony import */ var
|
|
24341
|
-
/* harmony import */ var
|
|
24342
|
-
/* harmony import */ var
|
|
24343
|
-
/* harmony import */ var
|
|
24344
|
-
/* harmony import */ var
|
|
24345
|
-
/* harmony import */ var
|
|
24346
|
-
/* harmony import */ var
|
|
24347
|
-
/* harmony import */ var
|
|
24348
|
-
/* harmony import */ var
|
|
24349
|
-
/* harmony import */ var
|
|
24350
|
-
/* harmony import */ var
|
|
24351
|
-
/* harmony import */ var
|
|
24352
|
-
/* harmony import */ var
|
|
24353
|
-
/* harmony import */ var
|
|
24354
|
-
/* harmony import */ var
|
|
24355
|
-
/* harmony import */ var
|
|
24356
|
-
/* harmony import */ var
|
|
24357
|
-
/* harmony import */ var
|
|
24358
|
-
/* harmony import */ var
|
|
24359
|
-
/* harmony import */ var
|
|
24360
|
-
/* harmony import */ var
|
|
24361
|
-
/* harmony import */ var
|
|
24362
|
-
/* harmony import */ var
|
|
24363
|
-
/* harmony import */ var
|
|
24364
|
-
/* harmony import */ var
|
|
24365
|
-
/* harmony import */ var
|
|
24366
|
-
/* harmony import */ var
|
|
24367
|
-
/* harmony import */ var
|
|
24368
|
-
/* harmony import */ var
|
|
24369
|
-
/* harmony import */ var
|
|
24370
|
-
/* harmony import */ var
|
|
24371
|
-
/* harmony import */ var
|
|
24372
|
-
/* harmony import */ var
|
|
24373
|
-
/* harmony import */ var
|
|
24374
|
-
/* harmony import */ var
|
|
24375
|
-
/* harmony import */ var
|
|
24376
|
-
/* harmony import */ var
|
|
24377
|
-
/* harmony import */ var
|
|
24378
|
-
/* harmony import */ var
|
|
24379
|
-
/* harmony import */ var
|
|
24380
|
-
/* harmony import */ var
|
|
24381
|
-
/* harmony import */ var
|
|
25725
|
+
/* harmony import */ var _VolumeCroppingTool__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(82461);
|
|
25726
|
+
/* harmony import */ var _VolumeCroppingControlTool__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(35300);
|
|
25727
|
+
/* harmony import */ var _WindowLevelTool__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(43159);
|
|
25728
|
+
/* harmony import */ var _WindowLevelRegionTool__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(17819);
|
|
25729
|
+
/* harmony import */ var _StackScrollTool__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(89460);
|
|
25730
|
+
/* harmony import */ var _PlanarRotateTool__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(82058);
|
|
25731
|
+
/* harmony import */ var _ZoomTool__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(26938);
|
|
25732
|
+
/* harmony import */ var _MIPJumpToClickTool__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(66944);
|
|
25733
|
+
/* harmony import */ var _CrosshairsTool__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(14840);
|
|
25734
|
+
/* harmony import */ var _MagnifyTool__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(72674);
|
|
25735
|
+
/* harmony import */ var _AdvancedMagnifyTool__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(45152);
|
|
25736
|
+
/* harmony import */ var _ReferenceLinesTool__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(36797);
|
|
25737
|
+
/* harmony import */ var _OverlayGridTool__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(43185);
|
|
25738
|
+
/* harmony import */ var _SegmentationIntersectionTool__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(32302);
|
|
25739
|
+
/* harmony import */ var _ReferenceCursors__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(85735);
|
|
25740
|
+
/* harmony import */ var _ScaleOverlayTool__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(26039);
|
|
25741
|
+
/* harmony import */ var _SculptorTool__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(3751);
|
|
25742
|
+
/* harmony import */ var _VolumeRotateTool__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(30588);
|
|
25743
|
+
/* harmony import */ var _annotation_BidirectionalTool__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(25072);
|
|
25744
|
+
/* harmony import */ var _annotation_LabelTool__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(37117);
|
|
25745
|
+
/* harmony import */ var _annotation_LengthTool__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(14335);
|
|
25746
|
+
/* harmony import */ var _annotation_HeightTool__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(59320);
|
|
25747
|
+
/* harmony import */ var _annotation_ProbeTool__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(61873);
|
|
25748
|
+
/* harmony import */ var _annotation_DragProbeTool__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(40487);
|
|
25749
|
+
/* harmony import */ var _annotation_RectangleROITool__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(4010);
|
|
25750
|
+
/* harmony import */ var _annotation_EllipticalROITool__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(78684);
|
|
25751
|
+
/* harmony import */ var _annotation_CircleROITool__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(31137);
|
|
25752
|
+
/* harmony import */ var _annotation_ETDRSGridTool__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(8467);
|
|
25753
|
+
/* harmony import */ var _annotation_SplineROITool__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(3066);
|
|
25754
|
+
/* harmony import */ var _annotation_SplineContourSegmentationTool__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(60580);
|
|
25755
|
+
/* harmony import */ var _annotation_PlanarFreehandROITool__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(28220);
|
|
25756
|
+
/* harmony import */ var _annotation_PlanarFreehandContourSegmentationTool__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(37590);
|
|
25757
|
+
/* harmony import */ var _annotation_LivewireContourTool__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(9136);
|
|
25758
|
+
/* harmony import */ var _annotation_LivewireContourSegmentationTool__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(76358);
|
|
25759
|
+
/* harmony import */ var _annotation_ArrowAnnotateTool__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(24146);
|
|
25760
|
+
/* harmony import */ var _annotation_AngleTool__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(9608);
|
|
25761
|
+
/* harmony import */ var _annotation_CobbAngleTool__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(99718);
|
|
25762
|
+
/* harmony import */ var _annotation_UltrasoundDirectionalTool__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(94504);
|
|
25763
|
+
/* harmony import */ var _annotation_UltrasoundPleuraBLineTool_UltrasoundPleuraBLineTool__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(20214);
|
|
25764
|
+
/* harmony import */ var _annotation_KeyImageTool__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(33327);
|
|
25765
|
+
/* harmony import */ var _AnnotationEraserTool__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(68760);
|
|
25766
|
+
/* harmony import */ var _annotation_RegionSegmentTool__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(9626);
|
|
25767
|
+
/* harmony import */ var _annotation_RegionSegmentPlusTool__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(7750);
|
|
25768
|
+
/* harmony import */ var _annotation_WholeBodySegmentTool__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(31787);
|
|
25769
|
+
/* harmony import */ var _segmentation_LabelmapBaseTool__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(23631);
|
|
25770
|
+
/* harmony import */ var _segmentation_RectangleScissorsTool__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(56526);
|
|
25771
|
+
/* harmony import */ var _segmentation_CircleScissorsTool__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(66917);
|
|
25772
|
+
/* harmony import */ var _segmentation_SphereScissorsTool__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(10804);
|
|
25773
|
+
/* harmony import */ var _segmentation_RectangleROIThresholdTool__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(40336);
|
|
25774
|
+
/* harmony import */ var _segmentation_RectangleROIStartEndThresholdTool__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(67847);
|
|
25775
|
+
/* harmony import */ var _segmentation_CircleROIStartEndThresholdTool__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(65284);
|
|
25776
|
+
/* harmony import */ var _segmentation_BrushTool__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(48736);
|
|
25777
|
+
/* harmony import */ var _segmentation_PaintFillTool__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(61777);
|
|
25778
|
+
/* harmony import */ var _OrientationMarkerTool__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(36913);
|
|
25779
|
+
/* harmony import */ var _segmentation_SegmentSelectTool__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(12905);
|
|
25780
|
+
/* harmony import */ var _segmentation_SegmentBidirectionalTool__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(38502);
|
|
25781
|
+
/* harmony import */ var _segmentation_strategies__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(99522);
|
|
25782
|
+
/* harmony import */ var _segmentation_SegmentLabelTool__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(987);
|
|
25783
|
+
/* harmony import */ var _segmentation_LabelmapEditWithContour__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(89584);
|
|
25784
|
+
|
|
25785
|
+
|
|
24382
25786
|
|
|
24383
25787
|
|
|
24384
25788
|
|
|
@@ -25911,6 +27315,8 @@ function getContourHolesDataWorld(annotation) {
|
|
|
25911
27315
|
/* harmony import */ var _triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49906);
|
|
25912
27316
|
/* harmony import */ var _addColorLUT__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4714);
|
|
25913
27317
|
/* harmony import */ var _SegmentationStateManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(59475);
|
|
27318
|
+
/* harmony import */ var _segmentIndex__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(70930);
|
|
27319
|
+
|
|
25914
27320
|
|
|
25915
27321
|
|
|
25916
27322
|
|
|
@@ -25924,6 +27330,16 @@ function internalAddSegmentationRepresentation(viewportId, representationInput)
|
|
|
25924
27330
|
...config,
|
|
25925
27331
|
};
|
|
25926
27332
|
_SegmentationStateManager__WEBPACK_IMPORTED_MODULE_5__/* .defaultSegmentationStateManager */ ._6.addSegmentationRepresentation(viewportId, segmentationId, representationInput.type, renderingConfig);
|
|
27333
|
+
if (!(0,_segmentIndex__WEBPACK_IMPORTED_MODULE_6__.getActiveSegmentIndex)(segmentationId)) {
|
|
27334
|
+
const segmentation = _SegmentationStateManager__WEBPACK_IMPORTED_MODULE_5__/* .defaultSegmentationStateManager */ ._6.getSegmentation(segmentationId);
|
|
27335
|
+
if (segmentation) {
|
|
27336
|
+
const segmentKeys = Object.keys(segmentation.segments);
|
|
27337
|
+
if (segmentKeys.length > 0) {
|
|
27338
|
+
const firstSegmentIndex = segmentKeys.map((k) => Number(k)).sort()[0];
|
|
27339
|
+
(0,_segmentIndex__WEBPACK_IMPORTED_MODULE_6__.setActiveSegmentIndex)(segmentationId, firstSegmentIndex);
|
|
27340
|
+
}
|
|
27341
|
+
}
|
|
27342
|
+
}
|
|
25927
27343
|
if (representationInput.type === _enums__WEBPACK_IMPORTED_MODULE_2__.SegmentationRepresentations.Contour) {
|
|
25928
27344
|
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_1__/* .triggerAnnotationRenderForViewportIds */ .t)([viewportId]);
|
|
25929
27345
|
}
|
|
@@ -26826,6 +28242,7 @@ function presentationViewSyncCallback(_synchronizerInstance, sourceViewport, tar
|
|
|
26826
28242
|
|
|
26827
28243
|
"use strict";
|
|
26828
28244
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
28245
|
+
/* harmony export */ C$: () => (/* binding */ getEllipseCornersFromCanvasCoordinates),
|
|
26829
28246
|
/* harmony export */ N5: () => (/* binding */ fillOutsideCircle),
|
|
26830
28247
|
/* harmony export */ kr: () => (/* binding */ fillInsideCircle),
|
|
26831
28248
|
/* harmony export */ mu: () => (/* binding */ createPointInEllipse),
|
|
@@ -26835,13 +28252,11 @@ function presentationViewSyncCallback(_synchronizerInstance, sourceViewport, tar
|
|
|
26835
28252
|
/* unused harmony export CIRCLE_THRESHOLD_STRATEGY */
|
|
26836
28253
|
/* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3823);
|
|
26837
28254
|
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15327);
|
|
26838
|
-
/* harmony import */ var
|
|
26839
|
-
/* harmony import */ var
|
|
26840
|
-
/* harmony import */ var
|
|
26841
|
-
/* harmony import */ var
|
|
26842
|
-
/* harmony import */ var
|
|
26843
|
-
/* harmony import */ var _utilities_math_sphere__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(62783);
|
|
26844
|
-
|
|
28255
|
+
/* harmony import */ var _utilities_boundingBox__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(72282);
|
|
28256
|
+
/* harmony import */ var _BrushStrategy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(55887);
|
|
28257
|
+
/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(99737);
|
|
28258
|
+
/* harmony import */ var _compositions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(11990);
|
|
28259
|
+
/* harmony import */ var _utilities_math_sphere__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(62783);
|
|
26845
28260
|
|
|
26846
28261
|
|
|
26847
28262
|
|
|
@@ -26850,62 +28265,86 @@ function presentationViewSyncCallback(_synchronizerInstance, sourceViewport, tar
|
|
|
26850
28265
|
|
|
26851
28266
|
|
|
26852
28267
|
const { transformWorldToIndex, isEqual } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities;
|
|
28268
|
+
function getEllipseCornersFromCanvasCoordinates(canvasCoordinates) {
|
|
28269
|
+
const [bottom, top, left, right] = canvasCoordinates;
|
|
28270
|
+
const topLeft = [left[0], top[1]];
|
|
28271
|
+
const bottomRight = [right[0], bottom[1]];
|
|
28272
|
+
const bottomLeft = [left[0], bottom[1]];
|
|
28273
|
+
const topRight = [right[0], top[1]];
|
|
28274
|
+
return [topLeft, bottomRight, bottomLeft, topRight];
|
|
28275
|
+
}
|
|
26853
28276
|
const initializeCircle = {
|
|
26854
|
-
[
|
|
28277
|
+
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Initialize]: (operationData) => {
|
|
26855
28278
|
const { points, viewport, segmentationImageData, } = operationData;
|
|
26856
28279
|
if (!points) {
|
|
26857
28280
|
return;
|
|
26858
28281
|
}
|
|
26859
|
-
const center = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.
|
|
26860
|
-
points.
|
|
26861
|
-
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.add */ .eR.add(center,
|
|
26862
|
-
|
|
26863
|
-
|
|
28282
|
+
const center = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
|
|
28283
|
+
if (points.length >= 2) {
|
|
28284
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.add */ .eR.add(center, points[0], points[1]);
|
|
28285
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.scale */ .eR.scale(center, center, 0.5);
|
|
28286
|
+
}
|
|
28287
|
+
else {
|
|
28288
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.copy */ .eR.copy(center, points[0]);
|
|
28289
|
+
}
|
|
26864
28290
|
operationData.centerWorld = center;
|
|
26865
28291
|
operationData.centerIJK = transformWorldToIndex(segmentationImageData, center);
|
|
26866
28292
|
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
26867
|
-
const
|
|
26868
|
-
const
|
|
26869
|
-
const bottomRightWorld = viewport.canvasToWorld(bottomRightCanvas);
|
|
28293
|
+
const corners = getEllipseCornersFromCanvasCoordinates(canvasCoordinates);
|
|
28294
|
+
const cornersInWorld = corners.map((corner) => viewport.canvasToWorld(corner));
|
|
26870
28295
|
const circleCornersIJK = points.map((world) => {
|
|
26871
28296
|
return transformWorldToIndex(segmentationImageData, world);
|
|
26872
28297
|
});
|
|
26873
|
-
const boundsIJK = (0,
|
|
26874
|
-
operationData.isInObject = createPointInEllipse(
|
|
26875
|
-
topLeftWorld,
|
|
26876
|
-
bottomRightWorld,
|
|
26877
|
-
center,
|
|
26878
|
-
});
|
|
28298
|
+
const boundsIJK = (0,_utilities_boundingBox__WEBPACK_IMPORTED_MODULE_2__.getBoundingBoxAroundShapeIJK)(circleCornersIJK, segmentationImageData.getDimensions());
|
|
28299
|
+
operationData.isInObject = createPointInEllipse(cornersInWorld);
|
|
26879
28300
|
operationData.isInObjectBoundsIJK = boundsIJK;
|
|
26880
28301
|
},
|
|
26881
28302
|
};
|
|
26882
|
-
function createPointInEllipse(
|
|
26883
|
-
|
|
26884
|
-
|
|
26885
|
-
|
|
26886
|
-
const
|
|
26887
|
-
const
|
|
26888
|
-
|
|
26889
|
-
|
|
26890
|
-
|
|
28303
|
+
function createPointInEllipse(cornersInWorld = []) {
|
|
28304
|
+
if (!cornersInWorld || cornersInWorld.length !== 4) {
|
|
28305
|
+
throw new Error('createPointInEllipse: cornersInWorld must have 4 points');
|
|
28306
|
+
}
|
|
28307
|
+
const [topLeft, bottomRight, bottomLeft, topRight] = cornersInWorld;
|
|
28308
|
+
const center = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
|
|
28309
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.add */ .eR.add(center, topLeft, bottomRight);
|
|
28310
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.scale */ .eR.scale(center, center, 0.5);
|
|
28311
|
+
const majorAxisVec = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
|
|
28312
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.subtract */ .eR.subtract(majorAxisVec, topRight, topLeft);
|
|
28313
|
+
const xRadius = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.length */ .eR.length(majorAxisVec) / 2;
|
|
28314
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.normalize */ .eR.normalize(majorAxisVec, majorAxisVec);
|
|
28315
|
+
const minorAxisVec = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
|
|
28316
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.subtract */ .eR.subtract(minorAxisVec, bottomLeft, topLeft);
|
|
28317
|
+
const yRadius = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.length */ .eR.length(minorAxisVec) / 2;
|
|
28318
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.normalize */ .eR.normalize(minorAxisVec, minorAxisVec);
|
|
28319
|
+
const normal = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
|
|
28320
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.cross */ .eR.cross(normal, majorAxisVec, minorAxisVec);
|
|
28321
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.normalize */ .eR.normalize(normal, normal);
|
|
28322
|
+
if (isEqual(xRadius, yRadius)) {
|
|
28323
|
+
const radius = xRadius;
|
|
26891
28324
|
const sphereObj = {
|
|
26892
28325
|
center,
|
|
26893
28326
|
radius,
|
|
26894
28327
|
radius2: radius * radius,
|
|
26895
28328
|
};
|
|
26896
|
-
return (pointLPS) => (0,
|
|
26897
|
-
}
|
|
26898
|
-
|
|
26899
|
-
|
|
26900
|
-
|
|
26901
|
-
|
|
26902
|
-
|
|
28329
|
+
return (pointLPS) => (0,_utilities_math_sphere__WEBPACK_IMPORTED_MODULE_6__/* .pointInSphere */ .d)(sphereObj, pointLPS);
|
|
28330
|
+
}
|
|
28331
|
+
return (pointLPS) => {
|
|
28332
|
+
const pointVec = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
|
|
28333
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.subtract */ .eR.subtract(pointVec, pointLPS, center);
|
|
28334
|
+
const distToPlane = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dot */ .eR.dot(pointVec, normal);
|
|
28335
|
+
const proj = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
|
|
28336
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.scaleAndAdd */ .eR.scaleAndAdd(proj, pointVec, normal, -distToPlane);
|
|
28337
|
+
const fromTopLeft = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
|
|
28338
|
+
const centerToTopLeft = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
|
|
28339
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.subtract */ .eR.subtract(centerToTopLeft, center, topLeft);
|
|
28340
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.subtract */ .eR.subtract(fromTopLeft, proj, centerToTopLeft);
|
|
28341
|
+
const x = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dot */ .eR.dot(fromTopLeft, majorAxisVec);
|
|
28342
|
+
const y = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dot */ .eR.dot(fromTopLeft, minorAxisVec);
|
|
28343
|
+
return (x * x) / (xRadius * xRadius) + (y * y) / (yRadius * yRadius) <= 1;
|
|
26903
28344
|
};
|
|
26904
|
-
const { precalculated } = (0,_utilities_math_ellipse__WEBPACK_IMPORTED_MODULE_2__.precalculatePointInEllipse)(ellipseObj, {});
|
|
26905
|
-
return precalculated;
|
|
26906
28345
|
}
|
|
26907
|
-
const CIRCLE_STRATEGY = new
|
|
26908
|
-
const CIRCLE_THRESHOLD_STRATEGY = new
|
|
28346
|
+
const CIRCLE_STRATEGY = new _BrushStrategy__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A('Circle', _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.regionFill, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.setValue, initializeCircle, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.determineSegmentIndex, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.preview, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.labelmapStatistics);
|
|
28347
|
+
const CIRCLE_THRESHOLD_STRATEGY = new _BrushStrategy__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A('CircleThreshold', _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.regionFill, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.setValue, initializeCircle, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.determineSegmentIndex, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.dynamicThreshold, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.threshold, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.preview, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.islandRemoval, _compositions__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.labelmapStatistics);
|
|
26909
28348
|
const fillInsideCircle = CIRCLE_STRATEGY.strategyFunction;
|
|
26910
28349
|
const thresholdInsideCircle = CIRCLE_THRESHOLD_STRATEGY.strategyFunction;
|
|
26911
28350
|
function fillOutsideCircle() {
|
|
@@ -29316,6 +30755,7 @@ class ProbeTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
|
|
|
29316
30755
|
Modality: modality,
|
|
29317
30756
|
modalityUnit,
|
|
29318
30757
|
};
|
|
30758
|
+
annotation.invalidated = true;
|
|
29319
30759
|
}
|
|
29320
30760
|
else {
|
|
29321
30761
|
this.isHandleOutsideImage = true;
|
|
@@ -30142,7 +31582,7 @@ function cleanupPolylines(polylines) {
|
|
|
30142
31582
|
/* harmony import */ var _utilities_math_circle__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(77081);
|
|
30143
31583
|
/* harmony import */ var _utilities_getCalibratedUnits__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(4096);
|
|
30144
31584
|
/* harmony import */ var _utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(18990);
|
|
30145
|
-
/* harmony import */ var _utilities_math_ellipse__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(
|
|
31585
|
+
/* harmony import */ var _utilities_math_ellipse__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(87009);
|
|
30146
31586
|
/* harmony import */ var _utilities_math_basic__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(73262);
|
|
30147
31587
|
/* harmony import */ var _utilities_planar__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(13165);
|
|
30148
31588
|
/* harmony import */ var _utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(40634);
|
|
@@ -35129,7 +36569,7 @@ function updateLabelmapSegmentationImageReferences(viewportId, segmentationId) {
|
|
|
35129
36569
|
/* harmony import */ var _utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(60810);
|
|
35130
36570
|
/* harmony import */ var _utilities_drawing__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(473);
|
|
35131
36571
|
/* harmony import */ var _utilities_planar_getWorldWidthAndHeightFromTwoPoints__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(62514);
|
|
35132
|
-
/* harmony import */ var _utilities_math_ellipse__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(
|
|
36572
|
+
/* harmony import */ var _utilities_math_ellipse__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(87009);
|
|
35133
36573
|
/* harmony import */ var _cursors_elementCursor__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(7001);
|
|
35134
36574
|
/* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(58640);
|
|
35135
36575
|
/* harmony import */ var _utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(40634);
|
|
@@ -36812,6 +38252,1095 @@ PlanarRotateTool.toolName = 'PlanarRotate';
|
|
|
36812
38252
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PlanarRotateTool);
|
|
36813
38253
|
|
|
36814
38254
|
|
|
38255
|
+
/***/ }),
|
|
38256
|
+
|
|
38257
|
+
/***/ 82461:
|
|
38258
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
38259
|
+
|
|
38260
|
+
"use strict";
|
|
38261
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
38262
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
38263
|
+
/* harmony export */ });
|
|
38264
|
+
/* harmony import */ var _kitware_vtk_js_Common_DataModel_PolyData__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(87275);
|
|
38265
|
+
/* harmony import */ var _kitware_vtk_js_Common_Core_Points__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(74966);
|
|
38266
|
+
/* harmony import */ var _kitware_vtk_js_Common_Core_CellArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(35056);
|
|
38267
|
+
/* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3823);
|
|
38268
|
+
/* harmony import */ var _kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(84607);
|
|
38269
|
+
/* harmony import */ var _kitware_vtk_js_Rendering_Core_Actor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7019);
|
|
38270
|
+
/* harmony import */ var _kitware_vtk_js_Filters_Sources_SphereSource__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(1060);
|
|
38271
|
+
/* harmony import */ var _kitware_vtk_js_Rendering_Core_Mapper__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(82409);
|
|
38272
|
+
/* harmony import */ var _kitware_vtk_js_Common_DataModel_Plane__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(75127);
|
|
38273
|
+
/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(85817);
|
|
38274
|
+
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(15327);
|
|
38275
|
+
/* harmony import */ var _store_ToolGroupManager__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(77609);
|
|
38276
|
+
/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(99737);
|
|
38277
|
+
|
|
38278
|
+
|
|
38279
|
+
|
|
38280
|
+
|
|
38281
|
+
|
|
38282
|
+
|
|
38283
|
+
|
|
38284
|
+
|
|
38285
|
+
|
|
38286
|
+
|
|
38287
|
+
|
|
38288
|
+
|
|
38289
|
+
|
|
38290
|
+
const PLANEINDEX = {
|
|
38291
|
+
XMIN: 0,
|
|
38292
|
+
XMAX: 1,
|
|
38293
|
+
YMIN: 2,
|
|
38294
|
+
YMAX: 3,
|
|
38295
|
+
ZMIN: 4,
|
|
38296
|
+
ZMAX: 5,
|
|
38297
|
+
};
|
|
38298
|
+
const SPHEREINDEX = {
|
|
38299
|
+
XMIN: 0,
|
|
38300
|
+
XMAX: 1,
|
|
38301
|
+
YMIN: 2,
|
|
38302
|
+
YMAX: 3,
|
|
38303
|
+
ZMIN: 4,
|
|
38304
|
+
ZMAX: 5,
|
|
38305
|
+
XMIN_YMIN_ZMIN: 6,
|
|
38306
|
+
XMIN_YMIN_ZMAX: 7,
|
|
38307
|
+
XMIN_YMAX_ZMIN: 8,
|
|
38308
|
+
XMIN_YMAX_ZMAX: 9,
|
|
38309
|
+
XMAX_YMIN_ZMIN: 10,
|
|
38310
|
+
XMAX_YMIN_ZMAX: 11,
|
|
38311
|
+
XMAX_YMAX_ZMIN: 12,
|
|
38312
|
+
XMAX_YMAX_ZMAX: 13,
|
|
38313
|
+
};
|
|
38314
|
+
class VolumeCroppingTool extends _base__WEBPACK_IMPORTED_MODULE_9__/* .BaseTool */ .oS {
|
|
38315
|
+
constructor(toolProps = {}, defaultToolProps = {
|
|
38316
|
+
configuration: {
|
|
38317
|
+
showCornerSpheres: true,
|
|
38318
|
+
showHandles: true,
|
|
38319
|
+
showClippingPlanes: true,
|
|
38320
|
+
mobile: {
|
|
38321
|
+
enabled: false,
|
|
38322
|
+
opacity: 0.8,
|
|
38323
|
+
},
|
|
38324
|
+
initialCropFactor: 0.08,
|
|
38325
|
+
sphereColors: {
|
|
38326
|
+
SAGITTAL: [1.0, 1.0, 0.0],
|
|
38327
|
+
CORONAL: [0.0, 1.0, 0.0],
|
|
38328
|
+
AXIAL: [1.0, 0.0, 0.0],
|
|
38329
|
+
CORNERS: [0.0, 0.0, 1.0],
|
|
38330
|
+
},
|
|
38331
|
+
sphereRadius: 8,
|
|
38332
|
+
grabSpherePixelDistance: 20,
|
|
38333
|
+
rotateIncrementDegrees: 2,
|
|
38334
|
+
rotateSampleDistanceFactor: 2,
|
|
38335
|
+
},
|
|
38336
|
+
}) {
|
|
38337
|
+
super(toolProps, defaultToolProps);
|
|
38338
|
+
this._resizeObservers = new Map();
|
|
38339
|
+
this._hasResolutionChanged = false;
|
|
38340
|
+
this.originalClippingPlanes = [];
|
|
38341
|
+
this.draggingSphereIndex = null;
|
|
38342
|
+
this.toolCenter = [0, 0, 0];
|
|
38343
|
+
this.cornerDragOffset = null;
|
|
38344
|
+
this.faceDragOffset = null;
|
|
38345
|
+
this.sphereStates = [];
|
|
38346
|
+
this.edgeLines = {};
|
|
38347
|
+
this.onSetToolConfiguration = () => {
|
|
38348
|
+
console.debug('Setting tool settoolconfiguration : volumeCropping');
|
|
38349
|
+
};
|
|
38350
|
+
this.onSetToolEnabled = () => {
|
|
38351
|
+
console.debug('Setting tool enabled: volumeCropping');
|
|
38352
|
+
};
|
|
38353
|
+
this.onCameraModified = (evt) => {
|
|
38354
|
+
const { element } = evt.currentTarget
|
|
38355
|
+
? { element: evt.currentTarget }
|
|
38356
|
+
: evt.detail;
|
|
38357
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.getEnabledElement)(element);
|
|
38358
|
+
this._updateClippingPlanes(enabledElement.viewport);
|
|
38359
|
+
enabledElement.viewport.render();
|
|
38360
|
+
};
|
|
38361
|
+
this.preMouseDownCallback = (evt) => {
|
|
38362
|
+
const eventDetail = evt.detail;
|
|
38363
|
+
const { element } = eventDetail;
|
|
38364
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.getEnabledElement)(element);
|
|
38365
|
+
const { viewport } = enabledElement;
|
|
38366
|
+
const actorEntry = viewport.getDefaultActor();
|
|
38367
|
+
const actor = actorEntry.actor;
|
|
38368
|
+
const mapper = actor.getMapper();
|
|
38369
|
+
const mouseCanvas = [
|
|
38370
|
+
evt.detail.currentPoints.canvas[0],
|
|
38371
|
+
evt.detail.currentPoints.canvas[1],
|
|
38372
|
+
];
|
|
38373
|
+
this.draggingSphereIndex = null;
|
|
38374
|
+
this.cornerDragOffset = null;
|
|
38375
|
+
this.faceDragOffset = null;
|
|
38376
|
+
for (let i = 0; i < this.sphereStates.length; ++i) {
|
|
38377
|
+
const sphereCanvas = viewport.worldToCanvas(this.sphereStates[i].point);
|
|
38378
|
+
const dist = Math.sqrt(Math.pow(mouseCanvas[0] - sphereCanvas[0], 2) +
|
|
38379
|
+
Math.pow(mouseCanvas[1] - sphereCanvas[1], 2));
|
|
38380
|
+
if (dist < this.configuration.grabSpherePixelDistance) {
|
|
38381
|
+
this.draggingSphereIndex = i;
|
|
38382
|
+
element.style.cursor = 'grabbing';
|
|
38383
|
+
const sphereState = this.sphereStates[i];
|
|
38384
|
+
const mouseWorld = viewport.canvasToWorld(mouseCanvas);
|
|
38385
|
+
if (sphereState.isCorner) {
|
|
38386
|
+
this.cornerDragOffset = [
|
|
38387
|
+
sphereState.point[0] - mouseWorld[0],
|
|
38388
|
+
sphereState.point[1] - mouseWorld[1],
|
|
38389
|
+
sphereState.point[2] - mouseWorld[2],
|
|
38390
|
+
];
|
|
38391
|
+
this.faceDragOffset = null;
|
|
38392
|
+
}
|
|
38393
|
+
else {
|
|
38394
|
+
const axisIdx = { x: 0, y: 1, z: 2 }[sphereState.axis];
|
|
38395
|
+
this.faceDragOffset =
|
|
38396
|
+
sphereState.point[axisIdx] - mouseWorld[axisIdx];
|
|
38397
|
+
this.cornerDragOffset = null;
|
|
38398
|
+
}
|
|
38399
|
+
return true;
|
|
38400
|
+
}
|
|
38401
|
+
}
|
|
38402
|
+
const hasSampleDistance = 'getSampleDistance' in mapper || 'getCurrentSampleDistance' in mapper;
|
|
38403
|
+
if (!hasSampleDistance) {
|
|
38404
|
+
return true;
|
|
38405
|
+
}
|
|
38406
|
+
const originalSampleDistance = mapper.getSampleDistance();
|
|
38407
|
+
if (!this._hasResolutionChanged) {
|
|
38408
|
+
const { rotateSampleDistanceFactor } = this.configuration;
|
|
38409
|
+
mapper.setSampleDistance(originalSampleDistance * rotateSampleDistanceFactor);
|
|
38410
|
+
this._hasResolutionChanged = true;
|
|
38411
|
+
if (this.cleanUp !== null) {
|
|
38412
|
+
document.removeEventListener('mouseup', this.cleanUp);
|
|
38413
|
+
}
|
|
38414
|
+
this.cleanUp = () => {
|
|
38415
|
+
mapper.setSampleDistance(originalSampleDistance);
|
|
38416
|
+
evt.target.style.cursor = '';
|
|
38417
|
+
if (this.draggingSphereIndex !== null) {
|
|
38418
|
+
const sphereState = this.sphereStates[this.draggingSphereIndex];
|
|
38419
|
+
const [viewport3D] = this._getViewportsInfo();
|
|
38420
|
+
const renderingEngine = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.getRenderingEngine)(viewport3D.renderingEngineId);
|
|
38421
|
+
const viewport = renderingEngine.getViewport(viewport3D.viewportId);
|
|
38422
|
+
if (sphereState.isCorner) {
|
|
38423
|
+
this._updateCornerSpheres();
|
|
38424
|
+
this._updateFaceSpheresFromCorners();
|
|
38425
|
+
this._updateClippingPlanesFromFaceSpheres(viewport);
|
|
38426
|
+
}
|
|
38427
|
+
}
|
|
38428
|
+
this.draggingSphereIndex = null;
|
|
38429
|
+
this.cornerDragOffset = null;
|
|
38430
|
+
this.faceDragOffset = null;
|
|
38431
|
+
viewport.render();
|
|
38432
|
+
this._hasResolutionChanged = false;
|
|
38433
|
+
};
|
|
38434
|
+
document.addEventListener('mouseup', this.cleanUp, { once: true });
|
|
38435
|
+
}
|
|
38436
|
+
return true;
|
|
38437
|
+
};
|
|
38438
|
+
this._onMouseMoveSphere = (evt) => {
|
|
38439
|
+
if (this.draggingSphereIndex === null) {
|
|
38440
|
+
return false;
|
|
38441
|
+
}
|
|
38442
|
+
const sphereState = this.sphereStates[this.draggingSphereIndex];
|
|
38443
|
+
if (!sphereState) {
|
|
38444
|
+
return false;
|
|
38445
|
+
}
|
|
38446
|
+
const { viewport, world } = this._getViewportAndWorldCoords(evt);
|
|
38447
|
+
if (!viewport || !world) {
|
|
38448
|
+
return false;
|
|
38449
|
+
}
|
|
38450
|
+
if (sphereState.isCorner) {
|
|
38451
|
+
const newCorner = this._calculateNewCornerPosition(world);
|
|
38452
|
+
this._updateSpherePosition(sphereState, newCorner);
|
|
38453
|
+
const axisFlags = this._parseCornerKey(sphereState.uid);
|
|
38454
|
+
this._updateRelatedCorners(sphereState, newCorner, axisFlags);
|
|
38455
|
+
this._updateFaceSpheresFromCorners();
|
|
38456
|
+
this._updateCornerSpheres();
|
|
38457
|
+
}
|
|
38458
|
+
else {
|
|
38459
|
+
const axisIdx = { x: 0, y: 1, z: 2 }[sphereState.axis];
|
|
38460
|
+
let newValue = world[axisIdx];
|
|
38461
|
+
if (this.faceDragOffset !== null) {
|
|
38462
|
+
newValue += this.faceDragOffset;
|
|
38463
|
+
}
|
|
38464
|
+
sphereState.point[axisIdx] = newValue;
|
|
38465
|
+
sphereState.sphereSource.setCenter(...sphereState.point);
|
|
38466
|
+
sphereState.sphereSource.modified();
|
|
38467
|
+
this._updateCornerSpheresFromFaces();
|
|
38468
|
+
this._updateFaceSpheresFromCorners();
|
|
38469
|
+
this._updateCornerSpheres();
|
|
38470
|
+
}
|
|
38471
|
+
this._updateClippingPlanesFromFaceSpheres(viewport);
|
|
38472
|
+
viewport.render();
|
|
38473
|
+
this._triggerToolChangedEvent(sphereState);
|
|
38474
|
+
return true;
|
|
38475
|
+
};
|
|
38476
|
+
this._onControlToolChange = (evt) => {
|
|
38477
|
+
const viewport = this._getViewport();
|
|
38478
|
+
if (!evt.detail.toolCenter) {
|
|
38479
|
+
(0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.triggerEvent)(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.eventTarget, _enums__WEBPACK_IMPORTED_MODULE_12__.Events.VOLUMECROPPING_TOOL_CHANGED, {
|
|
38480
|
+
originalClippingPlanes: this.originalClippingPlanes,
|
|
38481
|
+
viewportId: viewport.id,
|
|
38482
|
+
renderingEngineId: viewport.renderingEngineId,
|
|
38483
|
+
seriesInstanceUID: this.seriesInstanceUID,
|
|
38484
|
+
});
|
|
38485
|
+
}
|
|
38486
|
+
else {
|
|
38487
|
+
if (evt.detail.seriesInstanceUID !== this.seriesInstanceUID) {
|
|
38488
|
+
return;
|
|
38489
|
+
}
|
|
38490
|
+
const isMin = evt.detail.handleType === 'min';
|
|
38491
|
+
const toolCenter = isMin
|
|
38492
|
+
? evt.detail.toolCenterMin
|
|
38493
|
+
: evt.detail.toolCenterMax;
|
|
38494
|
+
const normals = isMin
|
|
38495
|
+
? [
|
|
38496
|
+
[1, 0, 0],
|
|
38497
|
+
[0, 1, 0],
|
|
38498
|
+
[0, 0, 1],
|
|
38499
|
+
]
|
|
38500
|
+
: [
|
|
38501
|
+
[-1, 0, 0],
|
|
38502
|
+
[0, -1, 0],
|
|
38503
|
+
[0, 0, -1],
|
|
38504
|
+
];
|
|
38505
|
+
const planeIndices = isMin
|
|
38506
|
+
? [PLANEINDEX.XMIN, PLANEINDEX.YMIN, PLANEINDEX.ZMIN]
|
|
38507
|
+
: [PLANEINDEX.XMAX, PLANEINDEX.YMAX, PLANEINDEX.ZMAX];
|
|
38508
|
+
const sphereIndices = isMin
|
|
38509
|
+
? [SPHEREINDEX.XMIN, SPHEREINDEX.YMIN, SPHEREINDEX.ZMIN]
|
|
38510
|
+
: [SPHEREINDEX.XMAX, SPHEREINDEX.YMAX, SPHEREINDEX.ZMAX];
|
|
38511
|
+
const axes = ['x', 'y', 'z'];
|
|
38512
|
+
const orientationAxes = [
|
|
38513
|
+
_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.Enums.OrientationAxis.SAGITTAL,
|
|
38514
|
+
_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.Enums.OrientationAxis.CORONAL,
|
|
38515
|
+
_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.Enums.OrientationAxis.AXIAL,
|
|
38516
|
+
];
|
|
38517
|
+
for (let i = 0; i < 3; ++i) {
|
|
38518
|
+
const origin = [0, 0, 0];
|
|
38519
|
+
origin[i] = toolCenter[i];
|
|
38520
|
+
const plane = _kitware_vtk_js_Common_DataModel_Plane__WEBPACK_IMPORTED_MODULE_8__/* ["default"].newInstance */ .Ay.newInstance({
|
|
38521
|
+
origin,
|
|
38522
|
+
normal: normals[i],
|
|
38523
|
+
});
|
|
38524
|
+
this.originalClippingPlanes[planeIndices[i]].origin = plane.getOrigin();
|
|
38525
|
+
this.sphereStates[sphereIndices[i]].point[i] = plane.getOrigin()[i];
|
|
38526
|
+
this.sphereStates[sphereIndices[i]].sphereSource.setCenter(...this.sphereStates[sphereIndices[i]].point);
|
|
38527
|
+
this.sphereStates[sphereIndices[i]].sphereSource.modified();
|
|
38528
|
+
const otherSphere = this.sphereStates.find((s, idx) => s.axis === axes[i] && idx !== sphereIndices[i]);
|
|
38529
|
+
const newCenter = (otherSphere.point[i] + plane.getOrigin()[i]) / 2;
|
|
38530
|
+
this.sphereStates.forEach((state) => {
|
|
38531
|
+
if (!state.isCorner &&
|
|
38532
|
+
state.axis !== axes[i] &&
|
|
38533
|
+
!evt.detail.viewportOrientation.includes(orientationAxes[i])) {
|
|
38534
|
+
state.point[i] = newCenter;
|
|
38535
|
+
state.sphereSource.setCenter(state.point);
|
|
38536
|
+
state.sphereActor.getProperty().setColor(state.color);
|
|
38537
|
+
state.sphereSource.modified();
|
|
38538
|
+
}
|
|
38539
|
+
});
|
|
38540
|
+
const volumeActor = viewport.getDefaultActor()?.actor;
|
|
38541
|
+
if (volumeActor) {
|
|
38542
|
+
const mapper = volumeActor.getMapper();
|
|
38543
|
+
const clippingPlanes = mapper.getClippingPlanes();
|
|
38544
|
+
if (clippingPlanes) {
|
|
38545
|
+
clippingPlanes[planeIndices[i]].setOrigin(plane.getOrigin());
|
|
38546
|
+
}
|
|
38547
|
+
}
|
|
38548
|
+
}
|
|
38549
|
+
this._updateCornerSpheres();
|
|
38550
|
+
viewport.render();
|
|
38551
|
+
}
|
|
38552
|
+
};
|
|
38553
|
+
this._getViewportsInfo = () => {
|
|
38554
|
+
const viewports = (0,_store_ToolGroupManager__WEBPACK_IMPORTED_MODULE_11__.getToolGroup)(this.toolGroupId).viewportsInfo;
|
|
38555
|
+
return viewports;
|
|
38556
|
+
};
|
|
38557
|
+
this._initialize3DViewports = (viewportsInfo) => {
|
|
38558
|
+
if (!viewportsInfo || !viewportsInfo.length || !viewportsInfo[0]) {
|
|
38559
|
+
console.warn('VolumeCroppingTool: No viewportsInfo available for initialization of volumecroppingtool.');
|
|
38560
|
+
return;
|
|
38561
|
+
}
|
|
38562
|
+
const viewport = this._getViewport();
|
|
38563
|
+
const volumeActors = viewport.getActors();
|
|
38564
|
+
if (!volumeActors || volumeActors.length === 0) {
|
|
38565
|
+
console.warn('VolumeCroppingTool: No volume actors found in the viewport.');
|
|
38566
|
+
return;
|
|
38567
|
+
}
|
|
38568
|
+
const imageData = volumeActors[0].actor.getMapper().getInputData();
|
|
38569
|
+
if (!imageData) {
|
|
38570
|
+
console.warn('VolumeCroppingTool: No image data found for volume actor.');
|
|
38571
|
+
return;
|
|
38572
|
+
}
|
|
38573
|
+
this.seriesInstanceUID = imageData.seriesInstanceUID || 'unknown';
|
|
38574
|
+
const worldBounds = imageData.getBounds();
|
|
38575
|
+
const cropFactor = this.configuration.initialCropFactor || 0.1;
|
|
38576
|
+
const xRange = worldBounds[1] - worldBounds[0];
|
|
38577
|
+
const yRange = worldBounds[3] - worldBounds[2];
|
|
38578
|
+
const zRange = worldBounds[5] - worldBounds[4];
|
|
38579
|
+
const xMin = worldBounds[0] + cropFactor * xRange;
|
|
38580
|
+
const xMax = worldBounds[1] - cropFactor * xRange;
|
|
38581
|
+
const yMin = worldBounds[2] + cropFactor * yRange;
|
|
38582
|
+
const yMax = worldBounds[3] - cropFactor * yRange;
|
|
38583
|
+
const zMin = worldBounds[4] + cropFactor * zRange;
|
|
38584
|
+
const zMax = worldBounds[5] - cropFactor * zRange;
|
|
38585
|
+
const planes = [];
|
|
38586
|
+
const planeXmin = _kitware_vtk_js_Common_DataModel_Plane__WEBPACK_IMPORTED_MODULE_8__/* ["default"].newInstance */ .Ay.newInstance({
|
|
38587
|
+
origin: [xMin, 0, 0],
|
|
38588
|
+
normal: [1, 0, 0],
|
|
38589
|
+
});
|
|
38590
|
+
const planeXmax = _kitware_vtk_js_Common_DataModel_Plane__WEBPACK_IMPORTED_MODULE_8__/* ["default"].newInstance */ .Ay.newInstance({
|
|
38591
|
+
origin: [xMax, 0, 0],
|
|
38592
|
+
normal: [-1, 0, 0],
|
|
38593
|
+
});
|
|
38594
|
+
const planeYmin = _kitware_vtk_js_Common_DataModel_Plane__WEBPACK_IMPORTED_MODULE_8__/* ["default"].newInstance */ .Ay.newInstance({
|
|
38595
|
+
origin: [0, yMin, 0],
|
|
38596
|
+
normal: [0, 1, 0],
|
|
38597
|
+
});
|
|
38598
|
+
const planeYmax = _kitware_vtk_js_Common_DataModel_Plane__WEBPACK_IMPORTED_MODULE_8__/* ["default"].newInstance */ .Ay.newInstance({
|
|
38599
|
+
origin: [0, yMax, 0],
|
|
38600
|
+
normal: [0, -1, 0],
|
|
38601
|
+
});
|
|
38602
|
+
const planeZmin = _kitware_vtk_js_Common_DataModel_Plane__WEBPACK_IMPORTED_MODULE_8__/* ["default"].newInstance */ .Ay.newInstance({
|
|
38603
|
+
origin: [0, 0, zMin],
|
|
38604
|
+
normal: [0, 0, 1],
|
|
38605
|
+
});
|
|
38606
|
+
const planeZmax = _kitware_vtk_js_Common_DataModel_Plane__WEBPACK_IMPORTED_MODULE_8__/* ["default"].newInstance */ .Ay.newInstance({
|
|
38607
|
+
origin: [0, 0, zMax],
|
|
38608
|
+
normal: [0, 0, -1],
|
|
38609
|
+
});
|
|
38610
|
+
const mapper = viewport
|
|
38611
|
+
.getDefaultActor()
|
|
38612
|
+
.actor.getMapper();
|
|
38613
|
+
planes.push(planeXmin);
|
|
38614
|
+
planes.push(planeXmax);
|
|
38615
|
+
planes.push(planeYmin);
|
|
38616
|
+
planes.push(planeYmax);
|
|
38617
|
+
planes.push(planeZmin);
|
|
38618
|
+
planes.push(planeZmax);
|
|
38619
|
+
const originalPlanes = planes.map((plane) => ({
|
|
38620
|
+
origin: [...plane.getOrigin()],
|
|
38621
|
+
normal: [...plane.getNormal()],
|
|
38622
|
+
}));
|
|
38623
|
+
this.originalClippingPlanes = originalPlanes;
|
|
38624
|
+
const sphereXminPoint = [xMin, (yMax + yMin) / 2, (zMax + zMin) / 2];
|
|
38625
|
+
const sphereXmaxPoint = [xMax, (yMax + yMin) / 2, (zMax + zMin) / 2];
|
|
38626
|
+
const sphereYminPoint = [(xMax + xMin) / 2, yMin, (zMax + zMin) / 2];
|
|
38627
|
+
const sphereYmaxPoint = [(xMax + xMin) / 2, yMax, (zMax + zMin) / 2];
|
|
38628
|
+
const sphereZminPoint = [(xMax + xMin) / 2, (yMax + yMin) / 2, zMin];
|
|
38629
|
+
const sphereZmaxPoint = [(xMax + xMin) / 2, (yMax + yMin) / 2, zMax];
|
|
38630
|
+
const adaptiveRadius = this._calculateAdaptiveSphereRadius(Math.sqrt(xRange * xRange + yRange * yRange + zRange * zRange));
|
|
38631
|
+
this._addSphere(viewport, sphereXminPoint, 'x', 'min', null, adaptiveRadius);
|
|
38632
|
+
this._addSphere(viewport, sphereXmaxPoint, 'x', 'max', null, adaptiveRadius);
|
|
38633
|
+
this._addSphere(viewport, sphereYminPoint, 'y', 'min', null, adaptiveRadius);
|
|
38634
|
+
this._addSphere(viewport, sphereYmaxPoint, 'y', 'max', null, adaptiveRadius);
|
|
38635
|
+
this._addSphere(viewport, sphereZminPoint, 'z', 'min', null, adaptiveRadius);
|
|
38636
|
+
this._addSphere(viewport, sphereZmaxPoint, 'z', 'max', null, adaptiveRadius);
|
|
38637
|
+
const corners = [
|
|
38638
|
+
[xMin, yMin, zMin],
|
|
38639
|
+
[xMin, yMin, zMax],
|
|
38640
|
+
[xMin, yMax, zMin],
|
|
38641
|
+
[xMin, yMax, zMax],
|
|
38642
|
+
[xMax, yMin, zMin],
|
|
38643
|
+
[xMax, yMin, zMax],
|
|
38644
|
+
[xMax, yMax, zMin],
|
|
38645
|
+
[xMax, yMax, zMax],
|
|
38646
|
+
];
|
|
38647
|
+
const cornerKeys = [
|
|
38648
|
+
'XMIN_YMIN_ZMIN',
|
|
38649
|
+
'XMIN_YMIN_ZMAX',
|
|
38650
|
+
'XMIN_YMAX_ZMIN',
|
|
38651
|
+
'XMIN_YMAX_ZMAX',
|
|
38652
|
+
'XMAX_YMIN_ZMIN',
|
|
38653
|
+
'XMAX_YMIN_ZMAX',
|
|
38654
|
+
'XMAX_YMAX_ZMIN',
|
|
38655
|
+
'XMAX_YMAX_ZMAX',
|
|
38656
|
+
];
|
|
38657
|
+
for (let i = 0; i < corners.length; i++) {
|
|
38658
|
+
this._addSphere(viewport, corners[i], 'corner', null, cornerKeys[i], adaptiveRadius);
|
|
38659
|
+
}
|
|
38660
|
+
const edgeCornerPairs = [
|
|
38661
|
+
['XMIN_YMIN_ZMIN', 'XMAX_YMIN_ZMIN'],
|
|
38662
|
+
['XMIN_YMIN_ZMAX', 'XMAX_YMIN_ZMAX'],
|
|
38663
|
+
['XMIN_YMAX_ZMIN', 'XMAX_YMAX_ZMIN'],
|
|
38664
|
+
['XMIN_YMAX_ZMAX', 'XMAX_YMAX_ZMAX'],
|
|
38665
|
+
['XMIN_YMIN_ZMIN', 'XMIN_YMAX_ZMIN'],
|
|
38666
|
+
['XMIN_YMIN_ZMAX', 'XMIN_YMAX_ZMAX'],
|
|
38667
|
+
['XMAX_YMIN_ZMIN', 'XMAX_YMAX_ZMIN'],
|
|
38668
|
+
['XMAX_YMIN_ZMAX', 'XMAX_YMAX_ZMAX'],
|
|
38669
|
+
['XMIN_YMIN_ZMIN', 'XMIN_YMIN_ZMAX'],
|
|
38670
|
+
['XMIN_YMAX_ZMIN', 'XMIN_YMAX_ZMAX'],
|
|
38671
|
+
['XMAX_YMIN_ZMIN', 'XMAX_YMIN_ZMAX'],
|
|
38672
|
+
['XMAX_YMAX_ZMIN', 'XMAX_YMAX_ZMAX'],
|
|
38673
|
+
];
|
|
38674
|
+
edgeCornerPairs.forEach(([key1, key2], i) => {
|
|
38675
|
+
const state1 = this.sphereStates.find((s) => s.uid === `corner_${key1}`);
|
|
38676
|
+
const state2 = this.sphereStates.find((s) => s.uid === `corner_${key2}`);
|
|
38677
|
+
if (state1 && state2) {
|
|
38678
|
+
const uid = `edge_${key1}_${key2}`;
|
|
38679
|
+
const { actor, source } = this._addLine3DBetweenPoints(viewport, state1.point, state2.point, [0.7, 0.7, 0.7], uid);
|
|
38680
|
+
this.edgeLines[uid] = { actor, source, key1, key2 };
|
|
38681
|
+
}
|
|
38682
|
+
});
|
|
38683
|
+
mapper.addClippingPlane(planeXmin);
|
|
38684
|
+
mapper.addClippingPlane(planeXmax);
|
|
38685
|
+
mapper.addClippingPlane(planeYmin);
|
|
38686
|
+
mapper.addClippingPlane(planeYmax);
|
|
38687
|
+
mapper.addClippingPlane(planeZmin);
|
|
38688
|
+
mapper.addClippingPlane(planeZmax);
|
|
38689
|
+
_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.eventTarget.addEventListener(_enums__WEBPACK_IMPORTED_MODULE_12__.Events.VOLUMECROPPINGCONTROL_TOOL_CHANGED, (evt) => {
|
|
38690
|
+
this._onControlToolChange(evt);
|
|
38691
|
+
});
|
|
38692
|
+
viewport.render();
|
|
38693
|
+
};
|
|
38694
|
+
this._getViewportAndWorldCoords = (evt) => {
|
|
38695
|
+
const viewport = this._getViewport();
|
|
38696
|
+
const x = evt.detail.currentPoints.canvas[0];
|
|
38697
|
+
const y = evt.detail.currentPoints.canvas[1];
|
|
38698
|
+
const world = viewport.canvasToWorld([x, y]);
|
|
38699
|
+
return { viewport, world };
|
|
38700
|
+
};
|
|
38701
|
+
this._getViewport = () => {
|
|
38702
|
+
const [viewport3D] = this._getViewportsInfo();
|
|
38703
|
+
const renderingEngine = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.getRenderingEngine)(viewport3D.renderingEngineId);
|
|
38704
|
+
return renderingEngine.getViewport(viewport3D.viewportId);
|
|
38705
|
+
};
|
|
38706
|
+
this._handleCornerSphereMovement = (sphereState, world, viewport) => {
|
|
38707
|
+
const newCorner = this._calculateNewCornerPosition(world);
|
|
38708
|
+
this._updateSpherePosition(sphereState, newCorner);
|
|
38709
|
+
const axisFlags = this._parseCornerKey(sphereState.uid);
|
|
38710
|
+
this._updateRelatedCorners(sphereState, newCorner, axisFlags);
|
|
38711
|
+
this._updateAfterCornerMovement(viewport);
|
|
38712
|
+
};
|
|
38713
|
+
this._handleFaceSphereMovement = (sphereState, world, viewport) => {
|
|
38714
|
+
const axisIdx = { x: 0, y: 1, z: 2 }[sphereState.axis];
|
|
38715
|
+
let newValue = world[axisIdx];
|
|
38716
|
+
if (this.faceDragOffset !== null) {
|
|
38717
|
+
newValue += this.faceDragOffset;
|
|
38718
|
+
}
|
|
38719
|
+
sphereState.point[axisIdx] = newValue;
|
|
38720
|
+
sphereState.sphereSource.setCenter(...sphereState.point);
|
|
38721
|
+
sphereState.sphereSource.modified();
|
|
38722
|
+
this._updateAfterFaceMovement(viewport);
|
|
38723
|
+
};
|
|
38724
|
+
this._calculateNewCornerPosition = (world) => {
|
|
38725
|
+
let newCorner = [world[0], world[1], world[2]];
|
|
38726
|
+
if (this.cornerDragOffset) {
|
|
38727
|
+
newCorner = [
|
|
38728
|
+
world[0] + this.cornerDragOffset[0],
|
|
38729
|
+
world[1] + this.cornerDragOffset[1],
|
|
38730
|
+
world[2] + this.cornerDragOffset[2],
|
|
38731
|
+
];
|
|
38732
|
+
}
|
|
38733
|
+
return newCorner;
|
|
38734
|
+
};
|
|
38735
|
+
this._parseCornerKey = (uid) => {
|
|
38736
|
+
const cornerKey = uid.replace('corner_', '');
|
|
38737
|
+
return {
|
|
38738
|
+
isXMin: cornerKey.includes('XMIN'),
|
|
38739
|
+
isXMax: cornerKey.includes('XMAX'),
|
|
38740
|
+
isYMin: cornerKey.includes('YMIN'),
|
|
38741
|
+
isYMax: cornerKey.includes('YMAX'),
|
|
38742
|
+
isZMin: cornerKey.includes('ZMIN'),
|
|
38743
|
+
isZMax: cornerKey.includes('ZMAX'),
|
|
38744
|
+
};
|
|
38745
|
+
};
|
|
38746
|
+
this._updateSpherePosition = (sphereState, newPosition) => {
|
|
38747
|
+
sphereState.point = newPosition;
|
|
38748
|
+
sphereState.sphereSource.setCenter(...newPosition);
|
|
38749
|
+
sphereState.sphereSource.modified();
|
|
38750
|
+
};
|
|
38751
|
+
this._updateRelatedCorners = (draggedSphere, newCorner, axisFlags) => {
|
|
38752
|
+
this.sphereStates.forEach((state) => {
|
|
38753
|
+
if (!state.isCorner || state === draggedSphere) {
|
|
38754
|
+
return;
|
|
38755
|
+
}
|
|
38756
|
+
const key = state.uid.replace('corner_', '');
|
|
38757
|
+
const shouldUpdate = this._shouldUpdateCorner(key, axisFlags);
|
|
38758
|
+
if (shouldUpdate) {
|
|
38759
|
+
this._updateCornerCoordinates(state, newCorner, key, axisFlags);
|
|
38760
|
+
}
|
|
38761
|
+
});
|
|
38762
|
+
};
|
|
38763
|
+
this._shouldUpdateCorner = (cornerKey, axisFlags) => {
|
|
38764
|
+
return ((axisFlags.isXMin && cornerKey.includes('XMIN')) ||
|
|
38765
|
+
(axisFlags.isXMax && cornerKey.includes('XMAX')) ||
|
|
38766
|
+
(axisFlags.isYMin && cornerKey.includes('YMIN')) ||
|
|
38767
|
+
(axisFlags.isYMax && cornerKey.includes('YMAX')) ||
|
|
38768
|
+
(axisFlags.isZMin && cornerKey.includes('ZMIN')) ||
|
|
38769
|
+
(axisFlags.isZMax && cornerKey.includes('ZMAX')));
|
|
38770
|
+
};
|
|
38771
|
+
this._updateCornerCoordinates = (state, newCorner, cornerKey, axisFlags) => {
|
|
38772
|
+
if ((axisFlags.isXMin && cornerKey.includes('XMIN')) ||
|
|
38773
|
+
(axisFlags.isXMax && cornerKey.includes('XMAX'))) {
|
|
38774
|
+
state.point[0] = newCorner[0];
|
|
38775
|
+
}
|
|
38776
|
+
if ((axisFlags.isYMin && cornerKey.includes('YMIN')) ||
|
|
38777
|
+
(axisFlags.isYMax && cornerKey.includes('YMAX'))) {
|
|
38778
|
+
state.point[1] = newCorner[1];
|
|
38779
|
+
}
|
|
38780
|
+
if ((axisFlags.isZMin && cornerKey.includes('ZMIN')) ||
|
|
38781
|
+
(axisFlags.isZMax && cornerKey.includes('ZMAX'))) {
|
|
38782
|
+
state.point[2] = newCorner[2];
|
|
38783
|
+
}
|
|
38784
|
+
state.sphereSource.setCenter(...state.point);
|
|
38785
|
+
state.sphereSource.modified();
|
|
38786
|
+
};
|
|
38787
|
+
this._updateAfterCornerMovement = (viewport) => {
|
|
38788
|
+
this._updateFaceSpheresFromCorners();
|
|
38789
|
+
this._updateCornerSpheres();
|
|
38790
|
+
this._updateClippingPlanesFromFaceSpheres(viewport);
|
|
38791
|
+
};
|
|
38792
|
+
this._updateAfterFaceMovement = (viewport) => {
|
|
38793
|
+
this._updateCornerSpheresFromFaces();
|
|
38794
|
+
this._updateClippingPlanesFromFaceSpheres(viewport);
|
|
38795
|
+
};
|
|
38796
|
+
this._triggerToolChangedEvent = (sphereState) => {
|
|
38797
|
+
(0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.triggerEvent)(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.eventTarget, _enums__WEBPACK_IMPORTED_MODULE_12__.Events.VOLUMECROPPING_TOOL_CHANGED, {
|
|
38798
|
+
toolCenter: sphereState.point,
|
|
38799
|
+
axis: sphereState.isCorner ? 'corner' : sphereState.axis,
|
|
38800
|
+
draggingSphereIndex: this.draggingSphereIndex,
|
|
38801
|
+
seriesInstanceUID: this.seriesInstanceUID,
|
|
38802
|
+
});
|
|
38803
|
+
};
|
|
38804
|
+
this._onNewVolume = () => {
|
|
38805
|
+
const viewportsInfo = this._getViewportsInfo();
|
|
38806
|
+
this.originalClippingPlanes = [];
|
|
38807
|
+
this.sphereStates = [];
|
|
38808
|
+
this.edgeLines = {};
|
|
38809
|
+
this._initialize3DViewports(viewportsInfo);
|
|
38810
|
+
};
|
|
38811
|
+
this._rotateCamera = (viewport, centerWorld, axis, angle) => {
|
|
38812
|
+
const vtkCamera = viewport.getVtkActiveCamera();
|
|
38813
|
+
const viewUp = vtkCamera.getViewUp();
|
|
38814
|
+
const focalPoint = vtkCamera.getFocalPoint();
|
|
38815
|
+
const position = vtkCamera.getPosition();
|
|
38816
|
+
const newPosition = [0, 0, 0];
|
|
38817
|
+
const newFocalPoint = [0, 0, 0];
|
|
38818
|
+
const newViewUp = [0, 0, 0];
|
|
38819
|
+
const transform = gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .mat4.identity */ .pB.identity(new Float32Array(16));
|
|
38820
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .mat4.translate */ .pB.translate(transform, transform, centerWorld);
|
|
38821
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .mat4.rotate */ .pB.rotate(transform, transform, angle, axis);
|
|
38822
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .mat4.translate */ .pB.translate(transform, transform, [
|
|
38823
|
+
-centerWorld[0],
|
|
38824
|
+
-centerWorld[1],
|
|
38825
|
+
-centerWorld[2],
|
|
38826
|
+
]);
|
|
38827
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .vec3.transformMat4 */ .eR.transformMat4(newPosition, position, transform);
|
|
38828
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .vec3.transformMat4 */ .eR.transformMat4(newFocalPoint, focalPoint, transform);
|
|
38829
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .mat4.identity */ .pB.identity(transform);
|
|
38830
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .mat4.rotate */ .pB.rotate(transform, transform, angle, axis);
|
|
38831
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .vec3.transformMat4 */ .eR.transformMat4(newViewUp, viewUp, transform);
|
|
38832
|
+
viewport.setCamera({
|
|
38833
|
+
position: newPosition,
|
|
38834
|
+
viewUp: newViewUp,
|
|
38835
|
+
focalPoint: newFocalPoint,
|
|
38836
|
+
});
|
|
38837
|
+
};
|
|
38838
|
+
this.touchDragCallback = this._dragCallback.bind(this);
|
|
38839
|
+
this.mouseDragCallback = this._dragCallback.bind(this);
|
|
38840
|
+
}
|
|
38841
|
+
onSetToolActive() {
|
|
38842
|
+
if (this.sphereStates && this.sphereStates.length > 0) {
|
|
38843
|
+
if (this.configuration.showHandles) {
|
|
38844
|
+
this.setHandlesVisible(false);
|
|
38845
|
+
this.setClippingPlanesVisible(false);
|
|
38846
|
+
}
|
|
38847
|
+
else {
|
|
38848
|
+
this.setHandlesVisible(true);
|
|
38849
|
+
this.setClippingPlanesVisible(true);
|
|
38850
|
+
}
|
|
38851
|
+
}
|
|
38852
|
+
else {
|
|
38853
|
+
const viewportsInfo = this._getViewportsInfo();
|
|
38854
|
+
const subscribeToElementResize = () => {
|
|
38855
|
+
viewportsInfo.forEach(({ viewportId, renderingEngineId }) => {
|
|
38856
|
+
if (!this._resizeObservers.has(viewportId)) {
|
|
38857
|
+
const { viewport } = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.getEnabledElementByIds)(viewportId, renderingEngineId) || { viewport: null };
|
|
38858
|
+
if (!viewport) {
|
|
38859
|
+
return;
|
|
38860
|
+
}
|
|
38861
|
+
const { element } = viewport;
|
|
38862
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
38863
|
+
const element = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.getEnabledElementByIds)(viewportId, renderingEngineId);
|
|
38864
|
+
if (!element) {
|
|
38865
|
+
return;
|
|
38866
|
+
}
|
|
38867
|
+
const { viewport } = element;
|
|
38868
|
+
const viewPresentation = viewport.getViewPresentation();
|
|
38869
|
+
viewport.resetCamera();
|
|
38870
|
+
viewport.setViewPresentation(viewPresentation);
|
|
38871
|
+
viewport.render();
|
|
38872
|
+
});
|
|
38873
|
+
resizeObserver.observe(element);
|
|
38874
|
+
this._resizeObservers.set(viewportId, resizeObserver);
|
|
38875
|
+
}
|
|
38876
|
+
});
|
|
38877
|
+
};
|
|
38878
|
+
subscribeToElementResize();
|
|
38879
|
+
this._viewportAddedListener = (evt) => {
|
|
38880
|
+
if (evt.detail.toolGroupId === this.toolGroupId) {
|
|
38881
|
+
subscribeToElementResize();
|
|
38882
|
+
}
|
|
38883
|
+
};
|
|
38884
|
+
_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.eventTarget.addEventListener(_enums__WEBPACK_IMPORTED_MODULE_12__.Events.TOOLGROUP_VIEWPORT_ADDED, this._viewportAddedListener);
|
|
38885
|
+
this._unsubscribeToViewportNewVolumeSet(viewportsInfo);
|
|
38886
|
+
this._subscribeToViewportNewVolumeSet(viewportsInfo);
|
|
38887
|
+
this._initialize3DViewports(viewportsInfo);
|
|
38888
|
+
if (this.sphereStates && this.sphereStates.length > 0) {
|
|
38889
|
+
this.setHandlesVisible(true);
|
|
38890
|
+
}
|
|
38891
|
+
else {
|
|
38892
|
+
this.originalClippingPlanes = [];
|
|
38893
|
+
this._initialize3DViewports(viewportsInfo);
|
|
38894
|
+
}
|
|
38895
|
+
}
|
|
38896
|
+
}
|
|
38897
|
+
onSetToolDisabled() {
|
|
38898
|
+
this._resizeObservers.forEach((resizeObserver, viewportId) => {
|
|
38899
|
+
resizeObserver.disconnect();
|
|
38900
|
+
this._resizeObservers.delete(viewportId);
|
|
38901
|
+
});
|
|
38902
|
+
if (this._viewportAddedListener) {
|
|
38903
|
+
_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.eventTarget.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_12__.Events.TOOLGROUP_VIEWPORT_ADDED, this._viewportAddedListener);
|
|
38904
|
+
this._viewportAddedListener = null;
|
|
38905
|
+
}
|
|
38906
|
+
const viewportsInfo = this._getViewportsInfo();
|
|
38907
|
+
this._unsubscribeToViewportNewVolumeSet(viewportsInfo);
|
|
38908
|
+
}
|
|
38909
|
+
setHandlesVisible(visible) {
|
|
38910
|
+
this.configuration.showHandles = visible;
|
|
38911
|
+
if (visible) {
|
|
38912
|
+
this.sphereStates[SPHEREINDEX.XMIN].point[0] =
|
|
38913
|
+
this.originalClippingPlanes[PLANEINDEX.XMIN].origin[0];
|
|
38914
|
+
this.sphereStates[SPHEREINDEX.XMAX].point[0] =
|
|
38915
|
+
this.originalClippingPlanes[PLANEINDEX.XMAX].origin[0];
|
|
38916
|
+
this.sphereStates[SPHEREINDEX.YMIN].point[1] =
|
|
38917
|
+
this.originalClippingPlanes[PLANEINDEX.YMIN].origin[1];
|
|
38918
|
+
this.sphereStates[SPHEREINDEX.YMAX].point[1] =
|
|
38919
|
+
this.originalClippingPlanes[PLANEINDEX.YMAX].origin[1];
|
|
38920
|
+
this.sphereStates[SPHEREINDEX.ZMIN].point[2] =
|
|
38921
|
+
this.originalClippingPlanes[PLANEINDEX.ZMIN].origin[2];
|
|
38922
|
+
this.sphereStates[SPHEREINDEX.ZMAX].point[2] =
|
|
38923
|
+
this.originalClippingPlanes[PLANEINDEX.ZMAX].origin[2];
|
|
38924
|
+
[
|
|
38925
|
+
SPHEREINDEX.XMIN,
|
|
38926
|
+
SPHEREINDEX.XMAX,
|
|
38927
|
+
SPHEREINDEX.YMIN,
|
|
38928
|
+
SPHEREINDEX.YMAX,
|
|
38929
|
+
SPHEREINDEX.ZMIN,
|
|
38930
|
+
SPHEREINDEX.ZMAX,
|
|
38931
|
+
].forEach((idx) => {
|
|
38932
|
+
const s = this.sphereStates[idx];
|
|
38933
|
+
s.sphereSource.setCenter(...s.point);
|
|
38934
|
+
s.sphereSource.modified();
|
|
38935
|
+
});
|
|
38936
|
+
this._updateCornerSpheres();
|
|
38937
|
+
}
|
|
38938
|
+
this._updateHandlesVisibility();
|
|
38939
|
+
const viewportsInfo = this._getViewportsInfo();
|
|
38940
|
+
const [viewport3D] = viewportsInfo;
|
|
38941
|
+
const renderingEngine = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.getRenderingEngine)(viewport3D.renderingEngineId);
|
|
38942
|
+
const viewport = renderingEngine.getViewport(viewport3D.viewportId);
|
|
38943
|
+
viewport.render();
|
|
38944
|
+
}
|
|
38945
|
+
getHandlesVisible() {
|
|
38946
|
+
return this.configuration.showHandles;
|
|
38947
|
+
}
|
|
38948
|
+
getClippingPlanesVisible() {
|
|
38949
|
+
return this.configuration.showClippingPlanes;
|
|
38950
|
+
}
|
|
38951
|
+
setClippingPlanesVisible(visible) {
|
|
38952
|
+
this.configuration.showClippingPlanes = visible;
|
|
38953
|
+
const viewport = this._getViewport();
|
|
38954
|
+
this._updateClippingPlanes(viewport);
|
|
38955
|
+
viewport.render();
|
|
38956
|
+
}
|
|
38957
|
+
_dragCallback(evt) {
|
|
38958
|
+
const { element, currentPoints, lastPoints } = evt.detail;
|
|
38959
|
+
if (this.draggingSphereIndex !== null) {
|
|
38960
|
+
this._onMouseMoveSphere(evt);
|
|
38961
|
+
}
|
|
38962
|
+
else {
|
|
38963
|
+
const currentPointsCanvas = currentPoints.canvas;
|
|
38964
|
+
const lastPointsCanvas = lastPoints.canvas;
|
|
38965
|
+
const { rotateIncrementDegrees } = this.configuration;
|
|
38966
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.getEnabledElement)(element);
|
|
38967
|
+
const { viewport } = enabledElement;
|
|
38968
|
+
const camera = viewport.getCamera();
|
|
38969
|
+
const width = element.clientWidth;
|
|
38970
|
+
const height = element.clientHeight;
|
|
38971
|
+
const normalizedPosition = [
|
|
38972
|
+
currentPointsCanvas[0] / width,
|
|
38973
|
+
currentPointsCanvas[1] / height,
|
|
38974
|
+
];
|
|
38975
|
+
const normalizedPreviousPosition = [
|
|
38976
|
+
lastPointsCanvas[0] / width,
|
|
38977
|
+
lastPointsCanvas[1] / height,
|
|
38978
|
+
];
|
|
38979
|
+
const center = [width * 0.5, height * 0.5];
|
|
38980
|
+
const centerWorld = viewport.canvasToWorld(center);
|
|
38981
|
+
const normalizedCenter = [0.5, 0.5];
|
|
38982
|
+
const radsq = (1.0 + Math.abs(normalizedCenter[0])) ** 2.0;
|
|
38983
|
+
const op = [normalizedPreviousPosition[0], 0, 0];
|
|
38984
|
+
const oe = [normalizedPosition[0], 0, 0];
|
|
38985
|
+
const opsq = op[0] ** 2;
|
|
38986
|
+
const oesq = oe[0] ** 2;
|
|
38987
|
+
const lop = opsq > radsq ? 0 : Math.sqrt(radsq - opsq);
|
|
38988
|
+
const loe = oesq > radsq ? 0 : Math.sqrt(radsq - oesq);
|
|
38989
|
+
const nop = [op[0], 0, lop];
|
|
38990
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_4__/* ["default"].normalize */ .Ay.normalize(nop);
|
|
38991
|
+
const noe = [oe[0], 0, loe];
|
|
38992
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_4__/* ["default"].normalize */ .Ay.normalize(noe);
|
|
38993
|
+
const dot = _kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_4__/* ["default"].dot */ .Ay.dot(nop, noe);
|
|
38994
|
+
if (Math.abs(dot) > 0.0001) {
|
|
38995
|
+
const angleX = -2 *
|
|
38996
|
+
Math.acos(_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_4__/* ["default"].clampValue */ .Ay.clampValue(dot, -1.0, 1.0)) *
|
|
38997
|
+
Math.sign(normalizedPosition[0] - normalizedPreviousPosition[0]) *
|
|
38998
|
+
rotateIncrementDegrees;
|
|
38999
|
+
const upVec = camera.viewUp;
|
|
39000
|
+
const atV = camera.viewPlaneNormal;
|
|
39001
|
+
const rightV = [0, 0, 0];
|
|
39002
|
+
const forwardV = [0, 0, 0];
|
|
39003
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_4__/* ["default"].cross */ .Ay.cross(upVec, atV, rightV);
|
|
39004
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_4__/* ["default"].normalize */ .Ay.normalize(rightV);
|
|
39005
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_4__/* ["default"].cross */ .Ay.cross(atV, rightV, forwardV);
|
|
39006
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_4__/* ["default"].normalize */ .Ay.normalize(forwardV);
|
|
39007
|
+
_kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_4__/* ["default"].normalize */ .Ay.normalize(upVec);
|
|
39008
|
+
this._rotateCamera(viewport, centerWorld, forwardV, angleX);
|
|
39009
|
+
const angleY = (normalizedPreviousPosition[1] - normalizedPosition[1]) *
|
|
39010
|
+
rotateIncrementDegrees;
|
|
39011
|
+
this._rotateCamera(viewport, centerWorld, rightV, angleY);
|
|
39012
|
+
}
|
|
39013
|
+
viewport.render();
|
|
39014
|
+
}
|
|
39015
|
+
}
|
|
39016
|
+
_updateClippingPlanes(viewport) {
|
|
39017
|
+
const actorEntry = viewport.getDefaultActor();
|
|
39018
|
+
if (!actorEntry || !actorEntry.actor) {
|
|
39019
|
+
if (!viewport._missingActorWarned) {
|
|
39020
|
+
console.warn('VolumeCroppingTool._updateClippingPlanes: No default actor found in viewport.');
|
|
39021
|
+
viewport._missingActorWarned = true;
|
|
39022
|
+
}
|
|
39023
|
+
return;
|
|
39024
|
+
}
|
|
39025
|
+
const actor = actorEntry.actor;
|
|
39026
|
+
const mapper = actor.getMapper();
|
|
39027
|
+
const matrix = actor.getMatrix();
|
|
39028
|
+
if (!this.configuration.showClippingPlanes) {
|
|
39029
|
+
mapper.removeAllClippingPlanes();
|
|
39030
|
+
return;
|
|
39031
|
+
}
|
|
39032
|
+
const rot = gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .mat3.create */ .w0.create();
|
|
39033
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .mat3.fromMat4 */ .w0.fromMat4(rot, matrix);
|
|
39034
|
+
const normalMatrix = gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .mat3.create */ .w0.create();
|
|
39035
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .mat3.invert */ .w0.invert(normalMatrix, rot);
|
|
39036
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .mat3.transpose */ .w0.transpose(normalMatrix, normalMatrix);
|
|
39037
|
+
const originalPlanes = this.originalClippingPlanes;
|
|
39038
|
+
if (!originalPlanes || !originalPlanes.length) {
|
|
39039
|
+
return;
|
|
39040
|
+
}
|
|
39041
|
+
mapper.removeAllClippingPlanes();
|
|
39042
|
+
const transformedOrigins = [];
|
|
39043
|
+
const transformedNormals = [];
|
|
39044
|
+
for (let i = 0; i < originalPlanes.length; ++i) {
|
|
39045
|
+
const plane = originalPlanes[i];
|
|
39046
|
+
const oVec = gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .vec3.create */ .eR.create();
|
|
39047
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .vec3.transformMat4 */ .eR.transformMat4(oVec, new Float32Array(plane.origin), matrix);
|
|
39048
|
+
const o = [oVec[0], oVec[1], oVec[2]];
|
|
39049
|
+
const nVec = gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .vec3.create */ .eR.create();
|
|
39050
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .vec3.transformMat3 */ .eR.transformMat3(nVec, new Float32Array(plane.normal), normalMatrix);
|
|
39051
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_3__/* .vec3.normalize */ .eR.normalize(nVec, nVec);
|
|
39052
|
+
const n = [nVec[0], nVec[1], nVec[2]];
|
|
39053
|
+
transformedOrigins.push(o);
|
|
39054
|
+
transformedNormals.push(n);
|
|
39055
|
+
}
|
|
39056
|
+
for (let i = 0; i < transformedOrigins.length; ++i) {
|
|
39057
|
+
const planeInstance = _kitware_vtk_js_Common_DataModel_Plane__WEBPACK_IMPORTED_MODULE_8__/* ["default"].newInstance */ .Ay.newInstance({
|
|
39058
|
+
origin: transformedOrigins[i],
|
|
39059
|
+
normal: transformedNormals[i],
|
|
39060
|
+
});
|
|
39061
|
+
mapper.addClippingPlane(planeInstance);
|
|
39062
|
+
}
|
|
39063
|
+
}
|
|
39064
|
+
_updateHandlesVisibility() {
|
|
39065
|
+
this.sphereStates.forEach((state) => {
|
|
39066
|
+
if (state.sphereActor) {
|
|
39067
|
+
state.sphereActor.setVisibility(this.configuration.showHandles);
|
|
39068
|
+
}
|
|
39069
|
+
});
|
|
39070
|
+
Object.values(this.edgeLines).forEach(({ actor }) => {
|
|
39071
|
+
if (actor) {
|
|
39072
|
+
actor.setVisibility(this.configuration.showHandles);
|
|
39073
|
+
}
|
|
39074
|
+
});
|
|
39075
|
+
}
|
|
39076
|
+
_addLine3DBetweenPoints(viewport, point1, point2, color = [0.7, 0.7, 0.7], uid = '') {
|
|
39077
|
+
if (point1[0] === point2[0] &&
|
|
39078
|
+
point1[1] === point2[1] &&
|
|
39079
|
+
point1[2] === point2[2]) {
|
|
39080
|
+
return { actor: null, source: null };
|
|
39081
|
+
}
|
|
39082
|
+
const points = _kitware_vtk_js_Common_Core_Points__WEBPACK_IMPORTED_MODULE_1__/* ["default"].newInstance */ .Ay.newInstance();
|
|
39083
|
+
points.setNumberOfPoints(2);
|
|
39084
|
+
points.setPoint(0, point1[0], point1[1], point1[2]);
|
|
39085
|
+
points.setPoint(1, point2[0], point2[1], point2[2]);
|
|
39086
|
+
const lines = _kitware_vtk_js_Common_Core_CellArray__WEBPACK_IMPORTED_MODULE_2__/* ["default"].newInstance */ .Ay.newInstance({ values: [2, 0, 1] });
|
|
39087
|
+
const polyData = _kitware_vtk_js_Common_DataModel_PolyData__WEBPACK_IMPORTED_MODULE_0__/* ["default"].newInstance */ .Ay.newInstance();
|
|
39088
|
+
polyData.setPoints(points);
|
|
39089
|
+
polyData.setLines(lines);
|
|
39090
|
+
const mapper = _kitware_vtk_js_Rendering_Core_Mapper__WEBPACK_IMPORTED_MODULE_7__/* ["default"].newInstance */ .Ay.newInstance();
|
|
39091
|
+
mapper.setInputData(polyData);
|
|
39092
|
+
const actor = _kitware_vtk_js_Rendering_Core_Actor__WEBPACK_IMPORTED_MODULE_5__/* ["default"].newInstance */ .Ay.newInstance();
|
|
39093
|
+
actor.setMapper(mapper);
|
|
39094
|
+
actor.getProperty().setColor(...color);
|
|
39095
|
+
actor.getProperty().setLineWidth(0.5);
|
|
39096
|
+
actor.getProperty().setOpacity(1.0);
|
|
39097
|
+
actor.getProperty().setInterpolationToFlat();
|
|
39098
|
+
actor.getProperty().setAmbient(1.0);
|
|
39099
|
+
actor.getProperty().setDiffuse(0.0);
|
|
39100
|
+
actor.getProperty().setSpecular(0.0);
|
|
39101
|
+
actor.setVisibility(this.configuration.showHandles);
|
|
39102
|
+
viewport.addActor({ actor, uid });
|
|
39103
|
+
return { actor, source: polyData };
|
|
39104
|
+
}
|
|
39105
|
+
_addSphere(viewport, point, axis, position, cornerKey = null, adaptiveRadius) {
|
|
39106
|
+
const uid = cornerKey ? `corner_${cornerKey}` : `${axis}_${position}`;
|
|
39107
|
+
const sphereState = this.sphereStates.find((s) => s.uid === uid);
|
|
39108
|
+
if (sphereState) {
|
|
39109
|
+
return;
|
|
39110
|
+
}
|
|
39111
|
+
const sphereSource = _kitware_vtk_js_Filters_Sources_SphereSource__WEBPACK_IMPORTED_MODULE_6__/* ["default"].newInstance */ .Ay.newInstance();
|
|
39112
|
+
sphereSource.setCenter(point);
|
|
39113
|
+
sphereSource.setRadius(adaptiveRadius);
|
|
39114
|
+
const sphereMapper = _kitware_vtk_js_Rendering_Core_Mapper__WEBPACK_IMPORTED_MODULE_7__/* ["default"].newInstance */ .Ay.newInstance();
|
|
39115
|
+
sphereMapper.setInputConnection(sphereSource.getOutputPort());
|
|
39116
|
+
const sphereActor = _kitware_vtk_js_Rendering_Core_Actor__WEBPACK_IMPORTED_MODULE_5__/* ["default"].newInstance */ .Ay.newInstance();
|
|
39117
|
+
sphereActor.setMapper(sphereMapper);
|
|
39118
|
+
let color = [0.0, 1.0, 0.0];
|
|
39119
|
+
const sphereColors = this.configuration.sphereColors || {};
|
|
39120
|
+
if (cornerKey) {
|
|
39121
|
+
color = sphereColors.CORNERS || [0.0, 0.0, 1.0];
|
|
39122
|
+
}
|
|
39123
|
+
else if (axis === 'z') {
|
|
39124
|
+
color = sphereColors.AXIAL || [1.0, 0.0, 0.0];
|
|
39125
|
+
}
|
|
39126
|
+
else if (axis === 'x') {
|
|
39127
|
+
color = sphereColors.SAGITTAL || [1.0, 1.0, 0.0];
|
|
39128
|
+
}
|
|
39129
|
+
else if (axis === 'y') {
|
|
39130
|
+
color = sphereColors.CORONAL || [0.0, 1.0, 0.0];
|
|
39131
|
+
}
|
|
39132
|
+
const idx = this.sphereStates.findIndex((s) => s.uid === uid);
|
|
39133
|
+
if (idx === -1) {
|
|
39134
|
+
this.sphereStates.push({
|
|
39135
|
+
point: point.slice(),
|
|
39136
|
+
axis,
|
|
39137
|
+
uid,
|
|
39138
|
+
sphereSource,
|
|
39139
|
+
sphereActor,
|
|
39140
|
+
isCorner: !!cornerKey,
|
|
39141
|
+
color,
|
|
39142
|
+
});
|
|
39143
|
+
}
|
|
39144
|
+
else {
|
|
39145
|
+
this.sphereStates[idx].point = point.slice();
|
|
39146
|
+
this.sphereStates[idx].sphereSource = sphereSource;
|
|
39147
|
+
}
|
|
39148
|
+
const existingActors = viewport.getActors();
|
|
39149
|
+
const existing = existingActors.find((a) => a.uid === uid);
|
|
39150
|
+
if (existing) {
|
|
39151
|
+
return;
|
|
39152
|
+
}
|
|
39153
|
+
sphereActor.getProperty().setColor(color);
|
|
39154
|
+
sphereActor.setVisibility(this.configuration.showHandles);
|
|
39155
|
+
viewport.addActor({ actor: sphereActor, uid: uid });
|
|
39156
|
+
}
|
|
39157
|
+
_calculateAdaptiveSphereRadius(diagonal) {
|
|
39158
|
+
const baseRadius = this.configuration.sphereRadius !== undefined
|
|
39159
|
+
? this.configuration.sphereRadius
|
|
39160
|
+
: 8;
|
|
39161
|
+
const scaleFactor = this.configuration.sphereRadiusScale || 0.01;
|
|
39162
|
+
const adaptiveRadius = diagonal * scaleFactor;
|
|
39163
|
+
const minRadius = this.configuration.minSphereRadius || 2;
|
|
39164
|
+
const maxRadius = this.configuration.maxSphereRadius || 50;
|
|
39165
|
+
return Math.max(minRadius, Math.min(maxRadius, adaptiveRadius));
|
|
39166
|
+
}
|
|
39167
|
+
_updateClippingPlanesFromFaceSpheres(viewport) {
|
|
39168
|
+
const mapper = viewport.getDefaultActor().actor.getMapper();
|
|
39169
|
+
this.originalClippingPlanes[0].origin = [
|
|
39170
|
+
...this.sphereStates[SPHEREINDEX.XMIN].point,
|
|
39171
|
+
];
|
|
39172
|
+
this.originalClippingPlanes[1].origin = [
|
|
39173
|
+
...this.sphereStates[SPHEREINDEX.XMAX].point,
|
|
39174
|
+
];
|
|
39175
|
+
this.originalClippingPlanes[2].origin = [
|
|
39176
|
+
...this.sphereStates[SPHEREINDEX.YMIN].point,
|
|
39177
|
+
];
|
|
39178
|
+
this.originalClippingPlanes[3].origin = [
|
|
39179
|
+
...this.sphereStates[SPHEREINDEX.YMAX].point,
|
|
39180
|
+
];
|
|
39181
|
+
this.originalClippingPlanes[4].origin = [
|
|
39182
|
+
...this.sphereStates[SPHEREINDEX.ZMIN].point,
|
|
39183
|
+
];
|
|
39184
|
+
this.originalClippingPlanes[5].origin = [
|
|
39185
|
+
...this.sphereStates[SPHEREINDEX.ZMAX].point,
|
|
39186
|
+
];
|
|
39187
|
+
mapper.removeAllClippingPlanes();
|
|
39188
|
+
for (let i = 0; i < 6; ++i) {
|
|
39189
|
+
const origin = this.originalClippingPlanes[i].origin;
|
|
39190
|
+
const normal = this.originalClippingPlanes[i].normal;
|
|
39191
|
+
const plane = _kitware_vtk_js_Common_DataModel_Plane__WEBPACK_IMPORTED_MODULE_8__/* ["default"].newInstance */ .Ay.newInstance({
|
|
39192
|
+
origin,
|
|
39193
|
+
normal,
|
|
39194
|
+
});
|
|
39195
|
+
mapper.addClippingPlane(plane);
|
|
39196
|
+
}
|
|
39197
|
+
}
|
|
39198
|
+
_updateCornerSpheresFromFaces() {
|
|
39199
|
+
const xMin = this.sphereStates[SPHEREINDEX.XMIN].point[0];
|
|
39200
|
+
const xMax = this.sphereStates[SPHEREINDEX.XMAX].point[0];
|
|
39201
|
+
const yMin = this.sphereStates[SPHEREINDEX.YMIN].point[1];
|
|
39202
|
+
const yMax = this.sphereStates[SPHEREINDEX.YMAX].point[1];
|
|
39203
|
+
const zMin = this.sphereStates[SPHEREINDEX.ZMIN].point[2];
|
|
39204
|
+
const zMax = this.sphereStates[SPHEREINDEX.ZMAX].point[2];
|
|
39205
|
+
const corners = [
|
|
39206
|
+
{ key: 'XMIN_YMIN_ZMIN', pos: [xMin, yMin, zMin] },
|
|
39207
|
+
{ key: 'XMIN_YMIN_ZMAX', pos: [xMin, yMin, zMax] },
|
|
39208
|
+
{ key: 'XMIN_YMAX_ZMIN', pos: [xMin, yMax, zMin] },
|
|
39209
|
+
{ key: 'XMIN_YMAX_ZMAX', pos: [xMin, yMax, zMax] },
|
|
39210
|
+
{ key: 'XMAX_YMIN_ZMIN', pos: [xMax, yMin, zMin] },
|
|
39211
|
+
{ key: 'XMAX_YMIN_ZMAX', pos: [xMax, yMin, zMax] },
|
|
39212
|
+
{ key: 'XMAX_YMAX_ZMIN', pos: [xMax, yMax, zMin] },
|
|
39213
|
+
{ key: 'XMAX_YMAX_ZMAX', pos: [xMax, yMax, zMax] },
|
|
39214
|
+
];
|
|
39215
|
+
for (const corner of corners) {
|
|
39216
|
+
const state = this.sphereStates.find((s) => s.uid === `corner_${corner.key}`);
|
|
39217
|
+
if (state) {
|
|
39218
|
+
state.point[0] = corner.pos[0];
|
|
39219
|
+
state.point[1] = corner.pos[1];
|
|
39220
|
+
state.point[2] = corner.pos[2];
|
|
39221
|
+
state.sphereSource.setCenter(...state.point);
|
|
39222
|
+
state.sphereSource.modified();
|
|
39223
|
+
}
|
|
39224
|
+
}
|
|
39225
|
+
}
|
|
39226
|
+
_updateFaceSpheresFromCorners() {
|
|
39227
|
+
const corners = [
|
|
39228
|
+
this.sphereStates[SPHEREINDEX.XMIN_YMIN_ZMIN].point,
|
|
39229
|
+
this.sphereStates[SPHEREINDEX.XMIN_YMIN_ZMAX].point,
|
|
39230
|
+
this.sphereStates[SPHEREINDEX.XMIN_YMAX_ZMIN].point,
|
|
39231
|
+
this.sphereStates[SPHEREINDEX.XMIN_YMAX_ZMAX].point,
|
|
39232
|
+
this.sphereStates[SPHEREINDEX.XMAX_YMIN_ZMIN].point,
|
|
39233
|
+
this.sphereStates[SPHEREINDEX.XMAX_YMIN_ZMAX].point,
|
|
39234
|
+
this.sphereStates[SPHEREINDEX.XMAX_YMAX_ZMIN].point,
|
|
39235
|
+
this.sphereStates[SPHEREINDEX.XMAX_YMAX_ZMAX].point,
|
|
39236
|
+
];
|
|
39237
|
+
const xs = corners.map((p) => p[0]);
|
|
39238
|
+
const ys = corners.map((p) => p[1]);
|
|
39239
|
+
const zs = corners.map((p) => p[2]);
|
|
39240
|
+
const xMin = Math.min(...xs), xMax = Math.max(...xs);
|
|
39241
|
+
const yMin = Math.min(...ys), yMax = Math.max(...ys);
|
|
39242
|
+
const zMin = Math.min(...zs), zMax = Math.max(...zs);
|
|
39243
|
+
this.sphereStates[SPHEREINDEX.XMIN].point = [
|
|
39244
|
+
xMin,
|
|
39245
|
+
(yMin + yMax) / 2,
|
|
39246
|
+
(zMin + zMax) / 2,
|
|
39247
|
+
];
|
|
39248
|
+
this.sphereStates[SPHEREINDEX.XMAX].point = [
|
|
39249
|
+
xMax,
|
|
39250
|
+
(yMin + yMax) / 2,
|
|
39251
|
+
(zMin + zMax) / 2,
|
|
39252
|
+
];
|
|
39253
|
+
this.sphereStates[SPHEREINDEX.YMIN].point = [
|
|
39254
|
+
(xMin + xMax) / 2,
|
|
39255
|
+
yMin,
|
|
39256
|
+
(zMin + zMax) / 2,
|
|
39257
|
+
];
|
|
39258
|
+
this.sphereStates[SPHEREINDEX.YMAX].point = [
|
|
39259
|
+
(xMin + xMax) / 2,
|
|
39260
|
+
yMax,
|
|
39261
|
+
(zMin + zMax) / 2,
|
|
39262
|
+
];
|
|
39263
|
+
this.sphereStates[SPHEREINDEX.ZMIN].point = [
|
|
39264
|
+
(xMin + xMax) / 2,
|
|
39265
|
+
(yMin + yMax) / 2,
|
|
39266
|
+
zMin,
|
|
39267
|
+
];
|
|
39268
|
+
this.sphereStates[SPHEREINDEX.ZMAX].point = [
|
|
39269
|
+
(xMin + xMax) / 2,
|
|
39270
|
+
(yMin + yMax) / 2,
|
|
39271
|
+
zMax,
|
|
39272
|
+
];
|
|
39273
|
+
[
|
|
39274
|
+
SPHEREINDEX.XMIN,
|
|
39275
|
+
SPHEREINDEX.XMAX,
|
|
39276
|
+
SPHEREINDEX.YMIN,
|
|
39277
|
+
SPHEREINDEX.YMAX,
|
|
39278
|
+
SPHEREINDEX.ZMIN,
|
|
39279
|
+
SPHEREINDEX.ZMAX,
|
|
39280
|
+
].forEach((idx) => {
|
|
39281
|
+
const s = this.sphereStates[idx];
|
|
39282
|
+
s.sphereSource.setCenter(...s.point);
|
|
39283
|
+
s.sphereSource.modified();
|
|
39284
|
+
});
|
|
39285
|
+
}
|
|
39286
|
+
_updateCornerSpheres() {
|
|
39287
|
+
const xMin = this.sphereStates[SPHEREINDEX.XMIN].point[0];
|
|
39288
|
+
const xMax = this.sphereStates[SPHEREINDEX.XMAX].point[0];
|
|
39289
|
+
const yMin = this.sphereStates[SPHEREINDEX.YMIN].point[1];
|
|
39290
|
+
const yMax = this.sphereStates[SPHEREINDEX.YMAX].point[1];
|
|
39291
|
+
const zMin = this.sphereStates[SPHEREINDEX.ZMIN].point[2];
|
|
39292
|
+
const zMax = this.sphereStates[SPHEREINDEX.ZMAX].point[2];
|
|
39293
|
+
const corners = [
|
|
39294
|
+
{ key: 'XMIN_YMIN_ZMIN', pos: [xMin, yMin, zMin] },
|
|
39295
|
+
{ key: 'XMIN_YMIN_ZMAX', pos: [xMin, yMin, zMax] },
|
|
39296
|
+
{ key: 'XMIN_YMAX_ZMIN', pos: [xMin, yMax, zMin] },
|
|
39297
|
+
{ key: 'XMIN_YMAX_ZMAX', pos: [xMin, yMax, zMax] },
|
|
39298
|
+
{ key: 'XMAX_YMIN_ZMIN', pos: [xMax, yMin, zMin] },
|
|
39299
|
+
{ key: 'XMAX_YMIN_ZMAX', pos: [xMax, yMin, zMax] },
|
|
39300
|
+
{ key: 'XMAX_YMAX_ZMIN', pos: [xMax, yMax, zMin] },
|
|
39301
|
+
{ key: 'XMAX_YMAX_ZMAX', pos: [xMax, yMax, zMax] },
|
|
39302
|
+
];
|
|
39303
|
+
for (const corner of corners) {
|
|
39304
|
+
const state = this.sphereStates.find((s) => s.uid === `corner_${corner.key}`);
|
|
39305
|
+
if (state) {
|
|
39306
|
+
state.point[0] = corner.pos[0];
|
|
39307
|
+
state.point[1] = corner.pos[1];
|
|
39308
|
+
state.point[2] = corner.pos[2];
|
|
39309
|
+
state.sphereSource.setCenter(...state.point);
|
|
39310
|
+
state.sphereSource.modified();
|
|
39311
|
+
}
|
|
39312
|
+
}
|
|
39313
|
+
Object.values(this.edgeLines).forEach(({ source, key1, key2 }) => {
|
|
39314
|
+
const state1 = this.sphereStates.find((s) => s.uid === `corner_${key1}`);
|
|
39315
|
+
const state2 = this.sphereStates.find((s) => s.uid === `corner_${key2}`);
|
|
39316
|
+
if (state1 && state2) {
|
|
39317
|
+
const points = source.getPoints();
|
|
39318
|
+
points.setPoint(0, state1.point[0], state1.point[1], state1.point[2]);
|
|
39319
|
+
points.setPoint(1, state2.point[0], state2.point[1], state2.point[2]);
|
|
39320
|
+
points.modified();
|
|
39321
|
+
source.modified();
|
|
39322
|
+
}
|
|
39323
|
+
});
|
|
39324
|
+
}
|
|
39325
|
+
_unsubscribeToViewportNewVolumeSet(viewportsInfo) {
|
|
39326
|
+
viewportsInfo.forEach(({ viewportId, renderingEngineId }) => {
|
|
39327
|
+
const { viewport } = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.getEnabledElementByIds)(viewportId, renderingEngineId);
|
|
39328
|
+
const { element } = viewport;
|
|
39329
|
+
element.removeEventListener(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.Enums.Events.VOLUME_VIEWPORT_NEW_VOLUME, this._onNewVolume);
|
|
39330
|
+
});
|
|
39331
|
+
}
|
|
39332
|
+
_subscribeToViewportNewVolumeSet(viewports) {
|
|
39333
|
+
viewports.forEach(({ viewportId, renderingEngineId }) => {
|
|
39334
|
+
const { viewport } = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.getEnabledElementByIds)(viewportId, renderingEngineId);
|
|
39335
|
+
const { element } = viewport;
|
|
39336
|
+
element.addEventListener(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_10__.Enums.Events.VOLUME_VIEWPORT_NEW_VOLUME, this._onNewVolume);
|
|
39337
|
+
});
|
|
39338
|
+
}
|
|
39339
|
+
}
|
|
39340
|
+
VolumeCroppingTool.toolName = 'VolumeCropping';
|
|
39341
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (VolumeCroppingTool);
|
|
39342
|
+
|
|
39343
|
+
|
|
36815
39344
|
/***/ }),
|
|
36816
39345
|
|
|
36817
39346
|
/***/ 83052:
|
|
@@ -41085,7 +43614,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
41085
43614
|
/* harmony import */ var _aabb__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(88638);
|
|
41086
43615
|
/* harmony import */ var _basic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(73262);
|
|
41087
43616
|
/* harmony import */ var _circle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(77081);
|
|
41088
|
-
/* harmony import */ var _ellipse__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
43617
|
+
/* harmony import */ var _ellipse__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(87009);
|
|
41089
43618
|
/* harmony import */ var _line__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(93258);
|
|
41090
43619
|
/* harmony import */ var _point__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(82216);
|
|
41091
43620
|
/* harmony import */ var _polyline__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(92984);
|