@ohif/app 3.12.0-beta.51 → 3.12.0-beta.53

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.
Files changed (38) hide show
  1. package/dist/{1447.bundle.5a1088b96287322077d3.js → 1447.bundle.ec55b67e67336fc21395.js} +2 -2
  2. package/dist/{1919.bundle.622ab896344341db2f9f.js → 1919.bundle.4e6bd406f3e744fac297.js} +1 -0
  3. package/dist/{2243.bundle.af44cd927c03758b4c97.js → 2243.bundle.d37af11011d841506650.js} +1 -0
  4. package/dist/{2518.bundle.fbbfa351f8e8c446599b.js → 2518.bundle.57c229a14e22d23db384.js} +1 -0
  5. package/dist/{2974.bundle.ec95e58b346dbe30a362.js → 2974.bundle.a90a9df917b90bc02c69.js} +1 -0
  6. package/dist/{3409.bundle.7f2c0aa09b9c7cee426f.js → 3409.bundle.fdd66303b88b09df1755.js} +17 -3
  7. package/dist/{4019.bundle.c5b332003e3cd00868ce.js → 4019.bundle.13e7f662a9e489b74a27.js} +70 -3
  8. package/dist/{4759.bundle.8686abdd7bcf4aa7d107.js → 4759.bundle.c3bfca952eea20a0d6f9.js} +1 -0
  9. package/dist/{5674.bundle.24de237ef15879b25714.js → 5674.bundle.8c34228471ff9e53b8c3.js} +1 -0
  10. package/dist/{6991.bundle.ec24b54411f7b4dc0177.js → 6991.bundle.80eea6ff61dba94b2879.js} +1 -0
  11. package/dist/{7412.bundle.80f68b38041e891c64a8.js → 7412.bundle.42d0b84eb71e17deea44.js} +274 -81
  12. package/dist/{8558.bundle.2caf031c15e039ae2042.js → 8558.bundle.7b39c27e2bd32e4a18aa.js} +1 -0
  13. package/dist/{934.bundle.f92e0ae8cfa22002cfd3.js → 934.bundle.f62759c74362ecd45046.js} +1 -0
  14. package/dist/{9819.bundle.f9a684737e748002f1c2.js → 9819.bundle.cb36094b2dbfe6332e89.js} +16 -6
  15. package/dist/{9856.bundle.8e21e8c0322a0837862b.js → 9856.bundle.9a1396fddc3af67dcaf4.js} +169 -14
  16. package/dist/{9892.bundle.83de6c11c8a9eb4bba25.js → 9892.bundle.f00828c8f4763b097271.js} +258 -76
  17. package/dist/{app.bundle.df967f42ddcf9619bd44.js → app.bundle.b5c364b2112dc6c8fef1.js} +11 -4
  18. package/dist/{compute.bundle.f176731b761d630f358c.js → compute.bundle.957cf6f00e6c9f033f51.js} +1 -1
  19. package/dist/index.html +1 -1
  20. package/dist/{polySeg.bundle.1ab7dd310985596b4098.js → polySeg.bundle.99fe77d122f62107b12e.js} +1 -1
  21. package/dist/sw.js +1 -1
  22. package/package.json +21 -21
  23. /package/dist/{1459.bundle.eeacd4e6da0fc344dfcd.js → 1459.bundle.9803b32f90cade8bbab5.js} +0 -0
  24. /package/dist/{1604.bundle.3dc0cd2ccf35dfa63ba1.js → 1604.bundle.82b3545ba77291673ab0.js} +0 -0
  25. /package/dist/{1807.bundle.c2d36c1f288f09a734fc.js → 1807.bundle.52567533b273a2581fe6.js} +0 -0
  26. /package/dist/{213.bundle.af06e5ce084e8db26658.js → 213.bundle.32923830428c6ce36969.js} +0 -0
  27. /package/dist/{2424.bundle.93803c3f4882f0851ca0.js → 2424.bundle.c757e549b61768f3907f.js} +0 -0
  28. /package/dist/{4113.bundle.1c72d6483e68e546e7e0.js → 4113.bundle.8aa17598a438e0f59977.js} +0 -0
  29. /package/dist/{414.bundle.cf6764ad6422c89a9297.js → 414.bundle.2812dfdd9dcbf5ec54f4.js} +0 -0
  30. /package/dist/{5457.bundle.fc718746ee48701d41f4.js → 5457.bundle.a34aefc642710f3c4bfe.js} +0 -0
  31. /package/dist/{5485.bundle.efd8d3c757bfb22c08a5.js → 5485.bundle.6a30e022e40ee4efcf64.js} +0 -0
  32. /package/dist/{6027.bundle.b94597fe89fce75fa2a3.js → 6027.bundle.13ce9445760aecded831.js} +0 -0
  33. /package/dist/{6201.bundle.bd0f51e826019999bb52.js → 6201.bundle.1449ec26ca43420a516a.js} +0 -0
  34. /package/dist/{7197.bundle.23ffb246152ca8264fcb.js → 7197.bundle.20b8564f4a4af9191bef.js} +0 -0
  35. /package/dist/{7639.bundle.5f43cfb9cbbc030d354d.js → 7639.bundle.6988d6e467128811633c.js} +0 -0
  36. /package/dist/{810.bundle.a801043c780ff73eac0d.js → 810.bundle.c1486b31c437a41ef7ce.js} +0 -0
  37. /package/dist/{85.bundle.48cf95a2d411ad282fad.js → 85.bundle.a84605c91fb325b762dd.js} +0 -0
  38. /package/dist/{8815.bundle.71f52a3c5792000b4a8a.js → 8815.bundle.9531838f1288ab88a108.js} +0 -0
