@ohif/app 3.7.0-beta.76 → 3.7.0-beta.79

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 (29) hide show
  1. package/dist/{181.bundle.9406be756cfb7968981c.js → 181.bundle.9a76ce585a7139d4862f.js} +2 -2
  2. package/dist/{202.bundle.591726b6144882ba0ee0.js → 202.bundle.6c3b5e9f37d88388e5c8.js} +48 -26
  3. package/dist/{663.bundle.5f6a9a71e8fdee0d5da9.js → 663.bundle.5175469e25c5196a739c.js} +4 -4
  4. package/dist/{754.bundle.a5c9246c77659eab2739.js → 754.bundle.6618bdd7f648b532c682.js} +28 -18
  5. package/dist/{774.bundle.8ba82ee206266eb2da5e.js → 774.bundle.d365320749c4f67cda70.js} +3 -1
  6. package/dist/{116.bundle.422d1a76d8daccfed61d.js → 777.bundle.82a7cc23a7b6a8bd12fa.js} +293 -106
  7. package/dist/{782.bundle.20e1aa2f1c0903efc2fe.js → 782.bundle.6fa60a24d3d4ad76c8db.js} +2 -2
  8. package/dist/{822.bundle.9a70e6c61f931d0b494d.js → 822.bundle.4767349eb43b79145b3e.js} +1 -1
  9. package/dist/{90.bundle.0e621511eacf50e25ee1.js → 90.bundle.1d113c4a201e850c98c0.js} +2 -2
  10. package/dist/{967.bundle.32d7f93b760d631656bf.js → 967.bundle.ab062b0b325bed3b9af9.js} +20 -4
  11. package/dist/app-config.js +29 -7
  12. package/dist/{app.bundle.8321c057672fddbf0da9.js → app.bundle.adf312c193d56262fa41.js} +10 -9
  13. package/dist/cornerstoneDICOMImageLoader.min.js +1 -1
  14. package/dist/cornerstoneDICOMImageLoader.min.js.map +1 -1
  15. package/dist/index.html +1 -1
  16. package/dist/sw.js +1 -1
  17. package/package.json +19 -19
  18. /package/dist/{12.bundle.668282ed26b78e3e4c33.js → 12.bundle.653904a1682368c34d6b.js} +0 -0
  19. /package/dist/{128.bundle.4e2f1ae2879aa1cbcdb3.js → 128.bundle.d4536952e6eda267cb5a.js} +0 -0
  20. /package/dist/{150.bundle.43ac548529f4e634a360.js → 150.bundle.1fff6b0c3496b6367f58.js} +0 -0
  21. /package/dist/{236.bundle.6ac2c27409fa0e52d49d.js → 236.bundle.2386ed58739fdbdd53f8.js} +0 -0
  22. /package/dist/{281.bundle.92216171e8e6063ff66e.js → 281.bundle.fbb8c83b343a6903d529.js} +0 -0
  23. /package/dist/{30.bundle.e689bac63754d8cd9ff2.js → 30.bundle.16bfc3a374fc4eda5ffc.js} +0 -0
  24. /package/dist/{348.bundle.1158677feb3e6d1ae17e.js → 348.bundle.343c39a8c96a044b0fe2.js} +0 -0
  25. /package/dist/{359.bundle.e0202e557f647e26c4b9.js → 359.bundle.2618db789083f7d3007d.js} +0 -0
  26. /package/dist/{410.bundle.4a14d984222133e1e374.js → 410.bundle.5cc4909f3c608350a71e.js} +0 -0
  27. /package/dist/{506.bundle.1a335265c2c481aa86d3.js → 506.bundle.c0258b1d7299fdb7628e.js} +0 -0
  28. /package/dist/{687.bundle.3ad091baeb9590c99f57.js → 687.bundle.60d3856e6e77c027c174.js} +0 -0
  29. /package/dist/{814.bundle.5904972d21f19c945ad4.js → 814.bundle.ba4f6267b43f8dbc803f.js} +0 -0
