@ohif/app 3.9.0-beta.97 → 3.9.0-beta.99
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/{1169.bundle.4622fde2805592aad5d0.js → 1169.bundle.787863a90ed935004d9d.js} +2 -1
- package/dist/{4842.bundle.1b232342e7e700742059.js → 1841.bundle.b644430a7b443b715aee.js} +11 -11
- package/dist/1841.css +3 -0
- package/dist/{2119.bundle.42a066761f9648557161.js → 2119.bundle.112adcabafef89bc3d13.js} +3 -3
- package/dist/2173.css +3 -0
- package/dist/{2650.bundle.feb3b241748314884ae4.js → 2650.bundle.74fd325955c61b0311ec.js} +793 -30
- package/dist/{3117.bundle.463d5fa4671a93939d36.js → 3117.bundle.d76671aced0d2669817a.js} +2 -562
- package/dist/{962.bundle.a5e0e219e6a463f2a1a3.js → 3846.bundle.559405e95050bff1bdb8.js} +111 -75
- package/dist/{3962.bundle.6c110c24e87c62a817cb.js → 3962.bundle.bbb70fcdf211b7044025.js} +2 -2
- package/dist/{4210.bundle.af8f4c27351c2d6dc75d.js → 4210.bundle.a41a375b496c7019fbd9.js} +3 -3
- package/dist/{7360.bundle.88f041783ea798a60ea5.js → 4566.bundle.ec9936198e788f67bd79.js} +1210 -776
- package/dist/{5888.bundle.b67736899c284930bfa8.js → 5888.bundle.345f92c3ccc69e0c4543.js} +4 -6
- package/dist/{6552.bundle.54ecc19f95ce5243b196.js → 6552.bundle.87f348d1180c24315677.js} +36 -24
- package/dist/{3482.bundle.aa952f86899eb5f22c74.js → 6558.bundle.b68e53ad9d4cfabea140.js} +44 -52
- package/dist/6558.css +3 -0
- package/dist/{6904.bundle.da0d83fcd48a48cfaac1.js → 6904.bundle.2daa01969c25260fb947.js} +51 -29
- package/dist/79.css +1 -1
- package/dist/{818.bundle.b6027359846cc90e32ff.js → 818.bundle.54e9bb8d6df15d139927.js} +10 -0
- package/dist/{8714.bundle.36331faa35db985a786c.js → 8714.bundle.9915effb1c16f334a69b.js} +17 -5
- package/dist/{3497.bundle.512610422a2862584c55.js → 896.bundle.0300bc2ea91c7160248d.js} +1 -560
- package/dist/{8993.bundle.23cd5f8560800a97d798.js → 8993.bundle.fc59969a3dfc25255a3a.js} +735 -26
- package/dist/{8999.bundle.0a61abf261eaa323419b.js → 8999.bundle.e936840b7caf9dae422e.js} +3 -3
- package/dist/{9579.bundle.f9c9be0c5ab6cddbde3d.js → 9579.bundle.8bb193d6ff0f63a19c72.js} +11 -2
- package/dist/{7913.bundle.bcbd3bafa43246d0fb74.js → 9788.bundle.a2f2b48921c47b54853c.js} +18 -24
- package/dist/9788.css +3 -0
- package/dist/{app.bundle.026daba867eeb7d10f23.js → app.bundle.21e229cd4d308d88ddf4.js} +5242 -3796
- package/dist/app.bundle.css +13 -13
- package/dist/cornerstoneDICOMImageLoader.min.js +1 -1
- package/dist/cornerstoneDICOMImageLoader.min.js.map +1 -1
- package/dist/index.html +1 -1
- package/dist/{polySeg.bundle.0a70e65fe89169ec7508.js → polySeg.bundle.229cf4761a5e2c225748.js} +3 -3
- package/dist/{suv-peak-worker.bundle.54d68bc1808ad3d77994.js → suv-peak-worker.bundle.48128a064ed28e623bf8.js} +1 -1
- package/dist/sw.js +1 -1
- package/package.json +20 -20
- package/dist/3482.css +0 -1
- /package/dist/{153.bundle.58a735e094a8af425d10.js → 153.bundle.3727289b597308e3295f.js} +0 -0
- /package/dist/{2791.bundle.073fde538803e404155c.js → 2791.bundle.7874c31472a55a7b35a7.js} +0 -0
- /package/dist/{4353.bundle.e88d3b2a1495618e1d12.js → 4353.bundle.e7f048a0002dc3bb19fb.js} +0 -0
- /package/dist/{4978.bundle.3b4386fcee0e64e54519.js → 4978.bundle.6474620f33562f3418f8.js} +0 -0
- /package/dist/{6591.bundle.d204abeff39c8ea88cb6.js → 6591.bundle.1c29e66a86ab07463109.js} +0 -0
- /package/dist/{7246.bundle.fda15f28260db1db90ef.js → 7246.bundle.cbc90a04abb3d771d7ba.js} +0 -0
- /package/dist/{7376.bundle.178e472339e39bb6ffa9.js → 7376.bundle.b31063489283cc2c5e16.js} +0 -0
- /package/dist/{7502.bundle.80f73ad7179ab62f3d14.js → 7502.bundle.6f9c7545a4ed24158417.js} +0 -0
- /package/dist/{79.bundle.422d9ccbaaefa6b0a039.js → 79.bundle.4f6930aeb7bab27b8b42.js} +0 -0
- /package/dist/{8944.bundle.48cc9e9e9cc8d8908233.js → 8944.bundle.0cc6d2a5df7aa2de1c81.js} +0 -0
|
@@ -11227,27 +11227,30 @@ class ScaleOverlayTool extends _base_AnnotationDisplayTool__WEBPACK_IMPORTED_MOD
|
|
|
11227
11227
|
if (annotations.length) {
|
|
11228
11228
|
annotation = annotations.filter((thisAnnotation) => thisAnnotation.data.viewportId == viewport.id)[0];
|
|
11229
11229
|
}
|
|
11230
|
-
|
|
11231
|
-
const
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
handles: {
|
|
11241
|
-
points: viewportCanvasCornersInWorld,
|
|
11230
|
+
enabledElements.forEach((element) => {
|
|
11231
|
+
const { viewport } = element;
|
|
11232
|
+
if (!viewportsWithAnnotations.includes(viewport.id)) {
|
|
11233
|
+
const newAnnotation = {
|
|
11234
|
+
metadata: {
|
|
11235
|
+
toolName: this.getToolName(),
|
|
11236
|
+
viewPlaneNormal: [...viewPlaneNormal],
|
|
11237
|
+
viewUp: [...viewUp],
|
|
11238
|
+
FrameOfReferenceUID,
|
|
11239
|
+
referencedImageId: null,
|
|
11242
11240
|
},
|
|
11243
|
-
|
|
11244
|
-
|
|
11245
|
-
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11250
|
-
|
|
11241
|
+
data: {
|
|
11242
|
+
handles: {
|
|
11243
|
+
points: _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_2__.utilities.getViewportImageCornersInWorld(viewport),
|
|
11244
|
+
},
|
|
11245
|
+
viewportId: viewport.id,
|
|
11246
|
+
},
|
|
11247
|
+
};
|
|
11248
|
+
viewportsWithAnnotations.push(viewport.id);
|
|
11249
|
+
(0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_3__.addAnnotation)(newAnnotation, viewport.element);
|
|
11250
|
+
annotation = newAnnotation;
|
|
11251
|
+
}
|
|
11252
|
+
});
|
|
11253
|
+
if (this.editData.annotation &&
|
|
11251
11254
|
this.editData.annotation.data.viewportId == viewport.id) {
|
|
11252
11255
|
this.editData.annotation.data.handles.points =
|
|
11253
11256
|
viewportCanvasCornersInWorld;
|
|
@@ -18208,6 +18211,8 @@ LivewireContourSegmentationTool.toolName = 'LivewireContourSegmentationTool';
|
|
|
18208
18211
|
/* harmony import */ var _utilities_livewire_LiveWirePath__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(27479);
|
|
18209
18212
|
/* harmony import */ var _utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(46966);
|
|
18210
18213
|
/* harmony import */ var _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(22955);
|
|
18214
|
+
/* harmony import */ var _utilities_drawing__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(20724);
|
|
18215
|
+
|
|
18211
18216
|
|
|
18212
18217
|
|
|
18213
18218
|
|
|
@@ -18229,6 +18234,8 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
18229
18234
|
constructor(toolProps = {}, defaultToolProps = {
|
|
18230
18235
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
18231
18236
|
configuration: {
|
|
18237
|
+
getTextLines: defaultGetTextLines,
|
|
18238
|
+
calculateStats: true,
|
|
18232
18239
|
preventHandleOutsideImage: false,
|
|
18233
18240
|
contourHoleAdditionModifierKey: _enums__WEBPACK_IMPORTED_MODULE_5__.KeyboardBindings.Shift,
|
|
18234
18241
|
snapHandleNearby: 2,
|
|
@@ -18279,6 +18286,7 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
18279
18286
|
this.editData = {
|
|
18280
18287
|
annotation,
|
|
18281
18288
|
viewportIdsToRender,
|
|
18289
|
+
movingTextBox: false,
|
|
18282
18290
|
};
|
|
18283
18291
|
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
|
|
18284
18292
|
const { renderingEngine } = enabledElement;
|
|
@@ -18291,13 +18299,21 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
18291
18299
|
const { element } = eventDetail;
|
|
18292
18300
|
const { data } = annotation;
|
|
18293
18301
|
annotation.highlighted = true;
|
|
18294
|
-
|
|
18295
|
-
|
|
18302
|
+
let movingTextBox = false;
|
|
18303
|
+
let handleIndex;
|
|
18304
|
+
if (handle.worldPosition) {
|
|
18305
|
+
movingTextBox = true;
|
|
18306
|
+
}
|
|
18307
|
+
else {
|
|
18308
|
+
const { points } = data.handles;
|
|
18309
|
+
handleIndex = points.findIndex((p) => p === handle);
|
|
18310
|
+
}
|
|
18296
18311
|
const viewportIdsToRender = (0,_utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_14__.getViewportIdsWithToolToRender)(element, this.getToolName());
|
|
18297
18312
|
this.editData = {
|
|
18298
18313
|
annotation,
|
|
18299
18314
|
viewportIdsToRender,
|
|
18300
18315
|
handleIndex,
|
|
18316
|
+
movingTextBox,
|
|
18301
18317
|
};
|
|
18302
18318
|
this._activateModify(element);
|
|
18303
18319
|
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
|
|
@@ -18425,15 +18441,27 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
18425
18441
|
this.isDrawing = true;
|
|
18426
18442
|
const eventDetail = evt.detail;
|
|
18427
18443
|
const { element } = eventDetail;
|
|
18428
|
-
const { annotation, viewportIdsToRender, handleIndex } = this.editData;
|
|
18429
|
-
|
|
18430
|
-
|
|
18444
|
+
const { annotation, viewportIdsToRender, handleIndex, movingTextBox } = this.editData;
|
|
18445
|
+
const { data } = annotation;
|
|
18446
|
+
if (movingTextBox) {
|
|
18447
|
+
const { deltaPoints } = eventDetail;
|
|
18448
|
+
const worldPosDelta = deltaPoints.world;
|
|
18449
|
+
const { textBox } = data.handles;
|
|
18450
|
+
const { worldPosition } = textBox;
|
|
18451
|
+
worldPosition[0] += worldPosDelta[0];
|
|
18452
|
+
worldPosition[1] += worldPosDelta[1];
|
|
18453
|
+
worldPosition[2] += worldPosDelta[2];
|
|
18454
|
+
textBox.hasMoved = true;
|
|
18455
|
+
}
|
|
18456
|
+
else if (handleIndex === undefined) {
|
|
18457
|
+
console.warn('Drag annotation not implemented');
|
|
18431
18458
|
}
|
|
18432
18459
|
else {
|
|
18433
18460
|
const { currentPoints } = eventDetail;
|
|
18434
18461
|
const worldPos = currentPoints.world;
|
|
18435
18462
|
this.editHandle(worldPos, element, annotation, handleIndex);
|
|
18436
18463
|
}
|
|
18464
|
+
this.editData.hasMoved = true;
|
|
18437
18465
|
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
|
|
18438
18466
|
const { renderingEngine } = enabledElement;
|
|
18439
18467
|
(0,_utilities__WEBPACK_IMPORTED_MODULE_8__.triggerAnnotationRenderForViewportIds)(renderingEngine, viewportIdsToRender);
|
|
@@ -18489,6 +18517,104 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
18489
18517
|
element.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_5__.Events.MOUSE_DOUBLE_CLICK, this._mouseDownCallback);
|
|
18490
18518
|
element.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_5__.Events.TOUCH_TAP, this._mouseDownCallback);
|
|
18491
18519
|
};
|
|
18520
|
+
this._calculateCachedStats = (annotation, element) => {
|
|
18521
|
+
if (!this.configuration.calculateStats) {
|
|
18522
|
+
return;
|
|
18523
|
+
}
|
|
18524
|
+
const data = annotation.data;
|
|
18525
|
+
if (!data.contour.closed) {
|
|
18526
|
+
return;
|
|
18527
|
+
}
|
|
18528
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
|
|
18529
|
+
const { viewport, renderingEngine } = enabledElement;
|
|
18530
|
+
const { cachedStats } = data;
|
|
18531
|
+
const { polyline: points } = data.contour;
|
|
18532
|
+
const targetIds = Object.keys(cachedStats);
|
|
18533
|
+
for (let i = 0; i < targetIds.length; i++) {
|
|
18534
|
+
const targetId = targetIds[i];
|
|
18535
|
+
const image = this.getTargetIdImage(targetId, renderingEngine);
|
|
18536
|
+
if (!image) {
|
|
18537
|
+
continue;
|
|
18538
|
+
}
|
|
18539
|
+
const { metadata } = image;
|
|
18540
|
+
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
18541
|
+
const canvasPoint = canvasCoordinates[0];
|
|
18542
|
+
const originalWorldPoint = viewport.canvasToWorld(canvasPoint);
|
|
18543
|
+
const deltaXPoint = viewport.canvasToWorld([
|
|
18544
|
+
canvasPoint[0] + 1,
|
|
18545
|
+
canvasPoint[1],
|
|
18546
|
+
]);
|
|
18547
|
+
const deltaYPoint = viewport.canvasToWorld([
|
|
18548
|
+
canvasPoint[0],
|
|
18549
|
+
canvasPoint[1] + 1,
|
|
18550
|
+
]);
|
|
18551
|
+
const deltaInX = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.distance */ .R3.distance(originalWorldPoint, deltaXPoint);
|
|
18552
|
+
const deltaInY = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.distance */ .R3.distance(originalWorldPoint, deltaYPoint);
|
|
18553
|
+
const { imageData } = image;
|
|
18554
|
+
const { scale, areaUnits } = (0,_utilities__WEBPACK_IMPORTED_MODULE_8__.getCalibratedLengthUnitsAndScale)(image, () => {
|
|
18555
|
+
const { maxX: canvasMaxX, maxY: canvasMaxY, minX: canvasMinX, minY: canvasMinY, } = _utilities__WEBPACK_IMPORTED_MODULE_8__.math.polyline.getAABB(canvasCoordinates);
|
|
18556
|
+
const topLeftBBWorld = viewport.canvasToWorld([
|
|
18557
|
+
canvasMinX,
|
|
18558
|
+
canvasMinY,
|
|
18559
|
+
]);
|
|
18560
|
+
const topLeftBBIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities.transformWorldToIndex(imageData, topLeftBBWorld);
|
|
18561
|
+
const bottomRightBBWorld = viewport.canvasToWorld([
|
|
18562
|
+
canvasMaxX,
|
|
18563
|
+
canvasMaxY,
|
|
18564
|
+
]);
|
|
18565
|
+
const bottomRightBBIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities.transformWorldToIndex(imageData, bottomRightBBWorld);
|
|
18566
|
+
return [topLeftBBIndex, bottomRightBBIndex];
|
|
18567
|
+
});
|
|
18568
|
+
let area = _utilities__WEBPACK_IMPORTED_MODULE_8__.math.polyline.getArea(canvasCoordinates) / scale / scale;
|
|
18569
|
+
area *= deltaInX * deltaInY;
|
|
18570
|
+
cachedStats[targetId] = {
|
|
18571
|
+
Modality: metadata.Modality,
|
|
18572
|
+
area,
|
|
18573
|
+
areaUnit: areaUnits,
|
|
18574
|
+
};
|
|
18575
|
+
}
|
|
18576
|
+
this.triggerAnnotationModified(annotation, enabledElement, _enums__WEBPACK_IMPORTED_MODULE_5__.ChangeTypes.StatsUpdated);
|
|
18577
|
+
return cachedStats;
|
|
18578
|
+
};
|
|
18579
|
+
this._renderStats = (annotation, viewport, svgDrawingHelper, textboxStyle) => {
|
|
18580
|
+
const data = annotation.data;
|
|
18581
|
+
const targetId = this.getTargetId(viewport);
|
|
18582
|
+
if (!data.contour.closed || !textboxStyle.visibility) {
|
|
18583
|
+
return;
|
|
18584
|
+
}
|
|
18585
|
+
const textLines = this.configuration.getTextLines(data, targetId);
|
|
18586
|
+
if (!textLines || textLines.length === 0) {
|
|
18587
|
+
return;
|
|
18588
|
+
}
|
|
18589
|
+
const canvasCoordinates = data.handles.points.map((p) => viewport.worldToCanvas(p));
|
|
18590
|
+
if (!data.handles.textBox.hasMoved) {
|
|
18591
|
+
const canvasTextBoxCoords = (0,_utilities_drawing__WEBPACK_IMPORTED_MODULE_16__.getTextBoxCoordsCanvas)(canvasCoordinates);
|
|
18592
|
+
data.handles.textBox.worldPosition =
|
|
18593
|
+
viewport.canvasToWorld(canvasTextBoxCoords);
|
|
18594
|
+
}
|
|
18595
|
+
const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
|
|
18596
|
+
const textBoxUID = 'textBox';
|
|
18597
|
+
const boundingBox = (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_3__.drawLinkedTextBox)(svgDrawingHelper, annotation.annotationUID ?? '', textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, textboxStyle);
|
|
18598
|
+
const { x: left, y: top, width, height } = boundingBox;
|
|
18599
|
+
data.handles.textBox.worldBoundingBox = {
|
|
18600
|
+
topLeft: viewport.canvasToWorld([left, top]),
|
|
18601
|
+
topRight: viewport.canvasToWorld([left + width, top]),
|
|
18602
|
+
bottomLeft: viewport.canvasToWorld([left, top + height]),
|
|
18603
|
+
bottomRight: viewport.canvasToWorld([left + width, top + height]),
|
|
18604
|
+
};
|
|
18605
|
+
};
|
|
18606
|
+
this.triggerAnnotationModified = (annotation, enabledElement, changeType = _enums__WEBPACK_IMPORTED_MODULE_5__.ChangeTypes.StatsUpdated) => {
|
|
18607
|
+
const { viewportId, renderingEngineId } = enabledElement;
|
|
18608
|
+
const eventType = _enums__WEBPACK_IMPORTED_MODULE_5__.Events.ANNOTATION_MODIFIED;
|
|
18609
|
+
const eventDetail = {
|
|
18610
|
+
annotation,
|
|
18611
|
+
viewportId,
|
|
18612
|
+
renderingEngineId,
|
|
18613
|
+
changeType,
|
|
18614
|
+
};
|
|
18615
|
+
(0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.triggerEvent)(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.eventTarget, eventType, eventDetail);
|
|
18616
|
+
};
|
|
18617
|
+
this._throttledCalculateCachedStats = (0,_utilities__WEBPACK_IMPORTED_MODULE_8__.throttle)(this._calculateCachedStats, 100, { trailing: true });
|
|
18492
18618
|
}
|
|
18493
18619
|
setupBaseEditData(worldPos, element, annotation, nextPos, contourHoleProcessingEnabled) {
|
|
18494
18620
|
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
|
|
@@ -18642,6 +18768,7 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
18642
18768
|
editData.currentPath = currentPath;
|
|
18643
18769
|
annotation.invalidated = true;
|
|
18644
18770
|
editData.hasMoved = true;
|
|
18771
|
+
editData.closed = true;
|
|
18645
18772
|
}
|
|
18646
18773
|
renderAnnotation(enabledElement, svgDrawingHelper) {
|
|
18647
18774
|
this.updateAnnotation(this.editData?.currentPath);
|
|
@@ -18669,8 +18796,9 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
18669
18796
|
this._endCallback(evt, true);
|
|
18670
18797
|
}
|
|
18671
18798
|
renderAnnotationInstance(renderContext) {
|
|
18672
|
-
const { annotation, enabledElement, svgDrawingHelper, annotationStyle } = renderContext;
|
|
18799
|
+
const { annotation, enabledElement, svgDrawingHelper, annotationStyle, targetId, } = renderContext;
|
|
18673
18800
|
const { viewport } = enabledElement;
|
|
18801
|
+
const { element } = viewport;
|
|
18674
18802
|
const { worldToCanvas } = viewport;
|
|
18675
18803
|
const { annotationUID, data, highlighted } = annotation;
|
|
18676
18804
|
const { handles } = data;
|
|
@@ -18688,6 +18816,19 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
18688
18816
|
});
|
|
18689
18817
|
}
|
|
18690
18818
|
super.renderAnnotationInstance(renderContext);
|
|
18819
|
+
if (!data.cachedStats[targetId] ||
|
|
18820
|
+
data.cachedStats[targetId].areaUnit == null) {
|
|
18821
|
+
data.cachedStats[targetId] = {
|
|
18822
|
+
Modality: null,
|
|
18823
|
+
area: null,
|
|
18824
|
+
areaUnit: null,
|
|
18825
|
+
};
|
|
18826
|
+
this._calculateCachedStats(annotation, element);
|
|
18827
|
+
}
|
|
18828
|
+
else if (annotation.invalidated) {
|
|
18829
|
+
this._throttledCalculateCachedStats(annotation, element);
|
|
18830
|
+
}
|
|
18831
|
+
this._renderStats(annotation, viewport, svgDrawingHelper, annotationStyle.textbox);
|
|
18691
18832
|
return true;
|
|
18692
18833
|
}
|
|
18693
18834
|
updateAnnotation(livewirePath) {
|
|
@@ -18712,6 +18853,16 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
18712
18853
|
}
|
|
18713
18854
|
LivewireContourTool.toolName = 'LivewireContour';
|
|
18714
18855
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LivewireContourTool);
|
|
18856
|
+
function defaultGetTextLines(data, targetId) {
|
|
18857
|
+
const cachedVolumeStats = data.cachedStats[targetId];
|
|
18858
|
+
const { area, areaUnit } = cachedVolumeStats;
|
|
18859
|
+
const textLines = [];
|
|
18860
|
+
if (area) {
|
|
18861
|
+
const areaLine = `Area: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_8__.roundNumber)(area)} ${areaUnit}`;
|
|
18862
|
+
textLines.push(areaLine);
|
|
18863
|
+
}
|
|
18864
|
+
return textLines;
|
|
18865
|
+
}
|
|
18715
18866
|
|
|
18716
18867
|
|
|
18717
18868
|
/***/ }),
|
|
@@ -18757,6 +18908,564 @@ PlanarFreehandContourSegmentationTool.toolName =
|
|
|
18757
18908
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PlanarFreehandContourSegmentationTool);
|
|
18758
18909
|
|
|
18759
18910
|
|
|
18911
|
+
/***/ }),
|
|
18912
|
+
|
|
18913
|
+
/***/ 22455:
|
|
18914
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
18915
|
+
|
|
18916
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
18917
|
+
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
18918
|
+
/* harmony export */ });
|
|
18919
|
+
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12651);
|
|
18920
|
+
/* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(72076);
|
|
18921
|
+
/* harmony import */ var _utilities_getCalibratedUnits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(39661);
|
|
18922
|
+
/* harmony import */ var _utilities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(42975);
|
|
18923
|
+
/* harmony import */ var _utilities_math__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(79390);
|
|
18924
|
+
/* harmony import */ var _utilities_planar__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(44037);
|
|
18925
|
+
/* harmony import */ var _utilities_throttle__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(90685);
|
|
18926
|
+
/* harmony import */ var _utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(46966);
|
|
18927
|
+
/* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(66878);
|
|
18928
|
+
/* harmony import */ var _planarFreehandROITool_drawLoop__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(75698);
|
|
18929
|
+
/* harmony import */ var _planarFreehandROITool_editLoopCommon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(89026);
|
|
18930
|
+
/* harmony import */ var _planarFreehandROITool_closedContourEditLoop__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(58391);
|
|
18931
|
+
/* harmony import */ var _planarFreehandROITool_openContourEditLoop__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(21879);
|
|
18932
|
+
/* harmony import */ var _planarFreehandROITool_openContourEndEditLoop__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(82571);
|
|
18933
|
+
/* harmony import */ var _planarFreehandROITool_renderMethods__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(54435);
|
|
18934
|
+
/* harmony import */ var _stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(36705);
|
|
18935
|
+
/* harmony import */ var _drawingSvg__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(25876);
|
|
18936
|
+
/* harmony import */ var _utilities_drawing__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(20724);
|
|
18937
|
+
/* harmony import */ var _utilities_math_polyline__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(42744);
|
|
18938
|
+
/* harmony import */ var _utilities_pointInShapeCallback__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(31955);
|
|
18939
|
+
/* harmony import */ var _utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(20752);
|
|
18940
|
+
/* harmony import */ var _utilities_getModalityUnit__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(15607);
|
|
18941
|
+
/* harmony import */ var _utilities_math_basic__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(51053);
|
|
18942
|
+
/* harmony import */ var _utilities_contours_calculatePerimeter__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(3042);
|
|
18943
|
+
/* harmony import */ var _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(22955);
|
|
18944
|
+
/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(68096);
|
|
18945
|
+
|
|
18946
|
+
|
|
18947
|
+
|
|
18948
|
+
|
|
18949
|
+
|
|
18950
|
+
|
|
18951
|
+
|
|
18952
|
+
|
|
18953
|
+
|
|
18954
|
+
|
|
18955
|
+
|
|
18956
|
+
|
|
18957
|
+
|
|
18958
|
+
|
|
18959
|
+
|
|
18960
|
+
|
|
18961
|
+
|
|
18962
|
+
|
|
18963
|
+
|
|
18964
|
+
|
|
18965
|
+
|
|
18966
|
+
|
|
18967
|
+
|
|
18968
|
+
|
|
18969
|
+
|
|
18970
|
+
|
|
18971
|
+
const { pointCanProjectOnLine } = _utilities_math__WEBPACK_IMPORTED_MODULE_4__.polyline;
|
|
18972
|
+
const { EPSILON } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.CONSTANTS;
|
|
18973
|
+
const PARALLEL_THRESHOLD = 1 - EPSILON;
|
|
18974
|
+
class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_MODULE_24__/* ["default"] */ .Z {
|
|
18975
|
+
constructor(toolProps = {}, defaultToolProps = {
|
|
18976
|
+
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
18977
|
+
configuration: {
|
|
18978
|
+
shadow: true,
|
|
18979
|
+
preventHandleOutsideImage: false,
|
|
18980
|
+
contourHoleAdditionModifierKey: _enums__WEBPACK_IMPORTED_MODULE_25__.KeyboardBindings.Shift,
|
|
18981
|
+
alwaysRenderOpenContourHandles: {
|
|
18982
|
+
enabled: false,
|
|
18983
|
+
radius: 2,
|
|
18984
|
+
},
|
|
18985
|
+
allowOpenContours: true,
|
|
18986
|
+
closeContourProximity: 10,
|
|
18987
|
+
checkCanvasEditFallbackProximity: 6,
|
|
18988
|
+
makeClockWise: true,
|
|
18989
|
+
subPixelResolution: 4,
|
|
18990
|
+
smoothing: {
|
|
18991
|
+
smoothOnAdd: false,
|
|
18992
|
+
smoothOnEdit: false,
|
|
18993
|
+
knotsRatioPercentageOnAdd: 40,
|
|
18994
|
+
knotsRatioPercentageOnEdit: 40,
|
|
18995
|
+
},
|
|
18996
|
+
interpolation: {
|
|
18997
|
+
enabled: false,
|
|
18998
|
+
onInterpolationComplete: null,
|
|
18999
|
+
},
|
|
19000
|
+
decimate: {
|
|
19001
|
+
enabled: false,
|
|
19002
|
+
epsilon: 0.1,
|
|
19003
|
+
},
|
|
19004
|
+
displayOnePointAsCrosshairs: false,
|
|
19005
|
+
calculateStats: true,
|
|
19006
|
+
getTextLines: defaultGetTextLines,
|
|
19007
|
+
statsCalculator: _utilities_math_basic__WEBPACK_IMPORTED_MODULE_22__.BasicStatsCalculator,
|
|
19008
|
+
},
|
|
19009
|
+
}) {
|
|
19010
|
+
super(toolProps, defaultToolProps);
|
|
19011
|
+
this.isDrawing = false;
|
|
19012
|
+
this.isEditingClosed = false;
|
|
19013
|
+
this.isEditingOpen = false;
|
|
19014
|
+
this.addNewAnnotation = (evt) => {
|
|
19015
|
+
const eventDetail = evt.detail;
|
|
19016
|
+
const { element } = eventDetail;
|
|
19017
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
|
|
19018
|
+
const { renderingEngine } = enabledElement;
|
|
19019
|
+
const annotation = this.createAnnotation(evt);
|
|
19020
|
+
this.addAnnotation(annotation, element);
|
|
19021
|
+
const viewportIdsToRender = (0,_utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_7__.getViewportIdsWithToolToRender)(element, this.getToolName());
|
|
19022
|
+
this.activateDraw(evt, annotation, viewportIdsToRender);
|
|
19023
|
+
evt.preventDefault();
|
|
19024
|
+
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(renderingEngine, viewportIdsToRender);
|
|
19025
|
+
return annotation;
|
|
19026
|
+
};
|
|
19027
|
+
this.handleSelectedCallback = (evt, annotation, handle) => {
|
|
19028
|
+
const eventDetail = evt.detail;
|
|
19029
|
+
const { element } = eventDetail;
|
|
19030
|
+
const viewportIdsToRender = (0,_utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_7__.getViewportIdsWithToolToRender)(element, this.getToolName());
|
|
19031
|
+
this.activateOpenContourEndEdit(evt, annotation, viewportIdsToRender, handle);
|
|
19032
|
+
};
|
|
19033
|
+
this.toolSelectedCallback = (evt, annotation) => {
|
|
19034
|
+
const eventDetail = evt.detail;
|
|
19035
|
+
const { element } = eventDetail;
|
|
19036
|
+
const viewportIdsToRender = (0,_utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_7__.getViewportIdsWithToolToRender)(element, this.getToolName());
|
|
19037
|
+
if (annotation.data.contour.closed) {
|
|
19038
|
+
this.activateClosedContourEdit(evt, annotation, viewportIdsToRender);
|
|
19039
|
+
}
|
|
19040
|
+
else {
|
|
19041
|
+
this.activateOpenContourEdit(evt, annotation, viewportIdsToRender);
|
|
19042
|
+
}
|
|
19043
|
+
evt.preventDefault();
|
|
19044
|
+
};
|
|
19045
|
+
this.isPointNearTool = (element, annotation, canvasCoords, proximity) => {
|
|
19046
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
|
|
19047
|
+
const { viewport } = enabledElement;
|
|
19048
|
+
const { polyline: points } = annotation.data.contour;
|
|
19049
|
+
let previousPoint = viewport.worldToCanvas(points[0]);
|
|
19050
|
+
for (let i = 1; i < points.length; i++) {
|
|
19051
|
+
const p1 = previousPoint;
|
|
19052
|
+
const p2 = viewport.worldToCanvas(points[i]);
|
|
19053
|
+
const canProject = pointCanProjectOnLine(canvasCoords, p1, p2, proximity);
|
|
19054
|
+
if (canProject) {
|
|
19055
|
+
return true;
|
|
19056
|
+
}
|
|
19057
|
+
previousPoint = p2;
|
|
19058
|
+
}
|
|
19059
|
+
if (!annotation.data.contour.closed) {
|
|
19060
|
+
return false;
|
|
19061
|
+
}
|
|
19062
|
+
const pStart = viewport.worldToCanvas(points[0]);
|
|
19063
|
+
const pEnd = viewport.worldToCanvas(points[points.length - 1]);
|
|
19064
|
+
return pointCanProjectOnLine(canvasCoords, pStart, pEnd, proximity);
|
|
19065
|
+
};
|
|
19066
|
+
this.cancel = (element) => {
|
|
19067
|
+
const isDrawing = this.isDrawing;
|
|
19068
|
+
const isEditingOpen = this.isEditingOpen;
|
|
19069
|
+
const isEditingClosed = this.isEditingClosed;
|
|
19070
|
+
if (isDrawing) {
|
|
19071
|
+
this.cancelDrawing(element);
|
|
19072
|
+
}
|
|
19073
|
+
else if (isEditingOpen) {
|
|
19074
|
+
this.cancelOpenContourEdit(element);
|
|
19075
|
+
}
|
|
19076
|
+
else if (isEditingClosed) {
|
|
19077
|
+
this.cancelClosedContourEdit(element);
|
|
19078
|
+
}
|
|
19079
|
+
};
|
|
19080
|
+
this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement) => {
|
|
19081
|
+
const { data } = annotation;
|
|
19082
|
+
const { cachedStats } = data;
|
|
19083
|
+
const { polyline: points, closed } = data.contour;
|
|
19084
|
+
const targetIds = Object.keys(cachedStats);
|
|
19085
|
+
for (let i = 0; i < targetIds.length; i++) {
|
|
19086
|
+
const targetId = targetIds[i];
|
|
19087
|
+
const image = this.getTargetIdImage(targetId, renderingEngine);
|
|
19088
|
+
if (!image) {
|
|
19089
|
+
continue;
|
|
19090
|
+
}
|
|
19091
|
+
const { imageData, metadata } = image;
|
|
19092
|
+
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
19093
|
+
const modalityUnitOptions = {
|
|
19094
|
+
isPreScaled: (0,_utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_20__/* .isViewportPreScaled */ .P)(viewport, targetId),
|
|
19095
|
+
isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
|
|
19096
|
+
};
|
|
19097
|
+
const modalityUnit = (0,_utilities_getModalityUnit__WEBPACK_IMPORTED_MODULE_21__/* .getModalityUnit */ .F)(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
|
|
19098
|
+
const calibratedScale = (0,_utilities_getCalibratedUnits__WEBPACK_IMPORTED_MODULE_2__/* .getCalibratedLengthUnitsAndScale */ .mh)(image, () => {
|
|
19099
|
+
const polyline = data.contour.polyline;
|
|
19100
|
+
const numPoints = polyline.length;
|
|
19101
|
+
const projectedPolyline = new Array(numPoints);
|
|
19102
|
+
for (let i = 0; i < numPoints; i++) {
|
|
19103
|
+
projectedPolyline[i] = viewport.worldToCanvas(polyline[i]);
|
|
19104
|
+
}
|
|
19105
|
+
const { maxX: canvasMaxX, maxY: canvasMaxY, minX: canvasMinX, minY: canvasMinY, } = _utilities__WEBPACK_IMPORTED_MODULE_3__.math.polyline.getAABB(projectedPolyline);
|
|
19106
|
+
const topLeftBBWorld = viewport.canvasToWorld([canvasMinX, canvasMinY]);
|
|
19107
|
+
const topLeftBBIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.transformWorldToIndex(imageData, topLeftBBWorld);
|
|
19108
|
+
const bottomRightBBWorld = viewport.canvasToWorld([
|
|
19109
|
+
canvasMaxX,
|
|
19110
|
+
canvasMaxY,
|
|
19111
|
+
]);
|
|
19112
|
+
const bottomRightBBIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.transformWorldToIndex(imageData, bottomRightBBWorld);
|
|
19113
|
+
return [topLeftBBIndex, bottomRightBBIndex];
|
|
19114
|
+
});
|
|
19115
|
+
if (closed) {
|
|
19116
|
+
this.updateClosedCachedStats({
|
|
19117
|
+
targetId,
|
|
19118
|
+
viewport,
|
|
19119
|
+
canvasCoordinates,
|
|
19120
|
+
points,
|
|
19121
|
+
imageData,
|
|
19122
|
+
metadata,
|
|
19123
|
+
cachedStats,
|
|
19124
|
+
modalityUnit,
|
|
19125
|
+
calibratedScale,
|
|
19126
|
+
});
|
|
19127
|
+
}
|
|
19128
|
+
else {
|
|
19129
|
+
this.updateOpenCachedStats({
|
|
19130
|
+
metadata,
|
|
19131
|
+
canvasCoordinates,
|
|
19132
|
+
targetId,
|
|
19133
|
+
cachedStats,
|
|
19134
|
+
modalityUnit,
|
|
19135
|
+
calibratedScale,
|
|
19136
|
+
});
|
|
19137
|
+
}
|
|
19138
|
+
}
|
|
19139
|
+
(0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_15__/* .triggerAnnotationModified */ .hg)(annotation, enabledElement.viewport.element, _enums__WEBPACK_IMPORTED_MODULE_25__.ChangeTypes.StatsUpdated);
|
|
19140
|
+
annotation.invalidated = false;
|
|
19141
|
+
return cachedStats;
|
|
19142
|
+
};
|
|
19143
|
+
this._renderStats = (annotation, viewport, enabledElement, svgDrawingHelper) => {
|
|
19144
|
+
const { data } = annotation;
|
|
19145
|
+
const targetId = this.getTargetId(viewport);
|
|
19146
|
+
const styleSpecifier = {
|
|
19147
|
+
toolGroupId: this.toolGroupId,
|
|
19148
|
+
toolName: this.getToolName(),
|
|
19149
|
+
viewportId: enabledElement.viewport.id,
|
|
19150
|
+
};
|
|
19151
|
+
const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
|
|
19152
|
+
if (!options.visibility) {
|
|
19153
|
+
return;
|
|
19154
|
+
}
|
|
19155
|
+
const textLines = this.configuration.getTextLines(data, targetId);
|
|
19156
|
+
if (!textLines || textLines.length === 0) {
|
|
19157
|
+
return;
|
|
19158
|
+
}
|
|
19159
|
+
const canvasCoordinates = data.contour.polyline.map((p) => viewport.worldToCanvas(p));
|
|
19160
|
+
if (!data.handles.textBox.hasMoved) {
|
|
19161
|
+
const canvasTextBoxCoords = (0,_utilities_drawing__WEBPACK_IMPORTED_MODULE_17__.getTextBoxCoordsCanvas)(canvasCoordinates);
|
|
19162
|
+
data.handles.textBox.worldPosition =
|
|
19163
|
+
viewport.canvasToWorld(canvasTextBoxCoords);
|
|
19164
|
+
}
|
|
19165
|
+
const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
|
|
19166
|
+
const textBoxUID = '1';
|
|
19167
|
+
const boundingBox = (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_16__.drawLinkedTextBox)(svgDrawingHelper, annotation.annotationUID ?? '', textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
|
|
19168
|
+
const { x: left, y: top, width, height } = boundingBox;
|
|
19169
|
+
data.handles.textBox.worldBoundingBox = {
|
|
19170
|
+
topLeft: viewport.canvasToWorld([left, top]),
|
|
19171
|
+
topRight: viewport.canvasToWorld([left + width, top]),
|
|
19172
|
+
bottomLeft: viewport.canvasToWorld([left, top + height]),
|
|
19173
|
+
bottomRight: viewport.canvasToWorld([left + width, top + height]),
|
|
19174
|
+
};
|
|
19175
|
+
};
|
|
19176
|
+
(0,_planarFreehandROITool_drawLoop__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z)(this);
|
|
19177
|
+
(0,_planarFreehandROITool_editLoopCommon__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z)(this);
|
|
19178
|
+
(0,_planarFreehandROITool_closedContourEditLoop__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z)(this);
|
|
19179
|
+
(0,_planarFreehandROITool_openContourEditLoop__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z)(this);
|
|
19180
|
+
(0,_planarFreehandROITool_openContourEndEditLoop__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z)(this);
|
|
19181
|
+
(0,_planarFreehandROITool_renderMethods__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z)(this);
|
|
19182
|
+
this._throttledCalculateCachedStats = (0,_utilities_throttle__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z)(this._calculateCachedStats, 100, { trailing: true });
|
|
19183
|
+
}
|
|
19184
|
+
filterInteractableAnnotationsForElement(element, annotations) {
|
|
19185
|
+
if (!annotations || !annotations.length) {
|
|
19186
|
+
return;
|
|
19187
|
+
}
|
|
19188
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
|
|
19189
|
+
const { viewport } = enabledElement;
|
|
19190
|
+
let annotationsToDisplay;
|
|
19191
|
+
if (viewport instanceof _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.VolumeViewport) {
|
|
19192
|
+
const camera = viewport.getCamera();
|
|
19193
|
+
const { spacingInNormalDirection } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.getTargetVolumeAndSpacingInNormalDir(viewport, camera);
|
|
19194
|
+
annotationsToDisplay = this.filterAnnotationsWithinSlice(annotations, camera, spacingInNormalDirection);
|
|
19195
|
+
}
|
|
19196
|
+
else {
|
|
19197
|
+
annotationsToDisplay = (0,_utilities_planar__WEBPACK_IMPORTED_MODULE_5__.filterAnnotationsForDisplay)(viewport, annotations);
|
|
19198
|
+
}
|
|
19199
|
+
return annotationsToDisplay;
|
|
19200
|
+
}
|
|
19201
|
+
filterAnnotationsWithinSlice(annotations, camera, spacingInNormalDirection) {
|
|
19202
|
+
const { viewPlaneNormal } = camera;
|
|
19203
|
+
const annotationsWithParallelNormals = annotations.filter((td) => {
|
|
19204
|
+
const annotationViewPlaneNormal = td.metadata.viewPlaneNormal;
|
|
19205
|
+
const isParallel = Math.abs(gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.dot */ .R3.dot(viewPlaneNormal, annotationViewPlaneNormal)) >
|
|
19206
|
+
PARALLEL_THRESHOLD;
|
|
19207
|
+
return annotationViewPlaneNormal && isParallel;
|
|
19208
|
+
});
|
|
19209
|
+
if (!annotationsWithParallelNormals.length) {
|
|
19210
|
+
return [];
|
|
19211
|
+
}
|
|
19212
|
+
const halfSpacingInNormalDirection = spacingInNormalDirection / 2;
|
|
19213
|
+
const { focalPoint } = camera;
|
|
19214
|
+
const annotationsWithinSlice = [];
|
|
19215
|
+
for (const annotation of annotationsWithParallelNormals) {
|
|
19216
|
+
const data = annotation.data;
|
|
19217
|
+
const point = data.contour.polyline[0];
|
|
19218
|
+
if (!annotation.isVisible) {
|
|
19219
|
+
continue;
|
|
19220
|
+
}
|
|
19221
|
+
const dir = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.create */ .R3.create();
|
|
19222
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.sub */ .R3.sub(dir, focalPoint, point);
|
|
19223
|
+
const dot = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.dot */ .R3.dot(dir, viewPlaneNormal);
|
|
19224
|
+
if (Math.abs(dot) < halfSpacingInNormalDirection) {
|
|
19225
|
+
annotationsWithinSlice.push(annotation);
|
|
19226
|
+
}
|
|
19227
|
+
}
|
|
19228
|
+
return annotationsWithinSlice;
|
|
19229
|
+
}
|
|
19230
|
+
isContourSegmentationTool() {
|
|
19231
|
+
return false;
|
|
19232
|
+
}
|
|
19233
|
+
createAnnotation(evt) {
|
|
19234
|
+
const worldPos = evt.detail.currentPoints.world;
|
|
19235
|
+
const contourAnnotation = super.createAnnotation(evt);
|
|
19236
|
+
const onInterpolationComplete = (annotation) => {
|
|
19237
|
+
annotation.data.handles.points.length = 0;
|
|
19238
|
+
};
|
|
19239
|
+
const annotation = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.deepMerge(contourAnnotation, {
|
|
19240
|
+
data: {
|
|
19241
|
+
contour: {
|
|
19242
|
+
polyline: [[...worldPos]],
|
|
19243
|
+
},
|
|
19244
|
+
label: '',
|
|
19245
|
+
cachedStats: {},
|
|
19246
|
+
},
|
|
19247
|
+
onInterpolationComplete,
|
|
19248
|
+
});
|
|
19249
|
+
return annotation;
|
|
19250
|
+
}
|
|
19251
|
+
getAnnotationStyle(context) {
|
|
19252
|
+
return super.getAnnotationStyle(context);
|
|
19253
|
+
}
|
|
19254
|
+
renderAnnotationInstance(renderContext) {
|
|
19255
|
+
const { enabledElement, targetId, svgDrawingHelper } = renderContext;
|
|
19256
|
+
const annotation = renderContext.annotation;
|
|
19257
|
+
let renderStatus = false;
|
|
19258
|
+
const { viewport, renderingEngine } = enabledElement;
|
|
19259
|
+
const isDrawing = this.isDrawing;
|
|
19260
|
+
const isEditingOpen = this.isEditingOpen;
|
|
19261
|
+
const isEditingClosed = this.isEditingClosed;
|
|
19262
|
+
if (!(isDrawing || isEditingOpen || isEditingClosed)) {
|
|
19263
|
+
if (this.configuration.displayOnePointAsCrosshairs &&
|
|
19264
|
+
annotation.data.contour.polyline.length === 1) {
|
|
19265
|
+
this.renderPointContourWithMarker(enabledElement, svgDrawingHelper, annotation);
|
|
19266
|
+
}
|
|
19267
|
+
else {
|
|
19268
|
+
this.renderContour(enabledElement, svgDrawingHelper, annotation);
|
|
19269
|
+
}
|
|
19270
|
+
}
|
|
19271
|
+
else {
|
|
19272
|
+
const activeAnnotationUID = this.commonData.annotation.annotationUID;
|
|
19273
|
+
if (annotation.annotationUID === activeAnnotationUID) {
|
|
19274
|
+
if (isDrawing) {
|
|
19275
|
+
this.renderContourBeingDrawn(enabledElement, svgDrawingHelper, annotation);
|
|
19276
|
+
}
|
|
19277
|
+
else if (isEditingClosed) {
|
|
19278
|
+
this.renderClosedContourBeingEdited(enabledElement, svgDrawingHelper, annotation);
|
|
19279
|
+
}
|
|
19280
|
+
else if (isEditingOpen) {
|
|
19281
|
+
this.renderOpenContourBeingEdited(enabledElement, svgDrawingHelper, annotation);
|
|
19282
|
+
}
|
|
19283
|
+
else {
|
|
19284
|
+
throw new Error(`Unknown ${this.getToolName()} annotation rendering state`);
|
|
19285
|
+
}
|
|
19286
|
+
}
|
|
19287
|
+
else {
|
|
19288
|
+
if (this.configuration.displayOnePointAsCrosshairs &&
|
|
19289
|
+
annotation.data.contour.polyline.length === 1) {
|
|
19290
|
+
this.renderPointContourWithMarker(enabledElement, svgDrawingHelper, annotation);
|
|
19291
|
+
}
|
|
19292
|
+
else {
|
|
19293
|
+
this.renderContour(enabledElement, svgDrawingHelper, annotation);
|
|
19294
|
+
}
|
|
19295
|
+
}
|
|
19296
|
+
renderStatus = true;
|
|
19297
|
+
}
|
|
19298
|
+
if (!this.configuration.calculateStats) {
|
|
19299
|
+
return;
|
|
19300
|
+
}
|
|
19301
|
+
this._calculateStatsIfActive(annotation, targetId, viewport, renderingEngine, enabledElement);
|
|
19302
|
+
this._renderStats(annotation, viewport, enabledElement, svgDrawingHelper);
|
|
19303
|
+
return renderStatus;
|
|
19304
|
+
}
|
|
19305
|
+
_calculateStatsIfActive(annotation, targetId, viewport, renderingEngine, enabledElement) {
|
|
19306
|
+
const activeAnnotationUID = this.commonData?.annotation.annotationUID;
|
|
19307
|
+
if (annotation.annotationUID === activeAnnotationUID &&
|
|
19308
|
+
!this.commonData?.movingTextBox) {
|
|
19309
|
+
return;
|
|
19310
|
+
}
|
|
19311
|
+
if (!this.commonData?.movingTextBox) {
|
|
19312
|
+
const { data } = annotation;
|
|
19313
|
+
if (!data.cachedStats[targetId] ||
|
|
19314
|
+
data.cachedStats[targetId].areaUnit == null) {
|
|
19315
|
+
data.cachedStats[targetId] = {
|
|
19316
|
+
Modality: null,
|
|
19317
|
+
area: null,
|
|
19318
|
+
max: null,
|
|
19319
|
+
mean: null,
|
|
19320
|
+
stdDev: null,
|
|
19321
|
+
areaUnit: null,
|
|
19322
|
+
};
|
|
19323
|
+
this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
|
|
19324
|
+
}
|
|
19325
|
+
else if (annotation.invalidated) {
|
|
19326
|
+
this._throttledCalculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
|
|
19327
|
+
}
|
|
19328
|
+
}
|
|
19329
|
+
}
|
|
19330
|
+
updateClosedCachedStats({ viewport, points, imageData, metadata, cachedStats, targetId, modalityUnit, canvasCoordinates, calibratedScale, }) {
|
|
19331
|
+
const { scale, areaUnits, units } = calibratedScale;
|
|
19332
|
+
const canvasPoint = canvasCoordinates[0];
|
|
19333
|
+
const originalWorldPoint = viewport.canvasToWorld(canvasPoint);
|
|
19334
|
+
const deltaXPoint = viewport.canvasToWorld([
|
|
19335
|
+
canvasPoint[0] + 1,
|
|
19336
|
+
canvasPoint[1],
|
|
19337
|
+
]);
|
|
19338
|
+
const deltaYPoint = viewport.canvasToWorld([
|
|
19339
|
+
canvasPoint[0],
|
|
19340
|
+
canvasPoint[1] + 1,
|
|
19341
|
+
]);
|
|
19342
|
+
const deltaInX = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.distance */ .R3.distance(originalWorldPoint, deltaXPoint);
|
|
19343
|
+
const deltaInY = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.distance */ .R3.distance(originalWorldPoint, deltaYPoint);
|
|
19344
|
+
const worldPosIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.transformWorldToIndex(imageData, points[0]);
|
|
19345
|
+
worldPosIndex[0] = Math.floor(worldPosIndex[0]);
|
|
19346
|
+
worldPosIndex[1] = Math.floor(worldPosIndex[1]);
|
|
19347
|
+
worldPosIndex[2] = Math.floor(worldPosIndex[2]);
|
|
19348
|
+
let iMin = worldPosIndex[0];
|
|
19349
|
+
let iMax = worldPosIndex[0];
|
|
19350
|
+
let jMin = worldPosIndex[1];
|
|
19351
|
+
let jMax = worldPosIndex[1];
|
|
19352
|
+
let kMin = worldPosIndex[2];
|
|
19353
|
+
let kMax = worldPosIndex[2];
|
|
19354
|
+
for (let j = 1; j < points.length; j++) {
|
|
19355
|
+
const worldPosIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.transformWorldToIndex(imageData, points[j]);
|
|
19356
|
+
worldPosIndex[0] = Math.floor(worldPosIndex[0]);
|
|
19357
|
+
worldPosIndex[1] = Math.floor(worldPosIndex[1]);
|
|
19358
|
+
worldPosIndex[2] = Math.floor(worldPosIndex[2]);
|
|
19359
|
+
iMin = Math.min(iMin, worldPosIndex[0]);
|
|
19360
|
+
iMax = Math.max(iMax, worldPosIndex[0]);
|
|
19361
|
+
jMin = Math.min(jMin, worldPosIndex[1]);
|
|
19362
|
+
jMax = Math.max(jMax, worldPosIndex[1]);
|
|
19363
|
+
kMin = Math.min(kMin, worldPosIndex[2]);
|
|
19364
|
+
kMax = Math.max(kMax, worldPosIndex[2]);
|
|
19365
|
+
}
|
|
19366
|
+
const worldPosIndex2 = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.transformWorldToIndex(imageData, points[1]);
|
|
19367
|
+
worldPosIndex2[0] = Math.floor(worldPosIndex2[0]);
|
|
19368
|
+
worldPosIndex2[1] = Math.floor(worldPosIndex2[1]);
|
|
19369
|
+
worldPosIndex2[2] = Math.floor(worldPosIndex2[2]);
|
|
19370
|
+
let area = _utilities_math__WEBPACK_IMPORTED_MODULE_4__.polyline.getArea(canvasCoordinates) / scale / scale;
|
|
19371
|
+
area *= deltaInX * deltaInY;
|
|
19372
|
+
const iDelta = 0.01 * (iMax - iMin);
|
|
19373
|
+
const jDelta = 0.01 * (jMax - jMin);
|
|
19374
|
+
const kDelta = 0.01 * (kMax - kMin);
|
|
19375
|
+
iMin = Math.floor(iMin - iDelta);
|
|
19376
|
+
iMax = Math.ceil(iMax + iDelta);
|
|
19377
|
+
jMin = Math.floor(jMin - jDelta);
|
|
19378
|
+
jMax = Math.ceil(jMax + jDelta);
|
|
19379
|
+
kMin = Math.floor(kMin - kDelta);
|
|
19380
|
+
kMax = Math.ceil(kMax + kDelta);
|
|
19381
|
+
const boundsIJK = [
|
|
19382
|
+
[iMin, iMax],
|
|
19383
|
+
[jMin, jMax],
|
|
19384
|
+
[kMin, kMax],
|
|
19385
|
+
];
|
|
19386
|
+
const worldPosEnd = imageData.indexToWorld([iMax, jMax, kMax]);
|
|
19387
|
+
const canvasPosEnd = viewport.worldToCanvas(worldPosEnd);
|
|
19388
|
+
let curRow = 0;
|
|
19389
|
+
let intersections = [];
|
|
19390
|
+
let intersectionCounter = 0;
|
|
19391
|
+
const pointsInShape = (0,_utilities_pointInShapeCallback__WEBPACK_IMPORTED_MODULE_19__/* ["default"] */ .Z)(imageData, (pointLPS, _pointIJK) => {
|
|
19392
|
+
let result = true;
|
|
19393
|
+
const point = viewport.worldToCanvas(pointLPS);
|
|
19394
|
+
if (point[1] != curRow) {
|
|
19395
|
+
intersectionCounter = 0;
|
|
19396
|
+
curRow = point[1];
|
|
19397
|
+
intersections = (0,_utilities_math_polyline__WEBPACK_IMPORTED_MODULE_18__.getLineSegmentIntersectionsCoordinates)(canvasCoordinates, point, [canvasPosEnd[0], point[1]]);
|
|
19398
|
+
intersections.sort((function (index) {
|
|
19399
|
+
return function (a, b) {
|
|
19400
|
+
return a[index] === b[index] ? 0 : a[index] < b[index] ? -1 : 1;
|
|
19401
|
+
};
|
|
19402
|
+
})(0));
|
|
19403
|
+
}
|
|
19404
|
+
if (intersections.length && point[0] > intersections[0][0]) {
|
|
19405
|
+
intersections.shift();
|
|
19406
|
+
intersectionCounter++;
|
|
19407
|
+
}
|
|
19408
|
+
if (intersectionCounter % 2 === 0) {
|
|
19409
|
+
result = false;
|
|
19410
|
+
}
|
|
19411
|
+
return result;
|
|
19412
|
+
}, this.configuration.statsCalculator.statsCallback, boundsIJK);
|
|
19413
|
+
const stats = this.configuration.statsCalculator.getStatistics();
|
|
19414
|
+
cachedStats[targetId] = {
|
|
19415
|
+
Modality: metadata.Modality,
|
|
19416
|
+
area,
|
|
19417
|
+
perimeter: (0,_utilities_contours_calculatePerimeter__WEBPACK_IMPORTED_MODULE_23__/* ["default"] */ .Z)(canvasCoordinates, closed) / scale,
|
|
19418
|
+
mean: stats.mean?.value,
|
|
19419
|
+
max: stats.max?.value,
|
|
19420
|
+
stdDev: stats.stdDev?.value,
|
|
19421
|
+
statsArray: stats.array,
|
|
19422
|
+
pointsInShape: pointsInShape,
|
|
19423
|
+
areaUnit: areaUnits,
|
|
19424
|
+
modalityUnit,
|
|
19425
|
+
unit: units,
|
|
19426
|
+
};
|
|
19427
|
+
}
|
|
19428
|
+
updateOpenCachedStats({ targetId, metadata, canvasCoordinates, cachedStats, modalityUnit, calibratedScale, }) {
|
|
19429
|
+
const { scale, units } = calibratedScale;
|
|
19430
|
+
cachedStats[targetId] = {
|
|
19431
|
+
Modality: metadata.Modality,
|
|
19432
|
+
length: (0,_utilities_contours_calculatePerimeter__WEBPACK_IMPORTED_MODULE_23__/* ["default"] */ .Z)(canvasCoordinates, false) / scale,
|
|
19433
|
+
modalityUnit,
|
|
19434
|
+
unit: units,
|
|
19435
|
+
};
|
|
19436
|
+
}
|
|
19437
|
+
}
|
|
19438
|
+
function defaultGetTextLines(data, targetId) {
|
|
19439
|
+
const cachedVolumeStats = data.cachedStats[targetId];
|
|
19440
|
+
const { area, mean, stdDev, length, perimeter, max, isEmptyArea, areaUnit, modalityUnit, unit, } = cachedVolumeStats || {};
|
|
19441
|
+
const textLines = [];
|
|
19442
|
+
if (area) {
|
|
19443
|
+
const areaLine = isEmptyArea
|
|
19444
|
+
? `Area: Oblique not supported`
|
|
19445
|
+
: `Area: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(area)} ${areaUnit}`;
|
|
19446
|
+
textLines.push(areaLine);
|
|
19447
|
+
}
|
|
19448
|
+
if (mean) {
|
|
19449
|
+
textLines.push(`Mean: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(mean)} ${modalityUnit}`);
|
|
19450
|
+
}
|
|
19451
|
+
if (Number.isFinite(max)) {
|
|
19452
|
+
textLines.push(`Max: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(max)} ${modalityUnit}`);
|
|
19453
|
+
}
|
|
19454
|
+
if (stdDev) {
|
|
19455
|
+
textLines.push(`Std Dev: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(stdDev)} ${modalityUnit}`);
|
|
19456
|
+
}
|
|
19457
|
+
if (perimeter) {
|
|
19458
|
+
textLines.push(`Perimeter: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(perimeter)} ${unit}`);
|
|
19459
|
+
}
|
|
19460
|
+
if (length) {
|
|
19461
|
+
textLines.push(`${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(length)} ${unit}`);
|
|
19462
|
+
}
|
|
19463
|
+
return textLines;
|
|
19464
|
+
}
|
|
19465
|
+
PlanarFreehandROITool.toolName = 'PlanarFreehandROI';
|
|
19466
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PlanarFreehandROITool);
|
|
19467
|
+
|
|
19468
|
+
|
|
18760
19469
|
/***/ }),
|
|
18761
19470
|
|
|
18762
19471
|
/***/ 86479:
|