@@ -3348,9 +3348,11 @@ class FrameOfReferenceSpecificAnnotationManager {
3348
3348
  }
3349
3349
  if (toolName) {
3350
3350
  const annotationsForTool = annotations[groupKey][toolName];
3351
- for (const annotation of annotationsForTool) {
3352
- this.removeAnnotation(annotation.annotationUID);
3353
- removedAnnotations.push(annotation);
3351
+ if (annotationsForTool) {
3352
+ for (const annotation of annotationsForTool) {
3353
+ this.removeAnnotation(annotation.annotationUID);
3354
+ removedAnnotations.push(annotation);
3355
+ }
3354
3356
  }
3355
3357
  }
3356
3358
  else {
@@ -21442,68 +21444,79 @@ class EllipticalROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .Annotation
21442
21444
  pos1Index[0] = Math.floor(pos1Index[0]);
21443
21445
  pos1Index[1] = Math.floor(pos1Index[1]);
21444
21446
  pos1Index[2] = Math.floor(pos1Index[2]);
21445
- const post2Index = transformWorldToIndex(imageData, worldPos2);
21446
- post2Index[0] = Math.floor(post2Index[0]);
21447
- post2Index[1] = Math.floor(post2Index[1]);
21448
- post2Index[2] = Math.floor(post2Index[2]);
21449
- this.isHandleOutsideImage = !this._isInsideVolume(pos1Index, post2Index, dimensions);
21450
- const iMin = Math.min(pos1Index[0], post2Index[0]);
21451
- const iMax = Math.max(pos1Index[0], post2Index[0]);
21452
- const jMin = Math.min(pos1Index[1], post2Index[1]);
21453
- const jMax = Math.max(pos1Index[1], post2Index[1]);
21454
- const kMin = Math.min(pos1Index[2], post2Index[2]);
21455
- const kMax = Math.max(pos1Index[2], post2Index[2]);
21456
- const boundsIJK = [
21457
- [iMin, iMax],
21458
- [jMin, jMax],
21459
- [kMin, kMax],
21460
- ];
21461
- const center = [
21462
- (topLeftWorld[0] + bottomRightWorld[0]) / 2,
21463
- (topLeftWorld[1] + bottomRightWorld[1]) / 2,
21464
- (topLeftWorld[2] + bottomRightWorld[2]) / 2,
21465
- ];
21466
- const ellipseObj = {
21467
- center,
21468
- xRadius: Math.abs(topLeftWorld[0] - bottomRightWorld[0]) / 2,
21469
- yRadius: Math.abs(topLeftWorld[1] - bottomRightWorld[1]) / 2,
21470
- zRadius: Math.abs(topLeftWorld[2] - bottomRightWorld[2]) / 2,
21471
- };
21472
- const { worldWidth, worldHeight } = (0,_utilities_planar_getWorldWidthAndHeightFromTwoPoints__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .A)(viewPlaneNormal, viewUp, worldPos1, worldPos2);
21473
- const isEmptyArea = worldWidth === 0 && worldHeight === 0;
21474
- const handles = [pos1Index, post2Index];
21475
- const { scale, areaUnit } = (0,_utilities_getCalibratedUnits__WEBPACK_IMPORTED_MODULE_2__/* .getCalibratedLengthUnitsAndScale */ .Op)(image, handles);
21476
- const area = Math.abs(Math.PI * (worldWidth / 2) * (worldHeight / 2)) /
21477
- scale /
21478
- scale;
21479
- const pixelUnitsOptions = {
21480
- isPreScaled: (0,_utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_18__/* .isViewportPreScaled */ .u)(viewport, targetId),
21481
- isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
21482
- };
21483
- const modalityUnit = (0,_utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_17__/* .getPixelValueUnits */ .j)(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
21484
- let pointsInShape;
21485
- if (voxelManager) {
21486
- const pointsInShape = voxelManager.forEach(this.configuration.statsCalculator.statsCallback, {
21487
- boundsIJK,
21488
- imageData,
21489
- isInObject: (pointLPS) => (0,_utilities_math_ellipse__WEBPACK_IMPORTED_MODULE_14__.pointInEllipse)(ellipseObj, pointLPS, { fast: true }),
21490
- returnPoints: this.configuration.storePointData,
21491
- });
21447
+ const pos2Index = transformWorldToIndex(imageData, worldPos2);
21448
+ pos2Index[0] = Math.floor(pos2Index[0]);
21449
+ pos2Index[1] = Math.floor(pos2Index[1]);
21450
+ pos2Index[2] = Math.floor(pos2Index[2]);
21451
+ if (this._isInsideVolume(pos1Index, pos2Index, dimensions)) {
21452
+ const iMin = Math.min(pos1Index[0], pos2Index[0]);
21453
+ const iMax = Math.max(pos1Index[0], pos2Index[0]);
21454
+ const jMin = Math.min(pos1Index[1], pos2Index[1]);
21455
+ const jMax = Math.max(pos1Index[1], pos2Index[1]);
21456
+ const kMin = Math.min(pos1Index[2], pos2Index[2]);
21457
+ const kMax = Math.max(pos1Index[2], pos2Index[2]);
21458
+ const boundsIJK = [
21459
+ [iMin, iMax],
21460
+ [jMin, jMax],
21461
+ [kMin, kMax],
21462
+ ];
21463
+ const center = [
21464
+ (topLeftWorld[0] + bottomRightWorld[0]) / 2,
21465
+ (topLeftWorld[1] + bottomRightWorld[1]) / 2,
21466
+ (topLeftWorld[2] + bottomRightWorld[2]) / 2,
21467
+ ];
21468
+ const xRadius = Math.abs(topLeftWorld[0] - bottomRightWorld[0]) / 2;
21469
+ const yRadius = Math.abs(topLeftWorld[1] - bottomRightWorld[1]) / 2;
21470
+ const zRadius = Math.abs(topLeftWorld[2] - bottomRightWorld[2]) / 2;
21471
+ const ellipseObj = {
21472
+ center,
21473
+ xRadius: xRadius < _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.EPSILON / 2 ? 0 : xRadius,
21474
+ yRadius: yRadius < _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.EPSILON / 2 ? 0 : yRadius,
21475
+ zRadius: zRadius < _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.EPSILON / 2 ? 0 : zRadius,
21476
+ };
21477
+ const { worldWidth, worldHeight } = (0,_utilities_planar_getWorldWidthAndHeightFromTwoPoints__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .A)(viewPlaneNormal, viewUp, worldPos1, worldPos2);
21478
+ const isEmptyArea = worldWidth === 0 && worldHeight === 0;
21479
+ const handles = [pos1Index, pos2Index];
21480
+ const { scale, unit, areaUnit } = (0,_utilities_getCalibratedUnits__WEBPACK_IMPORTED_MODULE_2__/* .getCalibratedLengthUnitsAndScale */ .Op)(image, handles);
21481
+ const aspect = (0,_utilities_getCalibratedUnits__WEBPACK_IMPORTED_MODULE_2__/* .getCalibratedAspect */ .CQ)(image);
21482
+ const area = Math.abs(Math.PI *
21483
+ (worldWidth / scale / 2) *
21484
+ (worldHeight / aspect / scale / 2));
21485
+ const pixelUnitsOptions = {
21486
+ isPreScaled: (0,_utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_18__/* .isViewportPreScaled */ .u)(viewport, targetId),
21487
+ isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
21488
+ };
21489
+ const modalityUnit = (0,_utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_17__/* .getPixelValueUnits */ .j)(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
21490
+ let pointsInShape;
21491
+ if (voxelManager) {
21492
+ pointsInShape = voxelManager.forEach(this.configuration.statsCalculator.statsCallback, {
21493
+ isInObject: (pointLPS) => (0,_utilities_math_ellipse__WEBPACK_IMPORTED_MODULE_14__.pointInEllipse)(ellipseObj, pointLPS, { fast: true }),
21494
+ boundsIJK,
21495
+ imageData,
21496
+ returnPoints: this.configuration.storePointData,
21497
+ });
21498
+ }
21499
+ const stats = this.configuration.statsCalculator.getStatistics();
21500
+ cachedStats[targetId] = {
21501
+ Modality: metadata.Modality,
21502
+ area,
21503
+ mean: stats.mean?.value,
21504
+ max: stats.max?.value,
21505
+ min: stats.min?.value,
21506
+ stdDev: stats.stdDev?.value,
21507
+ statsArray: stats.array,
21508
+ pointsInShape,
21509
+ isEmptyArea,
21510
+ areaUnit,
21511
+ modalityUnit,
21512
+ };
21513
+ }
21514
+ else {
21515
+ this.isHandleOutsideImage = true;
21516
+ cachedStats[targetId] = {
21517
+ Modality: metadata.Modality,
21518
+ };
21492
21519
  }
21493
- const stats = this.configuration.statsCalculator.getStatistics();
21494
- cachedStats[targetId] = {
21495
- Modality: metadata.Modality,
21496
- area,
21497
- mean: stats.mean?.value,
21498
- max: stats.max?.value,
21499
- min: stats.min?.value,
21500
- stdDev: stats.stdDev?.value,
21501
- statsArray: stats.array,
21502
- pointsInShape,
21503
- isEmptyArea,
21504
- areaUnit,
21505
- modalityUnit,
21506
- };
21507
21520
  }
21508
21521
  const invalidated = annotation.invalidated;
21509
21522
  annotation.invalidated = false;
@@ -29996,6 +30009,7 @@ class BrushTool extends _LabelmapBaseTool__WEBPACK_IMPORTED_MODULE_10__/* ["defa
29996
30009
  },
29997
30010
  }) {
29998
30011
  super(toolProps, defaultToolProps);
30012
+ this._lastDragInfo = null;
29999
30013
  this.onSetToolPassive = (evt) => {
30000
30014
  this.disableCursor();
30001
30015
  };
@@ -30007,14 +30021,24 @@ class BrushTool extends _LabelmapBaseTool__WEBPACK_IMPORTED_MODULE_10__/* ["defa
30007
30021
  };
30008
30022
  this.preMouseDownCallback = (evt) => {
30009
30023
  const eventData = evt.detail;
30010
- const { element } = eventData;
30024
+ const { element, currentPoints } = eventData;
30011
30025
  const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
30026
+ const { viewport } = enabledElement;
30012
30027
  this._editData = this.createEditData(element);
30013
30028
  this._activateDraw(element);
30014
30029
  (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_8__.hideElementCursor)(element);
30015
30030
  evt.preventDefault();
30016
30031
  this._previewData.isDrag = false;
30017
30032
  this._previewData.timerStart = Date.now();
30033
+ const canvasPoint = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec2.clone */ .Zc.clone(currentPoints.canvas);
30034
+ const worldPoint = viewport.canvasToWorld([
30035
+ canvasPoint[0],
30036
+ canvasPoint[1],
30037
+ ]);
30038
+ this._lastDragInfo = {
30039
+ canvas: canvasPoint,
30040
+ world: gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.clone */ .eR.clone(worldPoint),
30041
+ };
30018
30042
  const hoverData = this._hoverData || this.createHoverData(element);
30019
30043
  (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .A)(hoverData.viewportIdsToRender);
30020
30044
  const operationData = this.getOperationData(element);
@@ -30089,6 +30113,7 @@ class BrushTool extends _LabelmapBaseTool__WEBPACK_IMPORTED_MODULE_10__/* ["defa
30089
30113
  const eventData = evt.detail;
30090
30114
  const { element, currentPoints } = eventData;
30091
30115
  const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
30116
+ const { viewport } = enabledElement;
30092
30117
  this.updateCursor(evt);
30093
30118
  const { viewportIdsToRender } = this._hoverData;
30094
30119
  (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .A)(viewportIdsToRender);
@@ -30103,11 +30128,39 @@ class BrushTool extends _LabelmapBaseTool__WEBPACK_IMPORTED_MODULE_10__/* ["defa
30103
30128
  window.clearTimeout(this._previewData.timer);
30104
30129
  this._previewData.timer = null;
30105
30130
  }
30106
- this._previewData.preview = this.applyActiveStrategy(enabledElement, this.getOperationData(element));
30131
+ if (!this._lastDragInfo) {
30132
+ const startCanvas = this._previewData.startPoint;
30133
+ const startWorld = viewport.canvasToWorld([
30134
+ startCanvas[0],
30135
+ startCanvas[1],
30136
+ ]);
30137
+ this._lastDragInfo = {
30138
+ canvas: gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec2.clone */ .Zc.clone(startCanvas),
30139
+ world: gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.clone */ .eR.clone(startWorld),
30140
+ };
30141
+ }
30142
+ const currentCanvas = currentPoints.canvas;
30143
+ const currentWorld = viewport.canvasToWorld([
30144
+ currentCanvas[0],
30145
+ currentCanvas[1],
30146
+ ]);
30147
+ this._hoverData = this.createHoverData(element, currentCanvas);
30148
+ this._calculateCursor(element, currentCanvas);
30149
+ const operationData = this.getOperationData(element);
30150
+ operationData.strokePointsWorld = [
30151
+ gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.clone */ .eR.clone(this._lastDragInfo.world),
30152
+ gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.clone */ .eR.clone(currentWorld),
30153
+ ];
30154
+ this._previewData.preview = this.applyActiveStrategy(enabledElement, operationData);
30155
+ const currentCanvasClone = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec2.clone */ .Zc.clone(currentCanvas);
30156
+ this._lastDragInfo = {
30157
+ canvas: currentCanvasClone,
30158
+ world: gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.clone */ .eR.clone(currentWorld),
30159
+ };
30107
30160
  this._previewData.element = element;
30108
30161
  this._previewData.timerStart = Date.now() + dragTimeMs;
30109
30162
  this._previewData.isDrag = true;
30110
- this._previewData.startPoint = currentPoints.canvas;
30163
+ this._previewData.startPoint = currentCanvasClone;
30111
30164
  };
30112
30165
  this._endCallback = (evt) => {
30113
30166
  const eventData = evt.detail;
@@ -30122,6 +30175,7 @@ class BrushTool extends _LabelmapBaseTool__WEBPACK_IMPORTED_MODULE_10__/* ["defa
30122
30175
  (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_8__.resetElementCursor)(element);
30123
30176
  this.updateCursor(evt);
30124
30177
  this._editData = null;
30178
+ this._lastDragInfo = null;
30125
30179
  this.applyActiveStrategyCallback(enabledElement, operationData, _enums__WEBPACK_IMPORTED_MODULE_2__.StrategyCallbacks.OnInteractionEnd);
30126
30180
  if (!this._previewData.isDrag) {
30127
30181
  this.acceptPreview(element);
@@ -33307,7 +33361,7 @@ SphereScissorsTool.toolName = 'SphereScissor';
33307
33361
  /* harmony export */ pB: () => (/* binding */ CIRCLE_STRATEGY),
33308
33362
  /* harmony export */ q: () => (/* binding */ thresholdInsideCircle)
33309
33363
  /* harmony export */ });