@@ -1,6 +1,6 @@
1
- (self["webpackChunk"] = self["webpackChunk"] || []).push([[116],{
1
+ (self["webpackChunk"] = self["webpackChunk"] || []).push([[777],{
2
2
 
3
- /***/ 99116:
3
+ /***/ 99777:
4
4
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5
5
 
6
6
  "use strict";
@@ -3112,6 +3112,9 @@ async function addLabelmapToElement(element, volumeId, segmentationRepresentatio
3112
3112
  function removeLabelmapFromElement(element, segmentationRepresentationUID, removeFromCache = false) {
3113
3113
  const enabledElement = (0,esm.getEnabledElement)(element);
3114
3114
  const { viewport } = enabledElement;
3115
+ if (viewport instanceof esm.StackViewport) {
3116
+ return;
3117
+ }
3115
3118
  viewport.removeVolumeActors([
3116
3119
  segmentationRepresentationUID,
3117
3120
  ]);
@@ -4511,12 +4514,14 @@ function setNewAttributesIfValid(attributes, svgNode) {
4511
4514
 
4512
4515
 
4513
4516
  function drawCircle(svgDrawingHelper, annotationUID, circleUID, center, radius, options = {}, dataId = '') {
4514
- const { color, fill, width, lineWidth, lineDash } = Object.assign({
4517
+ const { color, fill, width, lineWidth, lineDash, fillOpacity, strokeOpacity, } = Object.assign({
4515
4518
  color: 'dodgerblue',
4516
4519
  fill: 'transparent',
4517
4520
  width: '2',
4518
4521
  lineDash: undefined,
4519
4522
  lineWidth: undefined,
4523
+ strokeOpacity: 1,
4524
+ fillOpacity: 1,
4520
4525
  }, options);
4521
4526
  const strokeWidth = lineWidth || width;
4522
4527
  const svgns = 'http://www.w3.org/2000/svg';
@@ -4530,6 +4535,8 @@ function drawCircle(svgDrawingHelper, annotationUID, circleUID, center, radius,
4530
4535
  fill,
4531
4536
  'stroke-width': strokeWidth,
4532
4537
  'stroke-dasharray': lineDash,
4538
+ 'fill-opacity': fillOpacity,
4539
+ 'stroke-opacity': strokeOpacity,
4533
4540
  };
4534
4541
  if (existingCircleElement) {
4535
4542
  drawingSvg_setAttributesIfNecessary(attributes, existingCircleElement);
@@ -5268,6 +5275,7 @@ class ToolStyle {
5268
5275
  lineWidth: '1',
5269
5276
  lineDash: '',
5270
5277
  shadow: true,
5278
+ textBoxVisibility: true,
5271
5279
  textBoxFontFamily: 'Helvetica Neue, Helvetica, Arial, sans-serif',
5272
5280
  textBoxFontSize: '14px',
5273
5281
  textBoxColor: 'rgb(255, 255, 0)',
@@ -5558,20 +5566,22 @@ class AnnotationTool extends base_AnnotationDisplayTool {
5558
5566
  const { viewport } = enabledElement;
5559
5567
  const { data } = annotation;
5560
5568
  const { points, textBox } = data.handles;
5561
- const { worldBoundingBox } = textBox;
5562
- if (worldBoundingBox) {
5563
- const canvasBoundingBox = {
5564
- topLeft: viewport.worldToCanvas(worldBoundingBox.topLeft),
5565
- topRight: viewport.worldToCanvas(worldBoundingBox.topRight),
5566
- bottomLeft: viewport.worldToCanvas(worldBoundingBox.bottomLeft),
5567
- bottomRight: viewport.worldToCanvas(worldBoundingBox.bottomRight),
5568
- };
5569
- if (canvasCoords[0] >= canvasBoundingBox.topLeft[0] &&
5570
- canvasCoords[0] <= canvasBoundingBox.bottomRight[0] &&
5571
- canvasCoords[1] >= canvasBoundingBox.topLeft[1] &&
5572
- canvasCoords[1] <= canvasBoundingBox.bottomRight[1]) {
5573
- data.handles.activeHandleIndex = null;
5574
- return textBox;
5569
+ if (textBox) {
5570
+ const { worldBoundingBox } = textBox;
5571
+ if (worldBoundingBox) {
5572
+ const canvasBoundingBox = {
5573
+ topLeft: viewport.worldToCanvas(worldBoundingBox.topLeft),
5574
+ topRight: viewport.worldToCanvas(worldBoundingBox.topRight),
5575
+ bottomLeft: viewport.worldToCanvas(worldBoundingBox.bottomLeft),
5576
+ bottomRight: viewport.worldToCanvas(worldBoundingBox.bottomRight),
5577
+ };
5578
+ if (canvasCoords[0] >= canvasBoundingBox.topLeft[0] &&
5579
+ canvasCoords[0] <= canvasBoundingBox.bottomRight[0] &&
5580
+ canvasCoords[1] >= canvasBoundingBox.topLeft[1] &&
5581
+ canvasCoords[1] <= canvasBoundingBox.bottomRight[1]) {
5582
+ data.handles.activeHandleIndex = null;
5583
+ return textBox;
5584
+ }
5575
5585
  }
5576
5586
  }
5577
5587
  for (let i = 0; i < points.length; i++) {
@@ -5587,6 +5597,7 @@ class AnnotationTool extends base_AnnotationDisplayTool {
5587
5597
  }
5588
5598
  getLinkedTextBoxStyle(specifications, annotation) {
5589
5599
  return {
5600
+ visibility: this.getStyle('textBoxVisibility', specifications, annotation),
5590
5601
  fontFamily: this.getStyle('textBoxFontFamily', specifications, annotation),
5591
5602
  fontSize: this.getStyle('textBoxFontSize', specifications, annotation),
5592
5603
  color: this.getStyle('textBoxColor', specifications, annotation),
@@ -5664,13 +5675,12 @@ class SegmentationDisplayTool extends base_BaseTool {
5664
5675
  const segmentationRenderList = toolGroupSegmentationRepresentations.map((representation) => {
5665
5676
  const config = this._getMergedRepresentationsConfig(toolGroupId);
5666
5677
  const viewportsRenderList = [];
5678
+ const display = representation.type === enums_SegmentationRepresentations.Labelmap
5679
+ ? labelmapDisplay
5680
+ : contourDisplay;
5667
5681
  for (const viewport of toolGroupViewports) {
5668
- if (representation.type == enums_SegmentationRepresentations.Labelmap) {
5669
- viewportsRenderList.push(labelmapDisplay.render(viewport, representation, config));
5670
- }
5671
- else if (representation.type == enums_SegmentationRepresentations.Contour) {
5672
- viewportsRenderList.push(contourDisplay.render(viewport, representation, config));
5673
- }
5682
+ const renderedViewport = display.render(viewport, representation, config);
5683
+ viewportsRenderList.push(renderedViewport);
5674
5684
  }
5675
5685
  return viewportsRenderList;
5676
5686
  });
@@ -6459,22 +6469,47 @@ function roundNumber(value, precision = 2) {
6459
6469
  }
6460
6470
  /* harmony default export */ const utilities_roundNumber = (roundNumber);
6461
6471
 
6472
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/strategies/utils/isWithinThreshold.js
6473
+ function isWithinThreshold(index, imageVolume, strategySpecificConfiguration) {
6474
+ const { THRESHOLD_INSIDE_CIRCLE } = strategySpecificConfiguration;
6475
+ const voxelValue = imageVolume.getScalarData()[index];
6476
+ const { threshold } = THRESHOLD_INSIDE_CIRCLE;
6477
+ return threshold[0] <= voxelValue && voxelValue <= threshold[1];
6478
+ }
6479
+ /* harmony default export */ const utils_isWithinThreshold = (isWithinThreshold);
6480
+
6462
6481
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/strategies/fillSphere.js
6463
6482
 
6464
6483
 
6465
- function fillSphere(enabledElement, operationData, _inside = true) {
6484
+
6485
+
6486
+ function fillSphere(enabledElement, operationData, _inside = true, threshold = false) {
6466
6487
  const { viewport } = enabledElement;
6467
- const { volume: segmentation, segmentsLocked, segmentIndex, segmentationId, points, } = operationData;
6488
+ const { volume: segmentation, segmentsLocked, segmentIndex, imageVolume, strategySpecificConfiguration, segmentationId, points, } = operationData;
6468
6489
  const { imageData, dimensions } = segmentation;
6469
6490
  const scalarData = segmentation.getScalarData();
6470
6491
  const scalarIndex = [];
6471
- const callback = ({ index, value }) => {
6472
- if (segmentsLocked.includes(value)) {
6473
- return;
6474
- }
6475
- scalarData[index] = segmentIndex;
6476
- scalarIndex.push(index);
6477
- };
6492
+ let callback;
6493
+ if (threshold) {
6494
+ callback = ({ value, index, pointIJK }) => {
6495
+ if (segmentsLocked.includes(value)) {
6496
+ return;
6497
+ }
6498
+ if (utils_isWithinThreshold(index, imageVolume, strategySpecificConfiguration)) {
6499
+ scalarData[index] = segmentIndex;
6500
+ scalarIndex.push(index);
6501
+ }
6502
+ };
6503
+ }
6504
+ else {
6505
+ callback = ({ index, value }) => {
6506
+ if (segmentsLocked.includes(value)) {
6507
+ return;
6508
+ }
6509
+ scalarData[index] = segmentIndex;
6510
+ scalarIndex.push(index);
6511
+ };
6512
+ }
6478
6513
  pointInSurroundingSphereCallback(imageData, [points[0], points[1]], callback, viewport);
6479
6514
  const zMultiple = dimensions[0] * dimensions[1];
6480
6515
  const minSlice = Math.floor(scalarIndex[0] / zMultiple);
@@ -6485,6 +6520,14 @@ function fillSphere(enabledElement, operationData, _inside = true) {
6485
6520
  function fillInsideSphere(enabledElement, operationData) {
6486
6521
  fillSphere(enabledElement, operationData, true);
6487
6522
  }
6523
+ function thresholdInsideSphere(enabledElement, operationData) {
6524
+ const { volume, imageVolume } = operationData;
6525
+ if (!esm.utilities.isEqual(volume.dimensions, imageVolume.dimensions) ||
6526
+ !esm.utilities.isEqual(volume.direction, imageVolume.direction)) {
6527
+ throw new Error('Only source data the same dimensions/size/orientation as the segmentation currently supported.');
6528
+ }
6529
+ fillSphere(enabledElement, operationData, true, true);
6530
+ }
6488
6531
  function fillOutsideSphere(enabledElement, operationData) {
6489
6532
  fillSphere(enabledElement, operationData, false);
6490
6533
  }
@@ -6536,6 +6579,7 @@ function getCanvasEllipseCorners(ellipseCanvasPoints) {
6536
6579
 
6537
6580
 
6538
6581
 
6582
+
6539
6583
  const { transformWorldToIndex: fillCircle_transformWorldToIndex } = esm.utilities;
6540
6584
  function fillCircle(enabledElement, operationData, threshold = false) {
6541
6585
  const { volume: segmentationVolume, imageVolume, points, segmentsLocked, segmentIndex, segmentationId, strategySpecificConfiguration, } = operationData;
@@ -6569,7 +6613,7 @@ function fillCircle(enabledElement, operationData, threshold = false) {
6569
6613
  if (segmentsLocked.includes(value)) {
6570
6614
  return;
6571
6615
  }
6572
- if (isWithinThreshold(index, imageVolume, strategySpecificConfiguration)) {
6616
+ if (utils_isWithinThreshold(index, imageVolume, strategySpecificConfiguration)) {
6573
6617
  scalarData[index] = segmentIndex;
6574
6618
  modifiedSlicesToUse.add(pointIJK[2]);
6575
6619
  }
@@ -6588,12 +6632,6 @@ function fillCircle(enabledElement, operationData, threshold = false) {
6588
6632
  const arrayOfSlices = Array.from(modifiedSlicesToUse);
6589
6633
  triggerSegmentationDataModified(segmentationId, arrayOfSlices);
6590
6634
  }
6591
- function isWithinThreshold(index, imageVolume, strategySpecificConfiguration) {
6592
- const { THRESHOLD_INSIDE_CIRCLE } = strategySpecificConfiguration;
6593
- const voxelValue = imageVolume.getScalarData()[index];
6594
- const { threshold } = THRESHOLD_INSIDE_CIRCLE;
6595
- return threshold[0] <= voxelValue && voxelValue <= threshold[1];
6596
- }
6597
6635
  function fillInsideCircle(enabledElement, operationData) {
6598
6636
  fillCircle(enabledElement, operationData, false);
6599
6637
  }
@@ -7281,16 +7319,18 @@ function _getElementCursors(element) {
7281
7319
 
7282
7320
 
7283
7321
 
7322
+
7284
7323
  class BrushTool extends base_BaseTool {
7285
7324
  constructor(toolProps = {}, defaultToolProps = {
7286
7325
  supportedInteractionTypes: ['Mouse', 'Touch'],
7287
7326
  configuration: {
7288
7327
  strategies: {
7289
7328
  FILL_INSIDE_CIRCLE: fillInsideCircle,
7290
- THRESHOLD_INSIDE_CIRCLE: thresholdInsideCircle,
7291
7329
  ERASE_INSIDE_CIRCLE: eraseInsideCircle,
7292
7330
  FILL_INSIDE_SPHERE: fillInsideSphere,
7293
7331
  ERASE_INSIDE_SPHERE: eraseInsideSphere,
7332
+ THRESHOLD_INSIDE_CIRCLE: thresholdInsideCircle,
7333
+ THRESHOLD_INSIDE_SPHERE: thresholdInsideSphere,
7294
7334
  },
7295
7335
  strategySpecificConfiguration: {
7296
7336
  THRESHOLD_INSIDE_CIRCLE: {
@@ -7467,31 +7507,36 @@ class BrushTool extends base_BaseTool {
7467
7507
  const enabledElement = (0,esm.getEnabledElement)(element);
7468
7508
  const { viewport } = enabledElement;
7469
7509
  const { canvasToWorld } = viewport;
7510
+ const camera = viewport.getCamera();
7470
7511
  const { brushSize } = this.configuration;
7471
- const radius = brushSize;
7472
- const bottomCanvas = [
7512
+ const viewUp = gl_matrix_esm/* vec3.fromValues */.R3.fromValues(camera.viewUp[0], camera.viewUp[1], camera.viewUp[2]);
7513
+ const viewPlaneNormal = gl_matrix_esm/* vec3.fromValues */.R3.fromValues(camera.viewPlaneNormal[0], camera.viewPlaneNormal[1], camera.viewPlaneNormal[2]);
7514
+ const viewRight = gl_matrix_esm/* vec3.create */.R3.create();
7515
+ gl_matrix_esm/* vec3.cross */.R3.cross(viewRight, viewUp, viewPlaneNormal);
7516
+ const centerCursorInWorld = canvasToWorld([
7473
7517
  centerCanvas[0],
7474
- centerCanvas[1] + radius,
7475
- ];
7476
- const topCanvas = [centerCanvas[0], centerCanvas[1] - radius];
7477
- const leftCanvas = [
7478
- centerCanvas[0] - radius,
7479
- centerCanvas[1],
7480
- ];
7481
- const rightCanvas = [
7482
- centerCanvas[0] + radius,
7483
7518
  centerCanvas[1],
7484
- ];
7519
+ ]);
7520
+ const bottomCursorInWorld = gl_matrix_esm/* vec3.create */.R3.create();
7521
+ const topCursorInWorld = gl_matrix_esm/* vec3.create */.R3.create();
7522
+ const leftCursorInWorld = gl_matrix_esm/* vec3.create */.R3.create();
7523
+ const rightCursorInWorld = gl_matrix_esm/* vec3.create */.R3.create();
7524
+ for (let i = 0; i <= 2; i++) {
7525
+ bottomCursorInWorld[i] = centerCursorInWorld[i] - viewUp[i] * brushSize;
7526
+ topCursorInWorld[i] = centerCursorInWorld[i] + viewUp[i] * brushSize;
7527
+ leftCursorInWorld[i] = centerCursorInWorld[i] - viewRight[i] * brushSize;
7528
+ rightCursorInWorld[i] = centerCursorInWorld[i] + viewRight[i] * brushSize;
7529
+ }
7485
7530
  const { brushCursor } = this._hoverData;
7486
7531
  const { data } = brushCursor;
7487
7532
  if (data.handles === undefined) {
7488
7533
  data.handles = {};
7489
7534
  }
7490
7535
  data.handles.points = [
7491
- canvasToWorld(bottomCanvas),
7492
- canvasToWorld(topCanvas),
7493
- canvasToWorld(leftCanvas),
7494
- canvasToWorld(rightCanvas),
7536
+ bottomCursorInWorld,
7537
+ topCursorInWorld,
7538
+ leftCursorInWorld,
7539
+ rightCursorInWorld,
7495
7540
  ];
7496
7541
  data.invalidated = false;
7497
7542
  }
@@ -7547,7 +7592,7 @@ BrushTool.toolName = 'Brush';
7547
7592
 
7548
7593
 
7549
7594
 
7550
- function getBrushToolInstances(toolGroupId) {
7595
+ function getBrushToolInstances(toolGroupId, toolName) {
7551
7596
  const toolGroup = ToolGroupManager_getToolGroup(toolGroupId);
7552
7597
  if (toolGroup === undefined) {
7553
7598
  return;
@@ -7556,6 +7601,9 @@ function getBrushToolInstances(toolGroupId) {
7556
7601
  if (!Object.keys(toolInstances).length) {
7557
7602
  return;
7558
7603
  }
7604
+ if (toolName && toolInstances[toolName]) {
7605
+ return [toolInstances[toolName]];
7606
+ }
7559
7607
  const brushBasedToolInstances = Object.values(toolInstances).filter((toolInstance) => toolInstance instanceof segmentation_BrushTool);
7560
7608
  return brushBasedToolInstances;
7561
7609
  }
@@ -11181,6 +11229,20 @@ class BidirectionalTool extends base_AnnotationTool {
11181
11229
  shadow,
11182
11230
  }, dataId2);
11183
11231
  renderStatus = true;
11232
+ const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
11233
+ if (!options.visibility) {
11234
+ data.handles.textBox = {
11235
+ hasMoved: false,
11236
+ worldPosition: [0, 0, 0],
11237
+ worldBoundingBox: {
11238
+ topLeft: [0, 0, 0],
11239
+ topRight: [0, 0, 0],
11240
+ bottomLeft: [0, 0, 0],
11241
+ bottomRight: [0, 0, 0],
11242
+ },
11243
+ };
11244
+ continue;
11245
+ }
11184
11246
  const textLines = this.configuration.getTextLines(data, targetId);
11185
11247
  if (!textLines || textLines.length === 0) {
11186
11248
  continue;
@@ -11193,7 +11255,7 @@ class BidirectionalTool extends base_AnnotationTool {
11193
11255
  }
11194
11256
  const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
11195
11257
  const textBoxUID = '1';
11196
- const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, this.getLinkedTextBoxStyle(styleSpecifier, annotation));
11258
+ const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
11197
11259
  const { x: left, y: top, width, height } = boundingBox;
11198
11260
  data.handles.textBox.worldBoundingBox = {
11199
11261
  topLeft: viewport.canvasToWorld([left, top]),
@@ -11682,6 +11744,20 @@ class LengthTool extends base_AnnotationTool {
11682
11744
  console.warn('Rendering Engine has been destroyed');
11683
11745
  return renderStatus;
11684
11746
  }
11747
+ const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
11748
+ if (!options.visibility) {
11749
+ data.handles.textBox = {
11750
+ hasMoved: false,
11751
+ worldPosition: [0, 0, 0],
11752
+ worldBoundingBox: {
11753
+ topLeft: [0, 0, 0],
11754
+ topRight: [0, 0, 0],
11755
+ bottomLeft: [0, 0, 0],
11756
+ bottomRight: [0, 0, 0],
11757
+ },
11758
+ };
11759
+ continue;
11760
+ }
11685
11761
  const textLines = this.configuration.getTextLines(data, targetId);
11686
11762
  if (!data.handles.textBox.hasMoved) {
11687
11763
  const canvasTextBoxCoords = getTextBoxCoordsCanvas(canvasCoordinates);
@@ -11690,7 +11766,7 @@ class LengthTool extends base_AnnotationTool {
11690
11766
  }
11691
11767
  const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
11692
11768
  const textBoxUID = '1';
11693
- const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, this.getLinkedTextBoxStyle(styleSpecifier, annotation));
11769
+ const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
11694
11770
  const { x: left, y: top, width, height } = boundingBox;
11695
11771
  data.handles.textBox.worldBoundingBox = {
11696
11772
  topLeft: viewport.canvasToWorld([left, top]),
@@ -12044,6 +12120,10 @@ class ProbeTool extends base_AnnotationTool {
12044
12120
  const handleGroupUID = '0';
12045
12121
  drawingSvg_drawHandles(svgDrawingHelper, annotationUID, handleGroupUID, [canvasCoordinates], { color });
12046
12122
  renderStatus = true;
12123
+ const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
12124
+ if (!options.visibility) {
12125
+ continue;
12126
+ }
12047
12127
  const textLines = this.configuration.getTextLines(data, targetId);
12048
12128
  if (textLines) {
12049
12129
  const textCanvasCoordinates = [
@@ -12051,7 +12131,7 @@ class ProbeTool extends base_AnnotationTool {
12051
12131
  canvasCoordinates[1] - 6,
12052
12132
  ];
12053
12133
  const textUID = '0';
12054
- drawingSvg_drawTextBox(svgDrawingHelper, annotationUID, textUID, textLines, [textCanvasCoordinates[0], textCanvasCoordinates[1]], this.getLinkedTextBoxStyle(styleSpecifier, annotation));
12134
+ drawingSvg_drawTextBox(svgDrawingHelper, annotationUID, textUID, textLines, [textCanvasCoordinates[0], textCanvasCoordinates[1]], options);
12055
12135
  }
12056
12136
  }
12057
12137
  return renderStatus;
@@ -12808,6 +12888,20 @@ class RectangleROITool extends base_AnnotationTool {
12808
12888
  lineWidth,
12809
12889
  }, dataId);
12810
12890
  renderStatus = true;
12891
+ const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
12892
+ if (!options.visibility) {
12893
+ data.handles.textBox = {
12894
+ hasMoved: false,
12895
+ worldPosition: [0, 0, 0],
12896
+ worldBoundingBox: {
12897
+ topLeft: [0, 0, 0],
12898
+ topRight: [0, 0, 0],
12899
+ bottomLeft: [0, 0, 0],
12900
+ bottomRight: [0, 0, 0],
12901
+ },
12902
+ };
12903
+ continue;
12904
+ }
12811
12905
  const textLines = this.configuration.getTextLines(data, targetId);
12812
12906
  if (!textLines || textLines.length === 0) {
12813
12907
  continue;
@@ -12819,7 +12913,7 @@ class RectangleROITool extends base_AnnotationTool {
12819
12913
  }
12820
12914
  const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
12821
12915
  const textBoxUID = '1';
12822
- const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, this.getLinkedTextBoxStyle(styleSpecifier, annotation));
12916
+ const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
12823
12917
  const { x: left, y: top, width, height } = boundingBox;
12824
12918
  data.handles.textBox.worldBoundingBox = {
12825
12919
  topLeft: viewport.canvasToWorld([left, top]),
@@ -13473,6 +13567,20 @@ class EllipticalROITool extends base_AnnotationTool {
13473
13567
  }
13474
13568
  }
13475
13569
  renderStatus = true;
13570
+ const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
13571
+ if (!options.visibility) {
13572
+ data.handles.textBox = {
13573
+ hasMoved: false,
13574
+ worldPosition: [0, 0, 0],
13575
+ worldBoundingBox: {
13576
+ topLeft: [0, 0, 0],
13577
+ topRight: [0, 0, 0],
13578
+ bottomLeft: [0, 0, 0],
13579
+ bottomRight: [0, 0, 0],
13580
+ },
13581
+ };
13582
+ continue;
13583
+ }
13476
13584
  const textLines = this.configuration.getTextLines(data, targetId);
13477
13585
  if (!textLines || textLines.length === 0) {
13478
13586
  continue;
@@ -13485,7 +13593,7 @@ class EllipticalROITool extends base_AnnotationTool {
13485
13593
  }
13486
13594
  const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
13487
13595
  const textBoxUID = '1';
13488
- const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, this.getLinkedTextBoxStyle(styleSpecifier, annotation));
13596
+ const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
13489
13597
  const { x: left, y: top, width, height } = boundingBox;
13490
13598
  data.handles.textBox.worldBoundingBox = {
13491
13599
  topLeft: viewport.canvasToWorld([left, top]),
@@ -14108,6 +14216,20 @@ class CircleROITool extends base_AnnotationTool {
14108
14216
  }
14109
14217
  }
14110
14218
  renderStatus = true;
14219
+ const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
14220
+ if (!options.visibility) {
14221
+ data.handles.textBox = {
14222
+ hasMoved: false,
14223
+ worldPosition: [0, 0, 0],
14224
+ worldBoundingBox: {
14225
+ topLeft: [0, 0, 0],
14226
+ topRight: [0, 0, 0],
14227
+ bottomLeft: [0, 0, 0],
14228
+ bottomRight: [0, 0, 0],
14229
+ },
14230
+ };
14231
+ continue;
14232
+ }
14111
14233
  const textLines = this.configuration.getTextLines(data, targetId);
14112
14234
  if (!textLines || textLines.length === 0) {
14113
14235
  continue;
@@ -14120,7 +14242,7 @@ class CircleROITool extends base_AnnotationTool {
14120
14242
  }
14121
14243
  const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
14122
14244
  const textBoxUID = '1';
14123
- const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, this.getLinkedTextBoxStyle(styleSpecifier, annotation));
14245
+ const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
14124
14246
  const { x: left, y: top, width, height } = boundingBox;
14125
14247
  data.handles.textBox.worldBoundingBox = {
14126
14248
  topLeft: viewport.canvasToWorld([left, top]),
@@ -16338,6 +16460,15 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16338
16460
  this._renderStats = (annotation, viewport, enabledElement, svgDrawingHelper) => {
16339
16461
  const data = annotation.data;
16340
16462
  const targetId = this.getTargetId(viewport);
16463
+ const styleSpecifier = {
16464
+ toolGroupId: this.toolGroupId,
16465
+ toolName: this.getToolName(),
16466
+ viewportId: enabledElement.viewport.id,
16467
+ };
16468
+ const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
16469
+ if (!options.visibility) {
16470
+ return;
16471
+ }
16341
16472
  const textLines = this.configuration.getTextLines(data, targetId);
16342
16473
  if (!textLines || textLines.length === 0) {
16343
16474
  return;
@@ -16349,13 +16480,8 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16349
16480
  viewport.canvasToWorld(canvasTextBoxCoords);
16350
16481
  }
16351
16482
  const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
16352
- const styleSpecifier = {
16353
- toolGroupId: this.toolGroupId,
16354
- toolName: this.getToolName(),
16355
- viewportId: enabledElement.viewport.id,
16356
- };
16357
16483
  const textBoxUID = '1';
16358
- const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotation.annotationUID ?? '', textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, this.getLinkedTextBoxStyle(styleSpecifier, annotation));
16484
+ const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotation.annotationUID ?? '', textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
16359
16485
  const { x: left, y: top, width, height } = boundingBox;
16360
16486
  data.handles.textBox.worldBoundingBox = {
16361
16487
  topLeft: viewport.canvasToWorld([left, top]),
@@ -16803,6 +16929,20 @@ class ArrowAnnotateTool extends base_AnnotationTool {
16803
16929
  if (!text) {
16804
16930
  continue;
16805
16931
  }
16932
+ const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
16933
+ if (!options.visibility) {
16934
+ data.handles.textBox = {
16935
+ hasMoved: false,
16936
+ worldPosition: [0, 0, 0],
16937
+ worldBoundingBox: {
16938
+ topLeft: [0, 0, 0],
16939
+ topRight: [0, 0, 0],
16940
+ bottomLeft: [0, 0, 0],
16941
+ bottomRight: [0, 0, 0],
16942
+ },
16943
+ };
16944
+ continue;
16945
+ }
16806
16946
  if (!data.handles.textBox.hasMoved) {
16807
16947
  const canvasTextBoxCoords = canvasCoordinates[1];
16808
16948
  data.handles.textBox.worldPosition =
@@ -16810,7 +16950,7 @@ class ArrowAnnotateTool extends base_AnnotationTool {
16810
16950
  }
16811
16951
  const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
16812
16952
  const textBoxUID = '1';
16813
- const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, [text], textBoxPosition, canvasCoordinates, {}, this.getLinkedTextBoxStyle(styleSpecifier, annotation));
16953
+ const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, [text], textBoxPosition, canvasCoordinates, {}, options);
16814
16954
  const { x: left, y: top, width, height } = boundingBox;
16815
16955
  data.handles.textBox.worldBoundingBox = {
16816
16956
  topLeft: viewport.canvasToWorld([left, top]),
@@ -17227,6 +17367,20 @@ class AngleTool extends base_AnnotationTool {
17227
17367
  if (!data.cachedStats[targetId]?.angle) {
17228
17368
  continue;
17229
17369
  }
17370
+ const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
17371
+ if (!options.visibility) {
17372
+ data.handles.textBox = {
17373
+ hasMoved: false,
17374
+ worldPosition: [0, 0, 0],
17375
+ worldBoundingBox: {
17376
+ topLeft: [0, 0, 0],
17377
+ topRight: [0, 0, 0],
17378
+ bottomLeft: [0, 0, 0],
17379
+ bottomRight: [0, 0, 0],
17380
+ },
17381
+ };
17382
+ continue;
17383
+ }
17230
17384
  const textLines = this.configuration.getTextLines(data, targetId);
17231
17385
  if (!data.handles.textBox.hasMoved) {
17232
17386
  const canvasTextBoxCoords = canvasCoordinates[1];
@@ -17235,7 +17389,7 @@ class AngleTool extends base_AnnotationTool {
17235
17389
  }
17236
17390
  const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
17237
17391
  const textBoxUID = '1';
17238
- const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, this.getLinkedTextBoxStyle(styleSpecifier, annotation));
17392
+ const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
17239
17393
  const { x: left, y: top, width, height } = boundingBox;
17240
17394
  data.handles.textBox.worldBoundingBox = {
17241
17395
  topLeft: viewport.canvasToWorld([left, top]),
@@ -17290,7 +17444,7 @@ class AngleTool extends base_AnnotationTool {
17290
17444
  const targetId = targetIds[i];
17291
17445
  const angle = angleBetweenLines([worldPos1, worldPos2], [worldPos2, worldPos3]);
17292
17446
  cachedStats[targetId] = {
17293
- angle,
17447
+ angle: isNaN(angle) ? 'Incomplete Angle' : angle,
17294
17448
  };
17295
17449
  }
17296
17450
  annotation.invalidated = false;
@@ -17707,6 +17861,20 @@ class CobbAngleTool extends base_AnnotationTool {
17707
17861
  if (!data.cachedStats[targetId]?.angle) {
17708
17862
  continue;
17709
17863
  }
17864
+ const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
17865
+ if (!options.visibility) {
17866
+ data.handles.textBox = {
17867
+ hasMoved: false,
17868
+ worldPosition: [0, 0, 0],
17869
+ worldBoundingBox: {
17870
+ topLeft: [0, 0, 0],
17871
+ topRight: [0, 0, 0],
17872
+ bottomLeft: [0, 0, 0],
17873
+ bottomRight: [0, 0, 0],
17874
+ },
17875
+ };
17876
+ continue;
17877
+ }
17710
17878
  const textLines = this.configuration.getTextLines(data, targetId);
17711
17879
  if (!data.handles.textBox.hasMoved) {
17712
17880
  const canvasTextBoxCoords = getTextBoxCoordsCanvas(canvasCoordinates);
@@ -17715,7 +17883,7 @@ class CobbAngleTool extends base_AnnotationTool {
17715
17883
  }
17716
17884
  const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
17717
17885
  const textBoxUID = '1';
17718
- const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, this.getLinkedTextBoxStyle(styleSpecifier, annotation));
17886
+ const boundingBox = drawingSvg_drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
17719
17887
  const { x: left, y: top, width, height } = boundingBox;
17720
17888
  data.handles.textBox.worldBoundingBox = {
17721
17889
  topLeft: viewport.canvasToWorld([left, top]),
@@ -20173,12 +20341,12 @@ async function createLabelmapVolumeForViewport(input) {
20173
20341
 
20174
20342
 
20175
20343
 
20176
- function setBrushSizeForToolGroup(toolGroupId, brushSize) {
20344
+ function setBrushSizeForToolGroup(toolGroupId, brushSize, toolName) {
20177
20345
  const toolGroup = ToolGroupManager_getToolGroup(toolGroupId);
20178
20346
  if (toolGroup === undefined) {
20179
20347
  return;
20180
20348
  }
20181
- const brushBasedToolInstances = getBrushToolInstances(toolGroupId);
20349
+ const brushBasedToolInstances = getBrushToolInstances(toolGroupId, toolName);
20182
20350
  brushBasedToolInstances.forEach((tool) => {
20183
20351
  tool.configuration.brushSize = brushSize;
20184
20352
  tool.invalidateBrushCursor();
@@ -20193,7 +20361,7 @@ function setBrushSizeForToolGroup(toolGroupId, brushSize) {
20193
20361
  const renderingEngine = (0,esm.getRenderingEngine)(renderingEngineId);
20194
20362
  utilities_triggerAnnotationRenderForViewportIds(renderingEngine, viewportIds);
20195
20363
  }
20196
- function getBrushSizeForToolGroup(toolGroupId) {
20364
+ function getBrushSizeForToolGroup(toolGroupId, toolName) {
20197
20365
  const toolGroup = ToolGroupManager_getToolGroup(toolGroupId);
20198
20366
  if (toolGroup === undefined) {
20199
20367
  return;
@@ -20202,7 +20370,7 @@ function getBrushSizeForToolGroup(toolGroupId) {
20202
20370
  if (!Object.keys(toolInstances).length) {
20203
20371
  return;
20204
20372
  }
20205
- const brushBasedToolInstances = getBrushToolInstances(toolGroupId);
20373
+ const brushBasedToolInstances = getBrushToolInstances(toolGroupId, toolName);
20206
20374
  const brushToolInstance = brushBasedToolInstances[0];
20207
20375
  if (!brushToolInstance) {
20208
20376
  return;
@@ -20408,6 +20576,7 @@ function getToolState(element) {
20408
20576
 
20409
20577
 
20410
20578
 
20579
+ const { ViewportStatus } = esm.Enums;
20411
20580
  const { triggerEvent } = esm.utilities;
20412
20581
  const debounced = true;
20413
20582
  const loop = true;
@@ -20590,7 +20759,7 @@ function _getVolumeFromViewport(viewport) {
20590
20759
  const dynamicVolume = volumes.find((volume) => volume.isDynamicVolume());
20591
20760
  return dynamicVolume ?? volumes[0];
20592
20761
  }
20593
- function _createStackViewportCinePlayContext(viewport) {
20762
+ function _createStackViewportCinePlayContext(viewport, waitForRendered) {
20594
20763
  const imageIds = viewport.getImageIds();
20595
20764
  return {
20596
20765
  get numScrollSteps() {
@@ -20602,7 +20771,14 @@ function _createStackViewportCinePlayContext(viewport) {
20602
20771
  get frameTimeVectorEnabled() {
20603
20772
  return true;
20604
20773
  },
20774
+ waitForRenderedCount: 0,
20605
20775
  scroll(delta) {
20776
+ if (this.waitForRenderedCount <= waitForRendered &&
20777
+ viewport.viewportStatus !== ViewportStatus.RENDERED) {
20778
+ this.waitForRenderedCount++;
20779
+ return;
20780
+ }
20781
+ this.waitForRenderedCount = 0;
20606
20782
  scroll_scroll(viewport, { delta, debounceLoading: debounced });
20607
20783
  },
20608
20784
  };
@@ -20663,7 +20839,7 @@ function _createDynamicVolumeViewportCinePlayContext(volume) {
20663
20839
  }
20664
20840
  function _createCinePlayContext(viewport, playClipOptions) {
20665
20841
  if (viewport instanceof esm.StackViewport) {
20666
- return _createStackViewportCinePlayContext(viewport);
20842
+ return _createStackViewportCinePlayContext(viewport, playClipOptions.waitForRendered ?? 30);
20667
20843
  }
20668
20844
  if (viewport instanceof esm.VolumeViewport) {
20669
20845
  const volume = _getVolumeFromViewport(viewport);
@@ -20757,7 +20933,7 @@ const priority = 0;
20757
20933
  const addToBeginning = true;
20758
20934
  let configuration = {
20759
20935
  maxImagesToPrefetch: Infinity,
20760
- preserveExistingPool: false,
20936
+ preserveExistingPool: true,
20761
20937
  };
20762
20938
  let resetPrefetchTimeout;
20763
20939
  const resetPrefetchDelay = 10;
@@ -22277,6 +22453,7 @@ class Synchronizer {
22277
22453
  return;
22278
22454
  }
22279
22455
  this._ignoreFiredEvents = true;
22456
+ const promises = [];
22280
22457
  try {
22281
22458
  for (let i = 0; i < this._targetViewports.length; i++) {
22282
22459
  const targetViewport = this._targetViewports[i];
@@ -22284,14 +22461,21 @@ class Synchronizer {
22284
22461
  if (targetIsSource) {
22285
22462
  continue;
22286
22463
  }
22287
- this._eventHandler(this, sourceViewport, targetViewport, sourceEvent, this._options);
22464
+ promises.push(this._eventHandler(this, sourceViewport, targetViewport, sourceEvent, this._options));
22288
22465
  }
22289
22466
  }
22290
22467
  catch (ex) {
22291
22468
  console.warn(`Synchronizer, for: ${this._eventName}`, ex);
22292
22469
  }
22293
22470
  finally {
22294
- this._ignoreFiredEvents = false;
22471
+ if (promises.length) {
22472
+ Promise.allSettled(promises).then(() => {
22473
+ this._ignoreFiredEvents = false;
22474
+ });
22475
+ }
22476
+ else {
22477
+ this._ignoreFiredEvents = false;
22478
+ }
22295
22479
  }
22296
22480
  }
22297
22481
  _hasSourceElements() {
@@ -22732,7 +22916,7 @@ class ToolGroup {
22732
22916
  _configuration = configuration;
22733
22917
  }
22734
22918
  else {
22735
- _configuration = esm.utilities.deepMerge(this._toolInstances[toolName].configuration, configuration);
22919
+ _configuration = Object.assign(this._toolInstances[toolName].configuration, configuration);
22736
22920
  }
22737
22921
  this._toolInstances[toolName].configuration = _configuration;
22738
22922
  this._renderViewports();
@@ -23069,7 +23253,7 @@ function voiSyncCallback(synchronizerInstance, sourceViewport, targetViewport, v
23069
23253
  const tProperties = {
23070
23254
  voiRange: range,
23071
23255
  };
23072
- if (options.syncInvertState && invertStateChanged) {
23256
+ if (options?.syncInvertState && invertStateChanged) {
23073
23257
  tProperties.invert = invert;
23074
23258
  }
23075
23259
  if (tViewport instanceof esm.BaseVolumeViewport) {
@@ -23138,15 +23322,18 @@ function areViewportsCoplanar(viewport1, viewport2) {
23138
23322
 
23139
23323
 
23140
23324
 
23325
+ const getSpatialRegistration = (targetId, sourceId) => esm.utilities.spatialRegistrationMetadataProvider.get('spatialRegistrationModule', [targetId, sourceId]);
23141
23326
  async function stackImageSyncCallback(synchronizerInstance, sourceViewport, targetViewport) {
23142
23327
  const renderingEngine = (0,esm.getRenderingEngine)(targetViewport.renderingEngineId);
23143
23328
  if (!renderingEngine) {
23144
23329
  throw new Error(`No RenderingEngine for Id: ${targetViewport.renderingEngineId}`);
23145
23330
  }
23146
23331
  const sViewport = renderingEngine.getViewport(sourceViewport.viewportId);
23332
+ const options = synchronizerInstance.getOptions(targetViewport.viewportId);
23333
+ if (options?.disabled) {
23334
+ return;
23335
+ }
23147
23336
  const tViewport = renderingEngine.getViewport(targetViewport.viewportId);
23148
- const frameOfReferenceUID1 = sViewport.getFrameOfReferenceUID();
23149
- const frameOfReferenceUID2 = tViewport.getFrameOfReferenceUID();
23150
23337
  const imageId1 = sViewport.getCurrentImageId();
23151
23338
  const imagePlaneModule1 = esm.metaData.get('imagePlaneModule', imageId1);
23152
23339
  const sourceImagePositionPatient = imagePlaneModule1.imagePositionPatient;
@@ -23154,30 +23341,30 @@ async function stackImageSyncCallback(synchronizerInstance, sourceViewport, targ
23154
23341
  if (!areViewportsCoplanar(sViewport, tViewport)) {
23155
23342
  return;
23156
23343
  }
23157
- if (frameOfReferenceUID1 === frameOfReferenceUID2) {
23158
- const closestImageIdIndex = _getClosestImageIdIndex(sourceImagePositionPatient, targetImageIds);
23159
- if (closestImageIdIndex.index !== -1 &&
23160
- tViewport.getCurrentImageIdIndex() !== closestImageIdIndex.index) {
23161
- await viewport_jumpToSlice(tViewport.element, {
23162
- imageIndex: closestImageIdIndex.index,
23163
- });
23164
- return;
23344
+ let registrationMatrixMat4 = getSpatialRegistration(targetViewport.viewportId, sourceViewport.viewportId);
23345
+ if (!registrationMatrixMat4) {
23346
+ const frameOfReferenceUID1 = sViewport.getFrameOfReferenceUID();
23347
+ const frameOfReferenceUID2 = tViewport.getFrameOfReferenceUID();
23348
+ if (frameOfReferenceUID1 === frameOfReferenceUID2 &&
23349
+ options.useInitialPosition !== false) {
23350
+ registrationMatrixMat4 = gl_matrix_esm/* mat4.identity */._E.identity(gl_matrix_esm/* mat4.create */._E.create());
23351
+ }
23352
+ else {
23353
+ esm.utilities.calculateViewportsSpatialRegistration(sViewport, tViewport);
23354
+ registrationMatrixMat4 = getSpatialRegistration(targetViewport.viewportId, sourceViewport.viewportId);
23165
23355
  }
23166
- }
23167
- else {
23168
- const registrationMatrixMat4 = esm.utilities.spatialRegistrationMetadataProvider.get('spatialRegistrationModule', [targetViewport.viewportId, sourceViewport.viewportId]);
23169
23356
  if (!registrationMatrixMat4) {
23170
- throw new Error(`No registration matrix found for sourceViewport: ${sourceViewport.viewportId} and targetViewport: ${targetViewport.viewportId}, viewports with different frameOfReferenceUIDs must have a registration matrix in the registrationMetadataProvider. Use calculateViewportsRegistrationMatrix to calculate the matrix.`);
23171
- }
23172
- const targetImagePositionPatientWithRegistrationMatrix = gl_matrix_esm/* vec3.transformMat4 */.R3.transformMat4(gl_matrix_esm/* vec3.create */.R3.create(), sourceImagePositionPatient, registrationMatrixMat4);
23173
- const closestImageIdIndex2 = _getClosestImageIdIndex(targetImagePositionPatientWithRegistrationMatrix, targetImageIds);
23174
- if (closestImageIdIndex2.index !== -1 &&
23175
- tViewport.getCurrentImageIdIndex() !== closestImageIdIndex2.index) {
23176
- await viewport_jumpToSlice(tViewport.element, {
23177
- imageIndex: closestImageIdIndex2.index,
23178
- });
23357
+ return;
23179
23358
  }
23180
23359
  }
23360
+ const targetImagePositionPatientWithRegistrationMatrix = gl_matrix_esm/* vec3.transformMat4 */.R3.transformMat4(gl_matrix_esm/* vec3.create */.R3.create(), sourceImagePositionPatient, registrationMatrixMat4);
23361
+ const closestImageIdIndex2 = _getClosestImageIdIndex(targetImagePositionPatientWithRegistrationMatrix, targetImageIds);
23362
+ if (closestImageIdIndex2.index !== -1 &&
23363
+ tViewport.getCurrentImageIdIndex() !== closestImageIdIndex2.index) {
23364
+ await viewport_jumpToSlice(tViewport.element, {
23365
+ imageIndex: closestImageIdIndex2.index,
23366
+ });
23367
+ }
23181
23368
  }
23182
23369
  function _getClosestImageIdIndex(targetPoint, imageIds) {
23183
23370
  return imageIds.reduce((closestImageIdIndex, imageId, index) => {