@ohif/app 3.9.0-beta.98 → 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.6188ba4a4aca12aaf7d1.js → 1841.bundle.b644430a7b443b715aee.js} +11 -11
- package/dist/1841.css +3 -0
- package/dist/{2119.bundle.6aca0cf4fc5db62d77b9.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.b60b094cbfd0486819ce.js → 3846.bundle.559405e95050bff1bdb8.js} +111 -75
- package/dist/{3962.bundle.9a1d66291b3070873892.js → 3962.bundle.bbb70fcdf211b7044025.js} +2 -2
- package/dist/{4210.bundle.ccccde45071c91a381b5.js → 4210.bundle.a41a375b496c7019fbd9.js} +3 -3
- package/dist/{7360.bundle.70420db3a8b2396a74ca.js → 4566.bundle.ec9936198e788f67bd79.js} +1210 -776
- package/dist/{5888.bundle.687c9173dc3dbca67b6c.js → 5888.bundle.345f92c3ccc69e0c4543.js} +4 -6
- package/dist/{6552.bundle.286dda309441db5b56c1.js → 6552.bundle.87f348d1180c24315677.js} +35 -23
- package/dist/{3482.bundle.0b9c4d64f4b14af4ee0a.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/{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.a8701d5a00ceb84bab64.js → 8999.bundle.e936840b7caf9dae422e.js} +3 -3
- package/dist/{9579.bundle.f9c9be0c5ab6cddbde3d.js → 9579.bundle.8bb193d6ff0f63a19c72.js} +11 -2
- package/dist/{7913.bundle.4f259b2f5f30efeaf121.js → 9788.bundle.a2f2b48921c47b54853c.js} +18 -24
- package/dist/9788.css +3 -0
- package/dist/{app.bundle.289e1ee9fe757434bbc4.js → app.bundle.21e229cd4d308d88ddf4.js} +2882 -2782
- package/dist/app.bundle.css +2 -2
- 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.3772df1d5fd3d3f06a0a.js → 153.bundle.3727289b597308e3295f.js} +0 -0
- /package/dist/{2791.bundle.2f25931df62e9ebaafb2.js → 2791.bundle.7874c31472a55a7b35a7.js} +0 -0
- /package/dist/{4353.bundle.cf8a64e611cb6330f3e5.js → 4353.bundle.e7f048a0002dc3bb19fb.js} +0 -0
- /package/dist/{4978.bundle.16df43d1e89383235312.js → 4978.bundle.6474620f33562f3418f8.js} +0 -0
- /package/dist/{6591.bundle.78485be183f68b456495.js → 6591.bundle.1c29e66a86ab07463109.js} +0 -0
- /package/dist/{7246.bundle.b6c6f4324d62ab2960bb.js → 7246.bundle.cbc90a04abb3d771d7ba.js} +0 -0
- /package/dist/{7376.bundle.36672e2cbaafb7fa23b3.js → 7376.bundle.b31063489283cc2c5e16.js} +0 -0
- /package/dist/{7502.bundle.58965e833bce0661b63f.js → 7502.bundle.6f9c7545a4ed24158417.js} +0 -0
- /package/dist/{8944.bundle.8de6791692d3629c92a5.js → 8944.bundle.0cc6d2a5df7aa2de1c81.js} +0 -0
|
@@ -656,6 +656,9 @@ class BaseVolumeViewport extends _Viewport__WEBPACK_IMPORTED_MODULE_14__/* ["def
|
|
|
656
656
|
if (properties.rotation !== undefined) {
|
|
657
657
|
this.setRotation(properties.rotation);
|
|
658
658
|
}
|
|
659
|
+
if (properties.preset !== undefined) {
|
|
660
|
+
this.setPreset(properties.preset, volumeId, false);
|
|
661
|
+
}
|
|
659
662
|
this.render();
|
|
660
663
|
}
|
|
661
664
|
setPreset(presetNameOrObj, volumeId, suppressEvents) {
|
|
@@ -2832,7 +2835,23 @@ class StackViewport extends _Viewport__WEBPACK_IMPORTED_MODULE_12__/* ["default"
|
|
|
2832
2835
|
const colonIndex = imageId.indexOf(':');
|
|
2833
2836
|
imageURI = imageId.substring(colonIndex + 1);
|
|
2834
2837
|
}
|
|
2835
|
-
|
|
2838
|
+
const endsWith = referencedImageId?.endsWith(imageURI);
|
|
2839
|
+
if (endsWith) {
|
|
2840
|
+
return endsWith;
|
|
2841
|
+
}
|
|
2842
|
+
const { cameraFocalPoint } = viewRef;
|
|
2843
|
+
if (options.asNearbyProjection && cameraFocalPoint) {
|
|
2844
|
+
const { spacing, direction, origin } = this.getImageData();
|
|
2845
|
+
const viewPlaneNormal = direction.slice(6, 9);
|
|
2846
|
+
const sliceThickness = (0,_utilities__WEBPACK_IMPORTED_MODULE_11__.getSpacingInNormalDirection)({ direction, spacing }, viewPlaneNormal);
|
|
2847
|
+
const diff = gl_matrix__WEBPACK_IMPORTED_MODULE_7__/* .vec3.subtract */ .R3.subtract(gl_matrix__WEBPACK_IMPORTED_MODULE_7__/* .vec3.create */ .R3.create(), cameraFocalPoint, origin);
|
|
2848
|
+
const distanceToPlane = gl_matrix__WEBPACK_IMPORTED_MODULE_7__/* .vec3.dot */ .R3.dot(diff, viewPlaneNormal);
|
|
2849
|
+
const threshold = sliceThickness / 2;
|
|
2850
|
+
if (Math.abs(distanceToPlane) <= threshold) {
|
|
2851
|
+
return true;
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
return false;
|
|
2836
2855
|
}
|
|
2837
2856
|
getViewReference(viewRefSpecifier = {}) {
|
|
2838
2857
|
const { sliceIndex = this.getCurrentImageIdIndex() } = viewRefSpecifier;
|
|
@@ -4275,10 +4294,20 @@ class VolumeViewport extends _BaseVolumeViewport__WEBPACK_IMPORTED_MODULE_5__/*
|
|
|
4275
4294
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
4276
4295
|
/* harmony export */ });
|
|
4277
4296
|
/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7187);
|
|
4278
|
-
/* harmony import */ var
|
|
4297
|
+
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(19247);
|
|
4298
|
+
/* harmony import */ var _cache__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(82253);
|
|
4299
|
+
/* harmony import */ var _helpers_setDefaultVolumeVOI__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(98230);
|
|
4300
|
+
/* harmony import */ var _utilities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(56309);
|
|
4301
|
+
/* harmony import */ var _utilities_transferFunctionUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(54526);
|
|
4302
|
+
/* harmony import */ var _BaseVolumeViewport__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(36205);
|
|
4303
|
+
|
|
4304
|
+
|
|
4305
|
+
|
|
4279
4306
|
|
|
4280
4307
|
|
|
4281
|
-
|
|
4308
|
+
|
|
4309
|
+
|
|
4310
|
+
class VolumeViewport3D extends _BaseVolumeViewport__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z {
|
|
4282
4311
|
constructor(props) {
|
|
4283
4312
|
super(props);
|
|
4284
4313
|
this.getRotation = () => 0;
|
|
@@ -4309,7 +4338,30 @@ class VolumeViewport3D extends _BaseVolumeViewport__WEBPACK_IMPORTED_MODULE_1__/
|
|
|
4309
4338
|
return null;
|
|
4310
4339
|
}
|
|
4311
4340
|
resetProperties(volumeId) {
|
|
4312
|
-
|
|
4341
|
+
const volumeActor = volumeId
|
|
4342
|
+
? this.getActor(volumeId)
|
|
4343
|
+
: this.getDefaultActor();
|
|
4344
|
+
if (!volumeActor) {
|
|
4345
|
+
throw new Error(`No actor found for the given volumeId: ${volumeId}`);
|
|
4346
|
+
}
|
|
4347
|
+
if (volumeActor.slabThickness) {
|
|
4348
|
+
volumeActor.slabThickness = _constants__WEBPACK_IMPORTED_MODULE_1__.RENDERING_DEFAULTS.MINIMUM_SLAB_THICKNESS;
|
|
4349
|
+
this.viewportProperties.slabThickness = undefined;
|
|
4350
|
+
this.updateClippingPlanesForActors(this.getCamera());
|
|
4351
|
+
}
|
|
4352
|
+
const imageVolume = _cache__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .ZP.getVolume(volumeActor.uid);
|
|
4353
|
+
if (!imageVolume) {
|
|
4354
|
+
throw new Error(`imageVolume with id: ${volumeActor.uid} does not exist in cache`);
|
|
4355
|
+
}
|
|
4356
|
+
(0,_helpers_setDefaultVolumeVOI__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(volumeActor.actor, imageVolume, false);
|
|
4357
|
+
if ((0,_utilities__WEBPACK_IMPORTED_MODULE_4__.isImageActor)(volumeActor)) {
|
|
4358
|
+
const transferFunction = volumeActor.actor
|
|
4359
|
+
.getProperty()
|
|
4360
|
+
.getRGBTransferFunction(0);
|
|
4361
|
+
(0,_utilities_transferFunctionUtils__WEBPACK_IMPORTED_MODULE_5__.setTransferFunctionNodes)(transferFunction, this.initialTransferFunctionNodes);
|
|
4362
|
+
}
|
|
4363
|
+
this.setCamera(this.initialCamera);
|
|
4364
|
+
(0,_utilities__WEBPACK_IMPORTED_MODULE_4__.triggerEvent)(this.element, _enums__WEBPACK_IMPORTED_MODULE_0__.Events.VOI_MODIFIED, super.getVOIModifiedEventDetail(volumeId));
|
|
4313
4365
|
}
|
|
4314
4366
|
resetSlabThickness() {
|
|
4315
4367
|
return null;
|
|
@@ -14283,6 +14335,7 @@ var Events;
|
|
|
14283
14335
|
Events["IMAGE_SPACING_CALIBRATED"] = "CORNERSTONE_IMAGE_SPACING_CALIBRATED";
|
|
14284
14336
|
Events["STACK_VIEWPORT_NEW_STACK"] = "CORNERSTONE_STACK_VIEWPORT_NEW_STACK";
|
|
14285
14337
|
Events["STACK_VIEWPORT_SCROLL"] = "CORNERSTONE_STACK_VIEWPORT_SCROLL";
|
|
14338
|
+
Events["STACK_SCROLL_OUT_OF_BOUNDS"] = "STACK_SCROLL_OUT_OF_BOUNDS";
|
|
14286
14339
|
Events["GEOMETRY_CACHE_GEOMETRY_ADDED"] = "CORNERSTONE_GEOMETRY_CACHE_GEOMETRY_ADDED";
|
|
14287
14340
|
Events["VOLUME_SCROLL_OUT_OF_BOUNDS"] = "VOLUME_SCROLL_OUT_OF_BOUNDS";
|
|
14288
14341
|
Events["VOLUME_VIEWPORT_SCROLL"] = "VOLUME_VIEWPORT_SCROLL";
|
|
@@ -34265,27 +34318,30 @@ class ScaleOverlayTool extends _base_AnnotationDisplayTool__WEBPACK_IMPORTED_MOD
|
|
|
34265
34318
|
if (annotations.length) {
|
|
34266
34319
|
annotation = annotations.filter((thisAnnotation) => thisAnnotation.data.viewportId == viewport.id)[0];
|
|
34267
34320
|
}
|
|
34268
|
-
|
|
34269
|
-
const
|
|
34270
|
-
|
|
34271
|
-
|
|
34272
|
-
|
|
34273
|
-
|
|
34274
|
-
|
|
34275
|
-
|
|
34276
|
-
|
|
34277
|
-
|
|
34278
|
-
handles: {
|
|
34279
|
-
points: viewportCanvasCornersInWorld,
|
|
34321
|
+
enabledElements.forEach((element) => {
|
|
34322
|
+
const { viewport } = element;
|
|
34323
|
+
if (!viewportsWithAnnotations.includes(viewport.id)) {
|
|
34324
|
+
const newAnnotation = {
|
|
34325
|
+
metadata: {
|
|
34326
|
+
toolName: this.getToolName(),
|
|
34327
|
+
viewPlaneNormal: [...viewPlaneNormal],
|
|
34328
|
+
viewUp: [...viewUp],
|
|
34329
|
+
FrameOfReferenceUID,
|
|
34330
|
+
referencedImageId: null,
|
|
34280
34331
|
},
|
|
34281
|
-
|
|
34282
|
-
|
|
34283
|
-
|
|
34284
|
-
|
|
34285
|
-
|
|
34286
|
-
|
|
34287
|
-
|
|
34288
|
-
|
|
34332
|
+
data: {
|
|
34333
|
+
handles: {
|
|
34334
|
+
points: _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_2__.utilities.getViewportImageCornersInWorld(viewport),
|
|
34335
|
+
},
|
|
34336
|
+
viewportId: viewport.id,
|
|
34337
|
+
},
|
|
34338
|
+
};
|
|
34339
|
+
viewportsWithAnnotations.push(viewport.id);
|
|
34340
|
+
(0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_3__.addAnnotation)(newAnnotation, viewport.element);
|
|
34341
|
+
annotation = newAnnotation;
|
|
34342
|
+
}
|
|
34343
|
+
});
|
|
34344
|
+
if (this.editData.annotation &&
|
|
34289
34345
|
this.editData.annotation.data.viewportId == viewport.id) {
|
|
34290
34346
|
this.editData.annotation.data.handles.points =
|
|
34291
34347
|
viewportCanvasCornersInWorld;
|
|
@@ -40454,6 +40510,8 @@ LivewireContourSegmentationTool.toolName = 'LivewireContourSegmentationTool';
|
|
|
40454
40510
|
/* harmony import */ var _utilities_livewire_LiveWirePath__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(27479);
|
|
40455
40511
|
/* harmony import */ var _utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(46966);
|
|
40456
40512
|
/* harmony import */ var _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(22955);
|
|
40513
|
+
/* harmony import */ var _utilities_drawing__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(20724);
|
|
40514
|
+
|
|
40457
40515
|
|
|
40458
40516
|
|
|
40459
40517
|
|
|
@@ -40475,6 +40533,8 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
40475
40533
|
constructor(toolProps = {}, defaultToolProps = {
|
|
40476
40534
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
40477
40535
|
configuration: {
|
|
40536
|
+
getTextLines: defaultGetTextLines,
|
|
40537
|
+
calculateStats: true,
|
|
40478
40538
|
preventHandleOutsideImage: false,
|
|
40479
40539
|
contourHoleAdditionModifierKey: _enums__WEBPACK_IMPORTED_MODULE_5__.KeyboardBindings.Shift,
|
|
40480
40540
|
snapHandleNearby: 2,
|
|
@@ -40525,6 +40585,7 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
40525
40585
|
this.editData = {
|
|
40526
40586
|
annotation,
|
|
40527
40587
|
viewportIdsToRender,
|
|
40588
|
+
movingTextBox: false,
|
|
40528
40589
|
};
|
|
40529
40590
|
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
|
|
40530
40591
|
const { renderingEngine } = enabledElement;
|
|
@@ -40537,13 +40598,21 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
40537
40598
|
const { element } = eventDetail;
|
|
40538
40599
|
const { data } = annotation;
|
|
40539
40600
|
annotation.highlighted = true;
|
|
40540
|
-
|
|
40541
|
-
|
|
40601
|
+
let movingTextBox = false;
|
|
40602
|
+
let handleIndex;
|
|
40603
|
+
if (handle.worldPosition) {
|
|
40604
|
+
movingTextBox = true;
|
|
40605
|
+
}
|
|
40606
|
+
else {
|
|
40607
|
+
const { points } = data.handles;
|
|
40608
|
+
handleIndex = points.findIndex((p) => p === handle);
|
|
40609
|
+
}
|
|
40542
40610
|
const viewportIdsToRender = (0,_utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_14__.getViewportIdsWithToolToRender)(element, this.getToolName());
|
|
40543
40611
|
this.editData = {
|
|
40544
40612
|
annotation,
|
|
40545
40613
|
viewportIdsToRender,
|
|
40546
40614
|
handleIndex,
|
|
40615
|
+
movingTextBox,
|
|
40547
40616
|
};
|
|
40548
40617
|
this._activateModify(element);
|
|
40549
40618
|
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
|
|
@@ -40671,15 +40740,27 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
40671
40740
|
this.isDrawing = true;
|
|
40672
40741
|
const eventDetail = evt.detail;
|
|
40673
40742
|
const { element } = eventDetail;
|
|
40674
|
-
const { annotation, viewportIdsToRender, handleIndex } = this.editData;
|
|
40675
|
-
|
|
40676
|
-
|
|
40743
|
+
const { annotation, viewportIdsToRender, handleIndex, movingTextBox } = this.editData;
|
|
40744
|
+
const { data } = annotation;
|
|
40745
|
+
if (movingTextBox) {
|
|
40746
|
+
const { deltaPoints } = eventDetail;
|
|
40747
|
+
const worldPosDelta = deltaPoints.world;
|
|
40748
|
+
const { textBox } = data.handles;
|
|
40749
|
+
const { worldPosition } = textBox;
|
|
40750
|
+
worldPosition[0] += worldPosDelta[0];
|
|
40751
|
+
worldPosition[1] += worldPosDelta[1];
|
|
40752
|
+
worldPosition[2] += worldPosDelta[2];
|
|
40753
|
+
textBox.hasMoved = true;
|
|
40754
|
+
}
|
|
40755
|
+
else if (handleIndex === undefined) {
|
|
40756
|
+
console.warn('Drag annotation not implemented');
|
|
40677
40757
|
}
|
|
40678
40758
|
else {
|
|
40679
40759
|
const { currentPoints } = eventDetail;
|
|
40680
40760
|
const worldPos = currentPoints.world;
|
|
40681
40761
|
this.editHandle(worldPos, element, annotation, handleIndex);
|
|
40682
40762
|
}
|
|
40763
|
+
this.editData.hasMoved = true;
|
|
40683
40764
|
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
|
|
40684
40765
|
const { renderingEngine } = enabledElement;
|
|
40685
40766
|
(0,_utilities__WEBPACK_IMPORTED_MODULE_8__.triggerAnnotationRenderForViewportIds)(renderingEngine, viewportIdsToRender);
|
|
@@ -40735,6 +40816,104 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
40735
40816
|
element.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_5__.Events.MOUSE_DOUBLE_CLICK, this._mouseDownCallback);
|
|
40736
40817
|
element.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_5__.Events.TOUCH_TAP, this._mouseDownCallback);
|
|
40737
40818
|
};
|
|
40819
|
+
this._calculateCachedStats = (annotation, element) => {
|
|
40820
|
+
if (!this.configuration.calculateStats) {
|
|
40821
|
+
return;
|
|
40822
|
+
}
|
|
40823
|
+
const data = annotation.data;
|
|
40824
|
+
if (!data.contour.closed) {
|
|
40825
|
+
return;
|
|
40826
|
+
}
|
|
40827
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
|
|
40828
|
+
const { viewport, renderingEngine } = enabledElement;
|
|
40829
|
+
const { cachedStats } = data;
|
|
40830
|
+
const { polyline: points } = data.contour;
|
|
40831
|
+
const targetIds = Object.keys(cachedStats);
|
|
40832
|
+
for (let i = 0; i < targetIds.length; i++) {
|
|
40833
|
+
const targetId = targetIds[i];
|
|
40834
|
+
const image = this.getTargetIdImage(targetId, renderingEngine);
|
|
40835
|
+
if (!image) {
|
|
40836
|
+
continue;
|
|
40837
|
+
}
|
|
40838
|
+
const { metadata } = image;
|
|
40839
|
+
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
40840
|
+
const canvasPoint = canvasCoordinates[0];
|
|
40841
|
+
const originalWorldPoint = viewport.canvasToWorld(canvasPoint);
|
|
40842
|
+
const deltaXPoint = viewport.canvasToWorld([
|
|
40843
|
+
canvasPoint[0] + 1,
|
|
40844
|
+
canvasPoint[1],
|
|
40845
|
+
]);
|
|
40846
|
+
const deltaYPoint = viewport.canvasToWorld([
|
|
40847
|
+
canvasPoint[0],
|
|
40848
|
+
canvasPoint[1] + 1,
|
|
40849
|
+
]);
|
|
40850
|
+
const deltaInX = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.distance */ .R3.distance(originalWorldPoint, deltaXPoint);
|
|
40851
|
+
const deltaInY = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.distance */ .R3.distance(originalWorldPoint, deltaYPoint);
|
|
40852
|
+
const { imageData } = image;
|
|
40853
|
+
const { scale, areaUnits } = (0,_utilities__WEBPACK_IMPORTED_MODULE_8__.getCalibratedLengthUnitsAndScale)(image, () => {
|
|
40854
|
+
const { maxX: canvasMaxX, maxY: canvasMaxY, minX: canvasMinX, minY: canvasMinY, } = _utilities__WEBPACK_IMPORTED_MODULE_8__.math.polyline.getAABB(canvasCoordinates);
|
|
40855
|
+
const topLeftBBWorld = viewport.canvasToWorld([
|
|
40856
|
+
canvasMinX,
|
|
40857
|
+
canvasMinY,
|
|
40858
|
+
]);
|
|
40859
|
+
const topLeftBBIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities.transformWorldToIndex(imageData, topLeftBBWorld);
|
|
40860
|
+
const bottomRightBBWorld = viewport.canvasToWorld([
|
|
40861
|
+
canvasMaxX,
|
|
40862
|
+
canvasMaxY,
|
|
40863
|
+
]);
|
|
40864
|
+
const bottomRightBBIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities.transformWorldToIndex(imageData, bottomRightBBWorld);
|
|
40865
|
+
return [topLeftBBIndex, bottomRightBBIndex];
|
|
40866
|
+
});
|
|
40867
|
+
let area = _utilities__WEBPACK_IMPORTED_MODULE_8__.math.polyline.getArea(canvasCoordinates) / scale / scale;
|
|
40868
|
+
area *= deltaInX * deltaInY;
|
|
40869
|
+
cachedStats[targetId] = {
|
|
40870
|
+
Modality: metadata.Modality,
|
|
40871
|
+
area,
|
|
40872
|
+
areaUnit: areaUnits,
|
|
40873
|
+
};
|
|
40874
|
+
}
|
|
40875
|
+
this.triggerAnnotationModified(annotation, enabledElement, _enums__WEBPACK_IMPORTED_MODULE_5__.ChangeTypes.StatsUpdated);
|
|
40876
|
+
return cachedStats;
|
|
40877
|
+
};
|
|
40878
|
+
this._renderStats = (annotation, viewport, svgDrawingHelper, textboxStyle) => {
|
|
40879
|
+
const data = annotation.data;
|
|
40880
|
+
const targetId = this.getTargetId(viewport);
|
|
40881
|
+
if (!data.contour.closed || !textboxStyle.visibility) {
|
|
40882
|
+
return;
|
|
40883
|
+
}
|
|
40884
|
+
const textLines = this.configuration.getTextLines(data, targetId);
|
|
40885
|
+
if (!textLines || textLines.length === 0) {
|
|
40886
|
+
return;
|
|
40887
|
+
}
|
|
40888
|
+
const canvasCoordinates = data.handles.points.map((p) => viewport.worldToCanvas(p));
|
|
40889
|
+
if (!data.handles.textBox.hasMoved) {
|
|
40890
|
+
const canvasTextBoxCoords = (0,_utilities_drawing__WEBPACK_IMPORTED_MODULE_16__.getTextBoxCoordsCanvas)(canvasCoordinates);
|
|
40891
|
+
data.handles.textBox.worldPosition =
|
|
40892
|
+
viewport.canvasToWorld(canvasTextBoxCoords);
|
|
40893
|
+
}
|
|
40894
|
+
const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
|
|
40895
|
+
const textBoxUID = 'textBox';
|
|
40896
|
+
const boundingBox = (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_3__.drawLinkedTextBox)(svgDrawingHelper, annotation.annotationUID ?? '', textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, textboxStyle);
|
|
40897
|
+
const { x: left, y: top, width, height } = boundingBox;
|
|
40898
|
+
data.handles.textBox.worldBoundingBox = {
|
|
40899
|
+
topLeft: viewport.canvasToWorld([left, top]),
|
|
40900
|
+
topRight: viewport.canvasToWorld([left + width, top]),
|
|
40901
|
+
bottomLeft: viewport.canvasToWorld([left, top + height]),
|
|
40902
|
+
bottomRight: viewport.canvasToWorld([left + width, top + height]),
|
|
40903
|
+
};
|
|
40904
|
+
};
|
|
40905
|
+
this.triggerAnnotationModified = (annotation, enabledElement, changeType = _enums__WEBPACK_IMPORTED_MODULE_5__.ChangeTypes.StatsUpdated) => {
|
|
40906
|
+
const { viewportId, renderingEngineId } = enabledElement;
|
|
40907
|
+
const eventType = _enums__WEBPACK_IMPORTED_MODULE_5__.Events.ANNOTATION_MODIFIED;
|
|
40908
|
+
const eventDetail = {
|
|
40909
|
+
annotation,
|
|
40910
|
+
viewportId,
|
|
40911
|
+
renderingEngineId,
|
|
40912
|
+
changeType,
|
|
40913
|
+
};
|
|
40914
|
+
(0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.triggerEvent)(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.eventTarget, eventType, eventDetail);
|
|
40915
|
+
};
|
|
40916
|
+
this._throttledCalculateCachedStats = (0,_utilities__WEBPACK_IMPORTED_MODULE_8__.throttle)(this._calculateCachedStats, 100, { trailing: true });
|
|
40738
40917
|
}
|
|
40739
40918
|
setupBaseEditData(worldPos, element, annotation, nextPos, contourHoleProcessingEnabled) {
|
|
40740
40919
|
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
|
|
@@ -40888,6 +41067,7 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
40888
41067
|
editData.currentPath = currentPath;
|
|
40889
41068
|
annotation.invalidated = true;
|
|
40890
41069
|
editData.hasMoved = true;
|
|
41070
|
+
editData.closed = true;
|
|
40891
41071
|
}
|
|
40892
41072
|
renderAnnotation(enabledElement, svgDrawingHelper) {
|
|
40893
41073
|
this.updateAnnotation(this.editData?.currentPath);
|
|
@@ -40915,8 +41095,9 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
40915
41095
|
this._endCallback(evt, true);
|
|
40916
41096
|
}
|
|
40917
41097
|
renderAnnotationInstance(renderContext) {
|
|
40918
|
-
const { annotation, enabledElement, svgDrawingHelper, annotationStyle } = renderContext;
|
|
41098
|
+
const { annotation, enabledElement, svgDrawingHelper, annotationStyle, targetId, } = renderContext;
|
|
40919
41099
|
const { viewport } = enabledElement;
|
|
41100
|
+
const { element } = viewport;
|
|
40920
41101
|
const { worldToCanvas } = viewport;
|
|
40921
41102
|
const { annotationUID, data, highlighted } = annotation;
|
|
40922
41103
|
const { handles } = data;
|
|
@@ -40934,6 +41115,19 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
40934
41115
|
});
|
|
40935
41116
|
}
|
|
40936
41117
|
super.renderAnnotationInstance(renderContext);
|
|
41118
|
+
if (!data.cachedStats[targetId] ||
|
|
41119
|
+
data.cachedStats[targetId].areaUnit == null) {
|
|
41120
|
+
data.cachedStats[targetId] = {
|
|
41121
|
+
Modality: null,
|
|
41122
|
+
area: null,
|
|
41123
|
+
areaUnit: null,
|
|
41124
|
+
};
|
|
41125
|
+
this._calculateCachedStats(annotation, element);
|
|
41126
|
+
}
|
|
41127
|
+
else if (annotation.invalidated) {
|
|
41128
|
+
this._throttledCalculateCachedStats(annotation, element);
|
|
41129
|
+
}
|
|
41130
|
+
this._renderStats(annotation, viewport, svgDrawingHelper, annotationStyle.textbox);
|
|
40937
41131
|
return true;
|
|
40938
41132
|
}
|
|
40939
41133
|
updateAnnotation(livewirePath) {
|
|
@@ -40958,6 +41152,16 @@ class LivewireContourTool extends _base_ContourSegmentationBaseTool__WEBPACK_IMP
|
|
|
40958
41152
|
}
|
|
40959
41153
|
LivewireContourTool.toolName = 'LivewireContour';
|
|
40960
41154
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LivewireContourTool);
|
|
41155
|
+
function defaultGetTextLines(data, targetId) {
|
|
41156
|
+
const cachedVolumeStats = data.cachedStats[targetId];
|
|
41157
|
+
const { area, areaUnit } = cachedVolumeStats;
|
|
41158
|
+
const textLines = [];
|
|
41159
|
+
if (area) {
|
|
41160
|
+
const areaLine = `Area: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_8__.roundNumber)(area)} ${areaUnit}`;
|
|
41161
|
+
textLines.push(areaLine);
|
|
41162
|
+
}
|
|
41163
|
+
return textLines;
|
|
41164
|
+
}
|
|
40961
41165
|
|
|
40962
41166
|
|
|
40963
41167
|
/***/ }),
|
|
@@ -41004,6 +41208,565 @@ PlanarFreehandContourSegmentationTool.toolName =
|
|
|
41004
41208
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PlanarFreehandContourSegmentationTool);
|
|
41005
41209
|
|
|
41006
41210
|
|
|
41211
|
+
/***/ }),
|
|
41212
|
+
|
|
41213
|
+
/***/ 22455:
|
|
41214
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
41215
|
+
|
|
41216
|
+
"use strict";
|
|
41217
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
41218
|
+
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
41219
|
+
/* harmony export */ });
|
|
41220
|
+
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12651);
|
|
41221
|
+
/* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(72076);
|
|
41222
|
+
/* harmony import */ var _utilities_getCalibratedUnits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(39661);
|
|
41223
|
+
/* harmony import */ var _utilities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(42975);
|
|
41224
|
+
/* harmony import */ var _utilities_math__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(79390);
|
|
41225
|
+
/* harmony import */ var _utilities_planar__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(44037);
|
|
41226
|
+
/* harmony import */ var _utilities_throttle__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(90685);
|
|
41227
|
+
/* harmony import */ var _utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(46966);
|
|
41228
|
+
/* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(66878);
|
|
41229
|
+
/* harmony import */ var _planarFreehandROITool_drawLoop__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(75698);
|
|
41230
|
+
/* harmony import */ var _planarFreehandROITool_editLoopCommon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(89026);
|
|
41231
|
+
/* harmony import */ var _planarFreehandROITool_closedContourEditLoop__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(58391);
|
|
41232
|
+
/* harmony import */ var _planarFreehandROITool_openContourEditLoop__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(21879);
|
|
41233
|
+
/* harmony import */ var _planarFreehandROITool_openContourEndEditLoop__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(82571);
|
|
41234
|
+
/* harmony import */ var _planarFreehandROITool_renderMethods__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(54435);
|
|
41235
|
+
/* harmony import */ var _stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(36705);
|
|
41236
|
+
/* harmony import */ var _drawingSvg__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(25876);
|
|
41237
|
+
/* harmony import */ var _utilities_drawing__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(20724);
|
|
41238
|
+
/* harmony import */ var _utilities_math_polyline__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(42744);
|
|
41239
|
+
/* harmony import */ var _utilities_pointInShapeCallback__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(31955);
|
|
41240
|
+
/* harmony import */ var _utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(20752);
|
|
41241
|
+
/* harmony import */ var _utilities_getModalityUnit__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(15607);
|
|
41242
|
+
/* harmony import */ var _utilities_math_basic__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(51053);
|
|
41243
|
+
/* harmony import */ var _utilities_contours_calculatePerimeter__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(3042);
|
|
41244
|
+
/* harmony import */ var _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(22955);
|
|
41245
|
+
/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(68096);
|
|
41246
|
+
|
|
41247
|
+
|
|
41248
|
+
|
|
41249
|
+
|
|
41250
|
+
|
|
41251
|
+
|
|
41252
|
+
|
|
41253
|
+
|
|
41254
|
+
|
|
41255
|
+
|
|
41256
|
+
|
|
41257
|
+
|
|
41258
|
+
|
|
41259
|
+
|
|
41260
|
+
|
|
41261
|
+
|
|
41262
|
+
|
|
41263
|
+
|
|
41264
|
+
|
|
41265
|
+
|
|
41266
|
+
|
|
41267
|
+
|
|
41268
|
+
|
|
41269
|
+
|
|
41270
|
+
|
|
41271
|
+
|
|
41272
|
+
const { pointCanProjectOnLine } = _utilities_math__WEBPACK_IMPORTED_MODULE_4__.polyline;
|
|
41273
|
+
const { EPSILON } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.CONSTANTS;
|
|
41274
|
+
const PARALLEL_THRESHOLD = 1 - EPSILON;
|
|
41275
|
+
class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_MODULE_24__/* ["default"] */ .Z {
|
|
41276
|
+
constructor(toolProps = {}, defaultToolProps = {
|
|
41277
|
+
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
41278
|
+
configuration: {
|
|
41279
|
+
shadow: true,
|
|
41280
|
+
preventHandleOutsideImage: false,
|
|
41281
|
+
contourHoleAdditionModifierKey: _enums__WEBPACK_IMPORTED_MODULE_25__.KeyboardBindings.Shift,
|
|
41282
|
+
alwaysRenderOpenContourHandles: {
|
|
41283
|
+
enabled: false,
|
|
41284
|
+
radius: 2,
|
|
41285
|
+
},
|
|
41286
|
+
allowOpenContours: true,
|
|
41287
|
+
closeContourProximity: 10,
|
|
41288
|
+
checkCanvasEditFallbackProximity: 6,
|
|
41289
|
+
makeClockWise: true,
|
|
41290
|
+
subPixelResolution: 4,
|
|
41291
|
+
smoothing: {
|
|
41292
|
+
smoothOnAdd: false,
|
|
41293
|
+
smoothOnEdit: false,
|
|
41294
|
+
knotsRatioPercentageOnAdd: 40,
|
|
41295
|
+
knotsRatioPercentageOnEdit: 40,
|
|
41296
|
+
},
|
|
41297
|
+
interpolation: {
|
|
41298
|
+
enabled: false,
|
|
41299
|
+
onInterpolationComplete: null,
|
|
41300
|
+
},
|
|
41301
|
+
decimate: {
|
|
41302
|
+
enabled: false,
|
|
41303
|
+
epsilon: 0.1,
|
|
41304
|
+
},
|
|
41305
|
+
displayOnePointAsCrosshairs: false,
|
|
41306
|
+
calculateStats: true,
|
|
41307
|
+
getTextLines: defaultGetTextLines,
|
|
41308
|
+
statsCalculator: _utilities_math_basic__WEBPACK_IMPORTED_MODULE_22__.BasicStatsCalculator,
|
|
41309
|
+
},
|
|
41310
|
+
}) {
|
|
41311
|
+
super(toolProps, defaultToolProps);
|
|
41312
|
+
this.isDrawing = false;
|
|
41313
|
+
this.isEditingClosed = false;
|
|
41314
|
+
this.isEditingOpen = false;
|
|
41315
|
+
this.addNewAnnotation = (evt) => {
|
|
41316
|
+
const eventDetail = evt.detail;
|
|
41317
|
+
const { element } = eventDetail;
|
|
41318
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
|
|
41319
|
+
const { renderingEngine } = enabledElement;
|
|
41320
|
+
const annotation = this.createAnnotation(evt);
|
|
41321
|
+
this.addAnnotation(annotation, element);
|
|
41322
|
+
const viewportIdsToRender = (0,_utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_7__.getViewportIdsWithToolToRender)(element, this.getToolName());
|
|
41323
|
+
this.activateDraw(evt, annotation, viewportIdsToRender);
|
|
41324
|
+
evt.preventDefault();
|
|
41325
|
+
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(renderingEngine, viewportIdsToRender);
|
|
41326
|
+
return annotation;
|
|
41327
|
+
};
|
|
41328
|
+
this.handleSelectedCallback = (evt, annotation, handle) => {
|
|
41329
|
+
const eventDetail = evt.detail;
|
|
41330
|
+
const { element } = eventDetail;
|
|
41331
|
+
const viewportIdsToRender = (0,_utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_7__.getViewportIdsWithToolToRender)(element, this.getToolName());
|
|
41332
|
+
this.activateOpenContourEndEdit(evt, annotation, viewportIdsToRender, handle);
|
|
41333
|
+
};
|
|
41334
|
+
this.toolSelectedCallback = (evt, annotation) => {
|
|
41335
|
+
const eventDetail = evt.detail;
|
|
41336
|
+
const { element } = eventDetail;
|
|
41337
|
+
const viewportIdsToRender = (0,_utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_7__.getViewportIdsWithToolToRender)(element, this.getToolName());
|
|
41338
|
+
if (annotation.data.contour.closed) {
|
|
41339
|
+
this.activateClosedContourEdit(evt, annotation, viewportIdsToRender);
|
|
41340
|
+
}
|
|
41341
|
+
else {
|
|
41342
|
+
this.activateOpenContourEdit(evt, annotation, viewportIdsToRender);
|
|
41343
|
+
}
|
|
41344
|
+
evt.preventDefault();
|
|
41345
|
+
};
|
|
41346
|
+
this.isPointNearTool = (element, annotation, canvasCoords, proximity) => {
|
|
41347
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
|
|
41348
|
+
const { viewport } = enabledElement;
|
|
41349
|
+
const { polyline: points } = annotation.data.contour;
|
|
41350
|
+
let previousPoint = viewport.worldToCanvas(points[0]);
|
|
41351
|
+
for (let i = 1; i < points.length; i++) {
|
|
41352
|
+
const p1 = previousPoint;
|
|
41353
|
+
const p2 = viewport.worldToCanvas(points[i]);
|
|
41354
|
+
const canProject = pointCanProjectOnLine(canvasCoords, p1, p2, proximity);
|
|
41355
|
+
if (canProject) {
|
|
41356
|
+
return true;
|
|
41357
|
+
}
|
|
41358
|
+
previousPoint = p2;
|
|
41359
|
+
}
|
|
41360
|
+
if (!annotation.data.contour.closed) {
|
|
41361
|
+
return false;
|
|
41362
|
+
}
|
|
41363
|
+
const pStart = viewport.worldToCanvas(points[0]);
|
|
41364
|
+
const pEnd = viewport.worldToCanvas(points[points.length - 1]);
|
|
41365
|
+
return pointCanProjectOnLine(canvasCoords, pStart, pEnd, proximity);
|
|
41366
|
+
};
|
|
41367
|
+
this.cancel = (element) => {
|
|
41368
|
+
const isDrawing = this.isDrawing;
|
|
41369
|
+
const isEditingOpen = this.isEditingOpen;
|
|
41370
|
+
const isEditingClosed = this.isEditingClosed;
|
|
41371
|
+
if (isDrawing) {
|
|
41372
|
+
this.cancelDrawing(element);
|
|
41373
|
+
}
|
|
41374
|
+
else if (isEditingOpen) {
|
|
41375
|
+
this.cancelOpenContourEdit(element);
|
|
41376
|
+
}
|
|
41377
|
+
else if (isEditingClosed) {
|
|
41378
|
+
this.cancelClosedContourEdit(element);
|
|
41379
|
+
}
|
|
41380
|
+
};
|
|
41381
|
+
this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement) => {
|
|
41382
|
+
const { data } = annotation;
|
|
41383
|
+
const { cachedStats } = data;
|
|
41384
|
+
const { polyline: points, closed } = data.contour;
|
|
41385
|
+
const targetIds = Object.keys(cachedStats);
|
|
41386
|
+
for (let i = 0; i < targetIds.length; i++) {
|
|
41387
|
+
const targetId = targetIds[i];
|
|
41388
|
+
const image = this.getTargetIdImage(targetId, renderingEngine);
|
|
41389
|
+
if (!image) {
|
|
41390
|
+
continue;
|
|
41391
|
+
}
|
|
41392
|
+
const { imageData, metadata } = image;
|
|
41393
|
+
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
41394
|
+
const modalityUnitOptions = {
|
|
41395
|
+
isPreScaled: (0,_utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_20__/* .isViewportPreScaled */ .P)(viewport, targetId),
|
|
41396
|
+
isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
|
|
41397
|
+
};
|
|
41398
|
+
const modalityUnit = (0,_utilities_getModalityUnit__WEBPACK_IMPORTED_MODULE_21__/* .getModalityUnit */ .F)(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
|
|
41399
|
+
const calibratedScale = (0,_utilities_getCalibratedUnits__WEBPACK_IMPORTED_MODULE_2__/* .getCalibratedLengthUnitsAndScale */ .mh)(image, () => {
|
|
41400
|
+
const polyline = data.contour.polyline;
|
|
41401
|
+
const numPoints = polyline.length;
|
|
41402
|
+
const projectedPolyline = new Array(numPoints);
|
|
41403
|
+
for (let i = 0; i < numPoints; i++) {
|
|
41404
|
+
projectedPolyline[i] = viewport.worldToCanvas(polyline[i]);
|
|
41405
|
+
}
|
|
41406
|
+
const { maxX: canvasMaxX, maxY: canvasMaxY, minX: canvasMinX, minY: canvasMinY, } = _utilities__WEBPACK_IMPORTED_MODULE_3__.math.polyline.getAABB(projectedPolyline);
|
|
41407
|
+
const topLeftBBWorld = viewport.canvasToWorld([canvasMinX, canvasMinY]);
|
|
41408
|
+
const topLeftBBIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.transformWorldToIndex(imageData, topLeftBBWorld);
|
|
41409
|
+
const bottomRightBBWorld = viewport.canvasToWorld([
|
|
41410
|
+
canvasMaxX,
|
|
41411
|
+
canvasMaxY,
|
|
41412
|
+
]);
|
|
41413
|
+
const bottomRightBBIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.transformWorldToIndex(imageData, bottomRightBBWorld);
|
|
41414
|
+
return [topLeftBBIndex, bottomRightBBIndex];
|
|
41415
|
+
});
|
|
41416
|
+
if (closed) {
|
|
41417
|
+
this.updateClosedCachedStats({
|
|
41418
|
+
targetId,
|
|
41419
|
+
viewport,
|
|
41420
|
+
canvasCoordinates,
|
|
41421
|
+
points,
|
|
41422
|
+
imageData,
|
|
41423
|
+
metadata,
|
|
41424
|
+
cachedStats,
|
|
41425
|
+
modalityUnit,
|
|
41426
|
+
calibratedScale,
|
|
41427
|
+
});
|
|
41428
|
+
}
|
|
41429
|
+
else {
|
|
41430
|
+
this.updateOpenCachedStats({
|
|
41431
|
+
metadata,
|
|
41432
|
+
canvasCoordinates,
|
|
41433
|
+
targetId,
|
|
41434
|
+
cachedStats,
|
|
41435
|
+
modalityUnit,
|
|
41436
|
+
calibratedScale,
|
|
41437
|
+
});
|
|
41438
|
+
}
|
|
41439
|
+
}
|
|
41440
|
+
(0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_15__/* .triggerAnnotationModified */ .hg)(annotation, enabledElement.viewport.element, _enums__WEBPACK_IMPORTED_MODULE_25__.ChangeTypes.StatsUpdated);
|
|
41441
|
+
annotation.invalidated = false;
|
|
41442
|
+
return cachedStats;
|
|
41443
|
+
};
|
|
41444
|
+
this._renderStats = (annotation, viewport, enabledElement, svgDrawingHelper) => {
|
|
41445
|
+
const { data } = annotation;
|
|
41446
|
+
const targetId = this.getTargetId(viewport);
|
|
41447
|
+
const styleSpecifier = {
|
|
41448
|
+
toolGroupId: this.toolGroupId,
|
|
41449
|
+
toolName: this.getToolName(),
|
|
41450
|
+
viewportId: enabledElement.viewport.id,
|
|
41451
|
+
};
|
|
41452
|
+
const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
|
|
41453
|
+
if (!options.visibility) {
|
|
41454
|
+
return;
|
|
41455
|
+
}
|
|
41456
|
+
const textLines = this.configuration.getTextLines(data, targetId);
|
|
41457
|
+
if (!textLines || textLines.length === 0) {
|
|
41458
|
+
return;
|
|
41459
|
+
}
|
|
41460
|
+
const canvasCoordinates = data.contour.polyline.map((p) => viewport.worldToCanvas(p));
|
|
41461
|
+
if (!data.handles.textBox.hasMoved) {
|
|
41462
|
+
const canvasTextBoxCoords = (0,_utilities_drawing__WEBPACK_IMPORTED_MODULE_17__.getTextBoxCoordsCanvas)(canvasCoordinates);
|
|
41463
|
+
data.handles.textBox.worldPosition =
|
|
41464
|
+
viewport.canvasToWorld(canvasTextBoxCoords);
|
|
41465
|
+
}
|
|
41466
|
+
const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
|
|
41467
|
+
const textBoxUID = '1';
|
|
41468
|
+
const boundingBox = (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_16__.drawLinkedTextBox)(svgDrawingHelper, annotation.annotationUID ?? '', textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
|
|
41469
|
+
const { x: left, y: top, width, height } = boundingBox;
|
|
41470
|
+
data.handles.textBox.worldBoundingBox = {
|
|
41471
|
+
topLeft: viewport.canvasToWorld([left, top]),
|
|
41472
|
+
topRight: viewport.canvasToWorld([left + width, top]),
|
|
41473
|
+
bottomLeft: viewport.canvasToWorld([left, top + height]),
|
|
41474
|
+
bottomRight: viewport.canvasToWorld([left + width, top + height]),
|
|
41475
|
+
};
|
|
41476
|
+
};
|
|
41477
|
+
(0,_planarFreehandROITool_drawLoop__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z)(this);
|
|
41478
|
+
(0,_planarFreehandROITool_editLoopCommon__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z)(this);
|
|
41479
|
+
(0,_planarFreehandROITool_closedContourEditLoop__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z)(this);
|
|
41480
|
+
(0,_planarFreehandROITool_openContourEditLoop__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z)(this);
|
|
41481
|
+
(0,_planarFreehandROITool_openContourEndEditLoop__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z)(this);
|
|
41482
|
+
(0,_planarFreehandROITool_renderMethods__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z)(this);
|
|
41483
|
+
this._throttledCalculateCachedStats = (0,_utilities_throttle__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z)(this._calculateCachedStats, 100, { trailing: true });
|
|
41484
|
+
}
|
|
41485
|
+
filterInteractableAnnotationsForElement(element, annotations) {
|
|
41486
|
+
if (!annotations || !annotations.length) {
|
|
41487
|
+
return;
|
|
41488
|
+
}
|
|
41489
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
|
|
41490
|
+
const { viewport } = enabledElement;
|
|
41491
|
+
let annotationsToDisplay;
|
|
41492
|
+
if (viewport instanceof _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.VolumeViewport) {
|
|
41493
|
+
const camera = viewport.getCamera();
|
|
41494
|
+
const { spacingInNormalDirection } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.getTargetVolumeAndSpacingInNormalDir(viewport, camera);
|
|
41495
|
+
annotationsToDisplay = this.filterAnnotationsWithinSlice(annotations, camera, spacingInNormalDirection);
|
|
41496
|
+
}
|
|
41497
|
+
else {
|
|
41498
|
+
annotationsToDisplay = (0,_utilities_planar__WEBPACK_IMPORTED_MODULE_5__.filterAnnotationsForDisplay)(viewport, annotations);
|
|
41499
|
+
}
|
|
41500
|
+
return annotationsToDisplay;
|
|
41501
|
+
}
|
|
41502
|
+
filterAnnotationsWithinSlice(annotations, camera, spacingInNormalDirection) {
|
|
41503
|
+
const { viewPlaneNormal } = camera;
|
|
41504
|
+
const annotationsWithParallelNormals = annotations.filter((td) => {
|
|
41505
|
+
const annotationViewPlaneNormal = td.metadata.viewPlaneNormal;
|
|
41506
|
+
const isParallel = Math.abs(gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.dot */ .R3.dot(viewPlaneNormal, annotationViewPlaneNormal)) >
|
|
41507
|
+
PARALLEL_THRESHOLD;
|
|
41508
|
+
return annotationViewPlaneNormal && isParallel;
|
|
41509
|
+
});
|
|
41510
|
+
if (!annotationsWithParallelNormals.length) {
|
|
41511
|
+
return [];
|
|
41512
|
+
}
|
|
41513
|
+
const halfSpacingInNormalDirection = spacingInNormalDirection / 2;
|
|
41514
|
+
const { focalPoint } = camera;
|
|
41515
|
+
const annotationsWithinSlice = [];
|
|
41516
|
+
for (const annotation of annotationsWithParallelNormals) {
|
|
41517
|
+
const data = annotation.data;
|
|
41518
|
+
const point = data.contour.polyline[0];
|
|
41519
|
+
if (!annotation.isVisible) {
|
|
41520
|
+
continue;
|
|
41521
|
+
}
|
|
41522
|
+
const dir = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.create */ .R3.create();
|
|
41523
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.sub */ .R3.sub(dir, focalPoint, point);
|
|
41524
|
+
const dot = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.dot */ .R3.dot(dir, viewPlaneNormal);
|
|
41525
|
+
if (Math.abs(dot) < halfSpacingInNormalDirection) {
|
|
41526
|
+
annotationsWithinSlice.push(annotation);
|
|
41527
|
+
}
|
|
41528
|
+
}
|
|
41529
|
+
return annotationsWithinSlice;
|
|
41530
|
+
}
|
|
41531
|
+
isContourSegmentationTool() {
|
|
41532
|
+
return false;
|
|
41533
|
+
}
|
|
41534
|
+
createAnnotation(evt) {
|
|
41535
|
+
const worldPos = evt.detail.currentPoints.world;
|
|
41536
|
+
const contourAnnotation = super.createAnnotation(evt);
|
|
41537
|
+
const onInterpolationComplete = (annotation) => {
|
|
41538
|
+
annotation.data.handles.points.length = 0;
|
|
41539
|
+
};
|
|
41540
|
+
const annotation = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.deepMerge(contourAnnotation, {
|
|
41541
|
+
data: {
|
|
41542
|
+
contour: {
|
|
41543
|
+
polyline: [[...worldPos]],
|
|
41544
|
+
},
|
|
41545
|
+
label: '',
|
|
41546
|
+
cachedStats: {},
|
|
41547
|
+
},
|
|
41548
|
+
onInterpolationComplete,
|
|
41549
|
+
});
|
|
41550
|
+
return annotation;
|
|
41551
|
+
}
|
|
41552
|
+
getAnnotationStyle(context) {
|
|
41553
|
+
return super.getAnnotationStyle(context);
|
|
41554
|
+
}
|
|
41555
|
+
renderAnnotationInstance(renderContext) {
|
|
41556
|
+
const { enabledElement, targetId, svgDrawingHelper } = renderContext;
|
|
41557
|
+
const annotation = renderContext.annotation;
|
|
41558
|
+
let renderStatus = false;
|
|
41559
|
+
const { viewport, renderingEngine } = enabledElement;
|
|
41560
|
+
const isDrawing = this.isDrawing;
|
|
41561
|
+
const isEditingOpen = this.isEditingOpen;
|
|
41562
|
+
const isEditingClosed = this.isEditingClosed;
|
|
41563
|
+
if (!(isDrawing || isEditingOpen || isEditingClosed)) {
|
|
41564
|
+
if (this.configuration.displayOnePointAsCrosshairs &&
|
|
41565
|
+
annotation.data.contour.polyline.length === 1) {
|
|
41566
|
+
this.renderPointContourWithMarker(enabledElement, svgDrawingHelper, annotation);
|
|
41567
|
+
}
|
|
41568
|
+
else {
|
|
41569
|
+
this.renderContour(enabledElement, svgDrawingHelper, annotation);
|
|
41570
|
+
}
|
|
41571
|
+
}
|
|
41572
|
+
else {
|
|
41573
|
+
const activeAnnotationUID = this.commonData.annotation.annotationUID;
|
|
41574
|
+
if (annotation.annotationUID === activeAnnotationUID) {
|
|
41575
|
+
if (isDrawing) {
|
|
41576
|
+
this.renderContourBeingDrawn(enabledElement, svgDrawingHelper, annotation);
|
|
41577
|
+
}
|
|
41578
|
+
else if (isEditingClosed) {
|
|
41579
|
+
this.renderClosedContourBeingEdited(enabledElement, svgDrawingHelper, annotation);
|
|
41580
|
+
}
|
|
41581
|
+
else if (isEditingOpen) {
|
|
41582
|
+
this.renderOpenContourBeingEdited(enabledElement, svgDrawingHelper, annotation);
|
|
41583
|
+
}
|
|
41584
|
+
else {
|
|
41585
|
+
throw new Error(`Unknown ${this.getToolName()} annotation rendering state`);
|
|
41586
|
+
}
|
|
41587
|
+
}
|
|
41588
|
+
else {
|
|
41589
|
+
if (this.configuration.displayOnePointAsCrosshairs &&
|
|
41590
|
+
annotation.data.contour.polyline.length === 1) {
|
|
41591
|
+
this.renderPointContourWithMarker(enabledElement, svgDrawingHelper, annotation);
|
|
41592
|
+
}
|
|
41593
|
+
else {
|
|
41594
|
+
this.renderContour(enabledElement, svgDrawingHelper, annotation);
|
|
41595
|
+
}
|
|
41596
|
+
}
|
|
41597
|
+
renderStatus = true;
|
|
41598
|
+
}
|
|
41599
|
+
if (!this.configuration.calculateStats) {
|
|
41600
|
+
return;
|
|
41601
|
+
}
|
|
41602
|
+
this._calculateStatsIfActive(annotation, targetId, viewport, renderingEngine, enabledElement);
|
|
41603
|
+
this._renderStats(annotation, viewport, enabledElement, svgDrawingHelper);
|
|
41604
|
+
return renderStatus;
|
|
41605
|
+
}
|
|
41606
|
+
_calculateStatsIfActive(annotation, targetId, viewport, renderingEngine, enabledElement) {
|
|
41607
|
+
const activeAnnotationUID = this.commonData?.annotation.annotationUID;
|
|
41608
|
+
if (annotation.annotationUID === activeAnnotationUID &&
|
|
41609
|
+
!this.commonData?.movingTextBox) {
|
|
41610
|
+
return;
|
|
41611
|
+
}
|
|
41612
|
+
if (!this.commonData?.movingTextBox) {
|
|
41613
|
+
const { data } = annotation;
|
|
41614
|
+
if (!data.cachedStats[targetId] ||
|
|
41615
|
+
data.cachedStats[targetId].areaUnit == null) {
|
|
41616
|
+
data.cachedStats[targetId] = {
|
|
41617
|
+
Modality: null,
|
|
41618
|
+
area: null,
|
|
41619
|
+
max: null,
|
|
41620
|
+
mean: null,
|
|
41621
|
+
stdDev: null,
|
|
41622
|
+
areaUnit: null,
|
|
41623
|
+
};
|
|
41624
|
+
this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
|
|
41625
|
+
}
|
|
41626
|
+
else if (annotation.invalidated) {
|
|
41627
|
+
this._throttledCalculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
|
|
41628
|
+
}
|
|
41629
|
+
}
|
|
41630
|
+
}
|
|
41631
|
+
updateClosedCachedStats({ viewport, points, imageData, metadata, cachedStats, targetId, modalityUnit, canvasCoordinates, calibratedScale, }) {
|
|
41632
|
+
const { scale, areaUnits, units } = calibratedScale;
|
|
41633
|
+
const canvasPoint = canvasCoordinates[0];
|
|
41634
|
+
const originalWorldPoint = viewport.canvasToWorld(canvasPoint);
|
|
41635
|
+
const deltaXPoint = viewport.canvasToWorld([
|
|
41636
|
+
canvasPoint[0] + 1,
|
|
41637
|
+
canvasPoint[1],
|
|
41638
|
+
]);
|
|
41639
|
+
const deltaYPoint = viewport.canvasToWorld([
|
|
41640
|
+
canvasPoint[0],
|
|
41641
|
+
canvasPoint[1] + 1,
|
|
41642
|
+
]);
|
|
41643
|
+
const deltaInX = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.distance */ .R3.distance(originalWorldPoint, deltaXPoint);
|
|
41644
|
+
const deltaInY = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.distance */ .R3.distance(originalWorldPoint, deltaYPoint);
|
|
41645
|
+
const worldPosIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.transformWorldToIndex(imageData, points[0]);
|
|
41646
|
+
worldPosIndex[0] = Math.floor(worldPosIndex[0]);
|
|
41647
|
+
worldPosIndex[1] = Math.floor(worldPosIndex[1]);
|
|
41648
|
+
worldPosIndex[2] = Math.floor(worldPosIndex[2]);
|
|
41649
|
+
let iMin = worldPosIndex[0];
|
|
41650
|
+
let iMax = worldPosIndex[0];
|
|
41651
|
+
let jMin = worldPosIndex[1];
|
|
41652
|
+
let jMax = worldPosIndex[1];
|
|
41653
|
+
let kMin = worldPosIndex[2];
|
|
41654
|
+
let kMax = worldPosIndex[2];
|
|
41655
|
+
for (let j = 1; j < points.length; j++) {
|
|
41656
|
+
const worldPosIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.transformWorldToIndex(imageData, points[j]);
|
|
41657
|
+
worldPosIndex[0] = Math.floor(worldPosIndex[0]);
|
|
41658
|
+
worldPosIndex[1] = Math.floor(worldPosIndex[1]);
|
|
41659
|
+
worldPosIndex[2] = Math.floor(worldPosIndex[2]);
|
|
41660
|
+
iMin = Math.min(iMin, worldPosIndex[0]);
|
|
41661
|
+
iMax = Math.max(iMax, worldPosIndex[0]);
|
|
41662
|
+
jMin = Math.min(jMin, worldPosIndex[1]);
|
|
41663
|
+
jMax = Math.max(jMax, worldPosIndex[1]);
|
|
41664
|
+
kMin = Math.min(kMin, worldPosIndex[2]);
|
|
41665
|
+
kMax = Math.max(kMax, worldPosIndex[2]);
|
|
41666
|
+
}
|
|
41667
|
+
const worldPosIndex2 = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.transformWorldToIndex(imageData, points[1]);
|
|
41668
|
+
worldPosIndex2[0] = Math.floor(worldPosIndex2[0]);
|
|
41669
|
+
worldPosIndex2[1] = Math.floor(worldPosIndex2[1]);
|
|
41670
|
+
worldPosIndex2[2] = Math.floor(worldPosIndex2[2]);
|
|
41671
|
+
let area = _utilities_math__WEBPACK_IMPORTED_MODULE_4__.polyline.getArea(canvasCoordinates) / scale / scale;
|
|
41672
|
+
area *= deltaInX * deltaInY;
|
|
41673
|
+
const iDelta = 0.01 * (iMax - iMin);
|
|
41674
|
+
const jDelta = 0.01 * (jMax - jMin);
|
|
41675
|
+
const kDelta = 0.01 * (kMax - kMin);
|
|
41676
|
+
iMin = Math.floor(iMin - iDelta);
|
|
41677
|
+
iMax = Math.ceil(iMax + iDelta);
|
|
41678
|
+
jMin = Math.floor(jMin - jDelta);
|
|
41679
|
+
jMax = Math.ceil(jMax + jDelta);
|
|
41680
|
+
kMin = Math.floor(kMin - kDelta);
|
|
41681
|
+
kMax = Math.ceil(kMax + kDelta);
|
|
41682
|
+
const boundsIJK = [
|
|
41683
|
+
[iMin, iMax],
|
|
41684
|
+
[jMin, jMax],
|
|
41685
|
+
[kMin, kMax],
|
|
41686
|
+
];
|
|
41687
|
+
const worldPosEnd = imageData.indexToWorld([iMax, jMax, kMax]);
|
|
41688
|
+
const canvasPosEnd = viewport.worldToCanvas(worldPosEnd);
|
|
41689
|
+
let curRow = 0;
|
|
41690
|
+
let intersections = [];
|
|
41691
|
+
let intersectionCounter = 0;
|
|
41692
|
+
const pointsInShape = (0,_utilities_pointInShapeCallback__WEBPACK_IMPORTED_MODULE_19__/* ["default"] */ .Z)(imageData, (pointLPS, _pointIJK) => {
|
|
41693
|
+
let result = true;
|
|
41694
|
+
const point = viewport.worldToCanvas(pointLPS);
|
|
41695
|
+
if (point[1] != curRow) {
|
|
41696
|
+
intersectionCounter = 0;
|
|
41697
|
+
curRow = point[1];
|
|
41698
|
+
intersections = (0,_utilities_math_polyline__WEBPACK_IMPORTED_MODULE_18__.getLineSegmentIntersectionsCoordinates)(canvasCoordinates, point, [canvasPosEnd[0], point[1]]);
|
|
41699
|
+
intersections.sort((function (index) {
|
|
41700
|
+
return function (a, b) {
|
|
41701
|
+
return a[index] === b[index] ? 0 : a[index] < b[index] ? -1 : 1;
|
|
41702
|
+
};
|
|
41703
|
+
})(0));
|
|
41704
|
+
}
|
|
41705
|
+
if (intersections.length && point[0] > intersections[0][0]) {
|
|
41706
|
+
intersections.shift();
|
|
41707
|
+
intersectionCounter++;
|
|
41708
|
+
}
|
|
41709
|
+
if (intersectionCounter % 2 === 0) {
|
|
41710
|
+
result = false;
|
|
41711
|
+
}
|
|
41712
|
+
return result;
|
|
41713
|
+
}, this.configuration.statsCalculator.statsCallback, boundsIJK);
|
|
41714
|
+
const stats = this.configuration.statsCalculator.getStatistics();
|
|
41715
|
+
cachedStats[targetId] = {
|
|
41716
|
+
Modality: metadata.Modality,
|
|
41717
|
+
area,
|
|
41718
|
+
perimeter: (0,_utilities_contours_calculatePerimeter__WEBPACK_IMPORTED_MODULE_23__/* ["default"] */ .Z)(canvasCoordinates, closed) / scale,
|
|
41719
|
+
mean: stats.mean?.value,
|
|
41720
|
+
max: stats.max?.value,
|
|
41721
|
+
stdDev: stats.stdDev?.value,
|
|
41722
|
+
statsArray: stats.array,
|
|
41723
|
+
pointsInShape: pointsInShape,
|
|
41724
|
+
areaUnit: areaUnits,
|
|
41725
|
+
modalityUnit,
|
|
41726
|
+
unit: units,
|
|
41727
|
+
};
|
|
41728
|
+
}
|
|
41729
|
+
updateOpenCachedStats({ targetId, metadata, canvasCoordinates, cachedStats, modalityUnit, calibratedScale, }) {
|
|
41730
|
+
const { scale, units } = calibratedScale;
|
|
41731
|
+
cachedStats[targetId] = {
|
|
41732
|
+
Modality: metadata.Modality,
|
|
41733
|
+
length: (0,_utilities_contours_calculatePerimeter__WEBPACK_IMPORTED_MODULE_23__/* ["default"] */ .Z)(canvasCoordinates, false) / scale,
|
|
41734
|
+
modalityUnit,
|
|
41735
|
+
unit: units,
|
|
41736
|
+
};
|
|
41737
|
+
}
|
|
41738
|
+
}
|
|
41739
|
+
function defaultGetTextLines(data, targetId) {
|
|
41740
|
+
const cachedVolumeStats = data.cachedStats[targetId];
|
|
41741
|
+
const { area, mean, stdDev, length, perimeter, max, isEmptyArea, areaUnit, modalityUnit, unit, } = cachedVolumeStats || {};
|
|
41742
|
+
const textLines = [];
|
|
41743
|
+
if (area) {
|
|
41744
|
+
const areaLine = isEmptyArea
|
|
41745
|
+
? `Area: Oblique not supported`
|
|
41746
|
+
: `Area: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(area)} ${areaUnit}`;
|
|
41747
|
+
textLines.push(areaLine);
|
|
41748
|
+
}
|
|
41749
|
+
if (mean) {
|
|
41750
|
+
textLines.push(`Mean: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(mean)} ${modalityUnit}`);
|
|
41751
|
+
}
|
|
41752
|
+
if (Number.isFinite(max)) {
|
|
41753
|
+
textLines.push(`Max: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(max)} ${modalityUnit}`);
|
|
41754
|
+
}
|
|
41755
|
+
if (stdDev) {
|
|
41756
|
+
textLines.push(`Std Dev: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(stdDev)} ${modalityUnit}`);
|
|
41757
|
+
}
|
|
41758
|
+
if (perimeter) {
|
|
41759
|
+
textLines.push(`Perimeter: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(perimeter)} ${unit}`);
|
|
41760
|
+
}
|
|
41761
|
+
if (length) {
|
|
41762
|
+
textLines.push(`${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(length)} ${unit}`);
|
|
41763
|
+
}
|
|
41764
|
+
return textLines;
|
|
41765
|
+
}
|
|
41766
|
+
PlanarFreehandROITool.toolName = 'PlanarFreehandROI';
|
|
41767
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PlanarFreehandROITool);
|
|
41768
|
+
|
|
41769
|
+
|
|
41007
41770
|
/***/ }),
|
|
41008
41771
|
|
|
41009
41772
|
/***/ 86479:
|