33310
- /* unused harmony export CIRCLE_THRESHOLD_STRATEGY */
33364
+ /* unused harmony exports CIRCLE_THRESHOLD_STRATEGY, createPointInEllipse */
33311
33365
  /* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3823);
33312
33366
  /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15327);
33313
33367
  /* harmony import */ var _utilities_boundingBox__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(72282);
@@ -33322,7 +33376,7 @@ SphereScissorsTool.toolName = 'SphereScissor';
33322
33376
 
33323
33377
 
33324
33378
 
33325
- const { transformWorldToIndex, isEqual } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities;
33379
+ const { transformWorldToIndex, transformIndexToWorld, isEqual } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities;
33326
33380
  function getEllipseCornersFromCanvasCoordinates(canvasCoordinates) {
33327
33381
  const [bottom, top, left, right] = canvasCoordinates;
33328
33382
  const topLeft = [left[0], top[1]];
@@ -33331,9 +33385,82 @@ function getEllipseCornersFromCanvasCoordinates(canvasCoordinates) {
33331
33385
  const topRight = [right[0], top[1]];
33332
33386
  return [topLeft, bottomRight, bottomLeft, topRight];
33333
33387
  }
33388
+ function createCircleCornersForCenter(center, viewUp, viewRight, radius) {
33389
+ const centerVec = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.fromValues */ .eR.fromValues(center[0], center[1], center[2]);
33390
+ const top = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
33391
+ gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.scaleAndAdd */ .eR.scaleAndAdd(top, centerVec, viewUp, radius);
33392
+ const bottom = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
33393
+ gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.scaleAndAdd */ .eR.scaleAndAdd(bottom, centerVec, viewUp, -radius);
33394
+ const right = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
33395
+ gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.scaleAndAdd */ .eR.scaleAndAdd(right, centerVec, viewRight, radius);
33396
+ const left = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
33397
+ gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.scaleAndAdd */ .eR.scaleAndAdd(left, centerVec, viewRight, -radius);
33398
+ return [
33399
+ bottom,
33400
+ top,
33401
+ left,
33402
+ right,
33403
+ ];
33404
+ }
33405
+ function createStrokePredicate(centers, radius) {
33406
+ if (!centers.length || radius <= 0) {
33407
+ return null;
33408
+ }
33409
+ const radiusSquared = radius * radius;
33410
+ const centerVecs = centers.map((point) => [point[0], point[1], point[2]]);
33411
+ const segments = [];
33412
+ for (let i = 1; i < centerVecs.length; i++) {
33413
+ const start = centerVecs[i - 1];
33414
+ const end = centerVecs[i];
33415
+ const dx = end[0] - start[0];
33416
+ const dy = end[1] - start[1];
33417
+ const dz = end[2] - start[2];
33418
+ const lengthSquared = dx * dx + dy * dy + dz * dz;
33419
+ segments.push({ start, vector: [dx, dy, dz], lengthSquared });
33420
+ }
33421
+ return (worldPoint) => {
33422
+ if (!worldPoint) {
33423
+ return false;
33424
+ }
33425
+ for (const centerVec of centerVecs) {
33426
+ const dx = worldPoint[0] - centerVec[0];
33427
+ const dy = worldPoint[1] - centerVec[1];
33428
+ const dz = worldPoint[2] - centerVec[2];
33429
+ if (dx * dx + dy * dy + dz * dz <= radiusSquared) {
33430
+ return true;
33431
+ }
33432
+ }
33433
+ for (const { start, vector, lengthSquared } of segments) {
33434
+ if (lengthSquared === 0) {
33435
+ const dx = worldPoint[0] - start[0];
33436
+ const dy = worldPoint[1] - start[1];
33437
+ const dz = worldPoint[2] - start[2];
33438
+ if (dx * dx + dy * dy + dz * dz <= radiusSquared) {
33439
+ return true;
33440
+ }
33441
+ continue;
33442
+ }
33443
+ const dx = worldPoint[0] - start[0];
33444
+ const dy = worldPoint[1] - start[1];
33445
+ const dz = worldPoint[2] - start[2];
33446
+ const dot = dx * vector[0] + dy * vector[1] + dz * vector[2];
33447
+ const t = Math.max(0, Math.min(1, dot / lengthSquared));
33448
+ const projX = start[0] + vector[0] * t;
33449
+ const projY = start[1] + vector[1] * t;
33450
+ const projZ = start[2] + vector[2] * t;
33451
+ const distX = worldPoint[0] - projX;
33452
+ const distY = worldPoint[1] - projY;
33453
+ const distZ = worldPoint[2] - projZ;
33454
+ if (distX * distX + distY * distY + distZ * distZ <= radiusSquared) {
33455
+ return true;
33456
+ }
33457
+ }
33458
+ return false;
33459
+ };
33460
+ }
33334
33461
  const initializeCircle = {
33335
33462
  [_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Initialize]: (operationData) => {
33336
- const { points, viewport, segmentationImageData, } = operationData;
33463
+ const { points, viewport, segmentationImageData, viewUp, viewPlaneNormal, } = operationData;
33337
33464
  if (!points) {
33338
33465
  return;
33339
33466
  }
@@ -33347,18 +33474,35 @@ const initializeCircle = {
33347
33474
  }
33348
33475
  operationData.centerWorld = center;
33349
33476
  operationData.centerIJK = transformWorldToIndex(segmentationImageData, center);
33477
+ const brushRadius = points.length >= 2 ? gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.distance */ .eR.distance(points[0], points[1]) / 2 : 0;
33350
33478
  const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
33351
33479
  const corners = getEllipseCornersFromCanvasCoordinates(canvasCoordinates);
33352
33480
  const cornersInWorld = corners.map((corner) => viewport.canvasToWorld(corner));
33353
- const circleCornersIJK = points.map((world) => {
33354
- return transformWorldToIndex(segmentationImageData, world);
33355
- });
33481
+ const normalizedViewUp = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.fromValues */ .eR.fromValues(viewUp[0], viewUp[1], viewUp[2]);
33482
+ gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.normalize */ .eR.normalize(normalizedViewUp, normalizedViewUp);
33483
+ const normalizedPlaneNormal = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.fromValues */ .eR.fromValues(viewPlaneNormal[0], viewPlaneNormal[1], viewPlaneNormal[2]);
33484
+ gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.normalize */ .eR.normalize(normalizedPlaneNormal, normalizedPlaneNormal);
33485
+ const viewRight = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
33486
+ gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.cross */ .eR.cross(viewRight, normalizedViewUp, normalizedPlaneNormal);
33487
+ gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.normalize */ .eR.normalize(viewRight, viewRight);
33488
+ const strokeCentersSource = operationData.strokePointsWorld &&
33489
+ operationData.strokePointsWorld.length > 0
33490
+ ? operationData.strokePointsWorld
33491
+ : [operationData.centerWorld];
33492
+ const strokeCenters = strokeCentersSource.map((point) => gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.clone */ .eR.clone(point));
33493
+ const strokeCornersWorld = strokeCenters.flatMap((centerPoint) => createCircleCornersForCenter(centerPoint, normalizedViewUp, viewRight, brushRadius));
33494
+ const circleCornersIJK = strokeCornersWorld.map((world) => transformWorldToIndex(segmentationImageData, world));
33356
33495
  const boundsIJK = (0,_utilities_boundingBox__WEBPACK_IMPORTED_MODULE_2__.getBoundingBoxAroundShapeIJK)(circleCornersIJK, segmentationImageData.getDimensions());
33357
- operationData.isInObject = createPointInEllipse(cornersInWorld);
33496
+ operationData.strokePointsWorld = strokeCenters;
33497
+ operationData.isInObject = createPointInEllipse(cornersInWorld, {
33498
+ strokePointsWorld: strokeCenters,
33499
+ segmentationImageData,
33500
+ radius: brushRadius,
33501
+ });
33358
33502
  operationData.isInObjectBoundsIJK = boundsIJK;
33359
33503
  },
33360
33504
  };
33361
- function createPointInEllipse(cornersInWorld = []) {
33505
+ function createPointInEllipse(cornersInWorld = [], options = {}) {
33362
33506
  if (!cornersInWorld || cornersInWorld.length !== 4) {
33363
33507
  throw new Error('createPointInEllipse: cornersInWorld must have 4 points');
33364
33508
  }
@@ -33377,6 +33521,8 @@ function createPointInEllipse(cornersInWorld = []) {
33377
33521
  const normal = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
33378
33522
  gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.cross */ .eR.cross(normal, majorAxisVec, minorAxisVec);
33379
33523
  gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.normalize */ .eR.normalize(normal, normal);
33524
+ const radiusForStroke = options.radius ?? Math.max(xRadius, yRadius);
33525
+ const strokePredicate = createStrokePredicate(options.strokePointsWorld || [], radiusForStroke);
33380
33526
  if (isEqual(xRadius, yRadius)) {
33381
33527
  const radius = xRadius;
33382
33528
  const sphereObj = {
@@ -33384,11 +33530,33 @@ function createPointInEllipse(cornersInWorld = []) {
33384
33530
  radius,
33385
33531
  radius2: radius * radius,
33386
33532
  };
33387
- return (pointLPS) => (0,_utilities_math_sphere__WEBPACK_IMPORTED_MODULE_6__/* .pointInSphere */ .d)(sphereObj, pointLPS);
33533
+ return (pointLPS, pointIJK) => {
33534
+ let worldPoint = pointLPS;
33535
+ if (!worldPoint && pointIJK && options.segmentationImageData) {
33536
+ worldPoint = transformIndexToWorld(options.segmentationImageData, pointIJK);
33537
+ }
33538
+ if (!worldPoint) {
33539
+ return false;
33540
+ }
33541
+ if (strokePredicate?.(worldPoint)) {
33542
+ return true;
33543
+ }
33544
+ return (0,_utilities_math_sphere__WEBPACK_IMPORTED_MODULE_6__/* .pointInSphere */ .d)(sphereObj, worldPoint);
33545
+ };
33388
33546
  }
33389
- return (pointLPS) => {
33547
+ return (pointLPS, pointIJK) => {
33548
+ let worldPoint = pointLPS;
33549
+ if (!worldPoint && pointIJK && options.segmentationImageData) {
33550
+ worldPoint = transformIndexToWorld(options.segmentationImageData, pointIJK);
33551
+ }
33552
+ if (!worldPoint) {
33553
+ return false;
33554
+ }
33555
+ if (strokePredicate?.(worldPoint)) {
33556
+ return true;
33557
+ }
33390
33558
  const pointVec = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
33391
- gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.subtract */ .eR.subtract(pointVec, pointLPS, center);
33559
+ gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.subtract */ .eR.subtract(pointVec, worldPoint, center);
33392
33560
  const distToPlane = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dot */ .eR.dot(pointVec, normal);
33393
33561
  const proj = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
33394
33562
  gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.scaleAndAdd */ .eR.scaleAndAdd(proj, pointVec, normal, -distToPlane);
@@ -35075,14 +35243,21 @@ function addSegmentInSegmentation(segmentation, { segmentIndex, label, color })
35075
35243
  if (!segmentation?.segments) {
35076
35244
  return;
35077
35245
  }
35078
- segmentation.segments[segmentIndex] = {
35246
+ const segmentData = segmentation.segments[segmentIndex] ?? {
35079
35247
  active: false,
35080
35248
  locked: false,
35081
- label,
35082
35249
  segmentIndex,
35083
35250
  cachedStats: {},
35251
+ label,
35084
35252
  color,
35085
35253
  };
35254
+ if (label !== undefined) {
35255
+ segmentData.label = label;
35256
+ }
35257
+ if (color !== undefined) {
35258
+ segmentData.color = color;
35259
+ }
35260
+ segmentation.segments[segmentIndex] = segmentData;
35086
35261
  }
35087
35262
  function removeAnnotations(annotationUIDList) {
35088
35263
  annotationUIDList.forEach((annotationUID) => {
@@ -42353,6 +42528,8 @@ function setAnnotationLabel(annotation, element, updatedLabel) {
42353
42528
  /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
42354
42529
  /* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(30045);
42355
42530
  /* harmony import */ var _stackPrefetchUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(94762);
42531
+ /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99737);
42532
+
42356
42533
 
42357
42534
 
42358
42535
 
@@ -42460,6 +42637,13 @@ function prefetch(element, priority = 0) {
42460
42637
  }
42461
42638
  }
42462
42639
  }
42640
+ if (stackPrefetch.indicesToRequest.length === 0) {
42641
+ const eventDetail = {
42642
+ element: element,
42643
+ lastPrefetchedImageId: imageId,
42644
+ };
42645
+ (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.triggerEvent)(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.eventTarget, _enums__WEBPACK_IMPORTED_MODULE_3__.Events.STACK_PREFETCH_COMPLETE, eventDetail);
42646
+ }
42463
42647
  }
42464
42648
  const requestFn = (imageId, options) => {
42465
42649
  const { retrieveOptions = {} } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.metaData.get(imageRetrieveMetadataProvider.IMAGE_RETRIEVE_CONFIGURATION, imageId, 'stack') || {};
@@ -42597,6 +42781,8 @@ const stackContextPrefetch = {
42597
42781
  /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
42598
42782
  /* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(30045);
42599
42783
  /* harmony import */ var _stackPrefetchUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(94762);
42784
+ /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99737);
42785
+
42600
42786
 
42601
42787
 
42602
42788
 
@@ -42659,6 +42845,13 @@ function prefetch(element) {
42659
42845
  console.log('prefetch done: %s', imageId);
42660
42846
  const imageIdIndex = stack.imageIds.indexOf(imageId);
42661
42847
  removeFromList(imageIdIndex);
42848
+ if (stackPrefetch.indicesToRequest.length === 0) {
42849
+ const eventDetail = {
42850
+ element: element,
42851
+ lastPrefetchedImageId: imageId,
42852
+ };
42853
+ (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.triggerEvent)(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.eventTarget, _enums__WEBPACK_IMPORTED_MODULE_3__.Events.STACK_PREFETCH_COMPLETE, eventDetail);
42854
+ }
42662
42855
  }
42663
42856
  let lowerIndex = nearest.low;
42664
42857
  let higherIndex = nearest.high;
@@ -43798,7 +43991,7 @@ __webpack_require__.r(__webpack_exports__);
43798
43991
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
43799
43992
  /* harmony export */ r: () => (/* binding */ version)
43800
43993
  /* harmony export */ });
43801
- const version = '4.3.14';
43994
+ const version = '4.5.1';
43802
43995
 
43803
43996
 
43804
43997
  /***/ }),
@@ -39,6 +39,7 @@ var Events;
39
39
  Events["CROSSHAIR_TOOL_CENTER_CHANGED"] = "CORNERSTONE_TOOLS_CROSSHAIR_TOOL_CENTER_CHANGED";
40
40
  Events["VOLUMECROPPINGCONTROL_TOOL_CHANGED"] = "CORNERSTONE_TOOLS_VOLUMECROPPINGCONTROL_TOOL_CHANGED";
41
41
  Events["VOLUMECROPPING_TOOL_CHANGED"] = "CORNERSTONE_TOOLS_VOLUMECROPPING_TOOL_CHANGED";
42
+ Events["STACK_PREFETCH_COMPLETE"] = "CORNERSTONE_TOOLS_STACK_PREFETCH_COMPLETE";
42
43
  Events["ANNOTATION_ADDED"] = "CORNERSTONE_TOOLS_ANNOTATION_ADDED";
43
44
  Events["ANNOTATION_COMPLETED"] = "CORNERSTONE_TOOLS_ANNOTATION_COMPLETED";
44
45
  Events["ANNOTATION_MODIFIED"] = "CORNERSTONE_TOOLS_ANNOTATION_MODIFIED";
@@ -39,6 +39,7 @@ var Events;
39
39
  Events["CROSSHAIR_TOOL_CENTER_CHANGED"] = "CORNERSTONE_TOOLS_CROSSHAIR_TOOL_CENTER_CHANGED";
40
40
  Events["VOLUMECROPPINGCONTROL_TOOL_CHANGED"] = "CORNERSTONE_TOOLS_VOLUMECROPPINGCONTROL_TOOL_CHANGED";
41
41
  Events["VOLUMECROPPING_TOOL_CHANGED"] = "CORNERSTONE_TOOLS_VOLUMECROPPING_TOOL_CHANGED";
42
+ Events["STACK_PREFETCH_COMPLETE"] = "CORNERSTONE_TOOLS_STACK_PREFETCH_COMPLETE";
42
43
  Events["ANNOTATION_ADDED"] = "CORNERSTONE_TOOLS_ANNOTATION_ADDED";
43
44
  Events["ANNOTATION_COMPLETED"] = "CORNERSTONE_TOOLS_ANNOTATION_COMPLETED";
44
45
  Events["ANNOTATION_MODIFIED"] = "CORNERSTONE_TOOLS_ANNOTATION_MODIFIED";
@@ -34390,7 +34390,7 @@ function uuidv4() {
34390
34390
 
34391
34391
  "use strict";
34392
34392
  /* unused harmony export version */
34393
- const version = '4.3.14';
34393
+ const version = '4.5.1';
34394
34394
 
34395
34395
 
34396
34396
  /***/ }),
@@ -35706,6 +35706,7 @@ var Events;
35706
35706
  Events["CROSSHAIR_TOOL_CENTER_CHANGED"] = "CORNERSTONE_TOOLS_CROSSHAIR_TOOL_CENTER_CHANGED";
35707
35707
  Events["VOLUMECROPPINGCONTROL_TOOL_CHANGED"] = "CORNERSTONE_TOOLS_VOLUMECROPPINGCONTROL_TOOL_CHANGED";
35708
35708
  Events["VOLUMECROPPING_TOOL_CHANGED"] = "CORNERSTONE_TOOLS_VOLUMECROPPING_TOOL_CHANGED";
35709
+ Events["STACK_PREFETCH_COMPLETE"] = "CORNERSTONE_TOOLS_STACK_PREFETCH_COMPLETE";
35709
35710
  Events["ANNOTATION_ADDED"] = "CORNERSTONE_TOOLS_ANNOTATION_ADDED";
35710
35711
  Events["ANNOTATION_COMPLETED"] = "CORNERSTONE_TOOLS_ANNOTATION_COMPLETED";
35711
35712
  Events["ANNOTATION_MODIFIED"] = "CORNERSTONE_TOOLS_ANNOTATION_MODIFIED";
@@ -36190,9 +36191,11 @@ class FrameOfReferenceSpecificAnnotationManager {
36190
36191
  }
36191
36192
  if (toolName) {
36192
36193
  const annotationsForTool = annotations[groupKey][toolName];
36193
- for (const annotation of annotationsForTool) {
36194
- this.removeAnnotation(annotation.annotationUID);
36195
- removedAnnotations.push(annotation);
36194
+ if (annotationsForTool) {
36195
+ for (const annotation of annotationsForTool) {
36196
+ this.removeAnnotation(annotation.annotationUID);
36197
+ removedAnnotations.push(annotation);
36198
+ }
36196
36199
  }
36197
36200
  }
36198
36201
  else {
@@ -40302,14 +40305,21 @@ function addSegmentInSegmentation(segmentation, { segmentIndex, label, color })
40302
40305
  if (!segmentation?.segments) {
40303
40306
  return;
40304
40307
  }
40305
- segmentation.segments[segmentIndex] = {
40308
+ const segmentData = segmentation.segments[segmentIndex] ?? {
40306
40309
  active: false,
40307
40310
  locked: false,
40308
- label,
40309
40311
  segmentIndex,
40310
40312
  cachedStats: {},
40313
+ label,
40311
40314
  color,
40312
40315
  };
40316
+ if (label !== undefined) {
40317
+ segmentData.label = label;
40318
+ }
40319
+ if (color !== undefined) {
40320
+ segmentData.color = color;
40321
+ }
40322
+ segmentation.segments[segmentIndex] = segmentData;
40313
40323
  }
40314
40324
  function removeAnnotations(annotationUIDList) {
40315
40325
  annotationUIDList.forEach((annotationUID) => {