@cornerstonejs/tools 5.8.2 → 5.10.3

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 (135) hide show
  1. package/dist/esm/config.js +3 -1
  2. package/dist/esm/cursors/setCursorForElement.js +3 -1
  3. package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDownActivate.js +3 -1
  4. package/dist/esm/eventDispatchers/touchEventHandlers/touchStartActivate.js +3 -1
  5. package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +3 -1
  6. package/dist/esm/stateManagement/annotation/AnnotationRenderingEngine.js +3 -1
  7. package/dist/esm/stateManagement/segmentation/SegmentationRenderingEngine.js +4 -2
  8. package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +9 -3
  9. package/dist/esm/stateManagement/segmentation/addColorLUT.js +3 -1
  10. package/dist/esm/stateManagement/segmentation/config/segmentationColor.js +3 -1
  11. package/dist/esm/stateManagement/segmentation/helpers/normalizeSegmentationInput.js +2 -0
  12. package/dist/esm/stateManagement/segmentation/internalAddRepresentationData.js +3 -1
  13. package/dist/esm/stateManagement/segmentation/internalAddSegmentationRepresentation.js +3 -1
  14. package/dist/esm/stateManagement/segmentation/removeSegmentationRepresentations.js +3 -1
  15. package/dist/esm/stateManagement/segmentation/segmentIndex.js +3 -1
  16. package/dist/esm/stateManagement/segmentation/utilities/convertContourHoles.js +9 -7
  17. package/dist/esm/stateManagement/segmentation/utilities/decimateContours.js +6 -4
  18. package/dist/esm/stateManagement/segmentation/utilities/getPolylineMap.js +3 -1
  19. package/dist/esm/stateManagement/segmentation/utilities/removeContourHoles.js +5 -3
  20. package/dist/esm/stateManagement/segmentation/utilities/removeContourIslands.js +5 -3
  21. package/dist/esm/stateManagement/segmentation/utilities/smoothContours.js +6 -4
  22. package/dist/esm/store/SynchronizerManager/Synchronizer.js +4 -2
  23. package/dist/esm/store/ToolGroupManager/ToolGroup.js +17 -15
  24. package/dist/esm/store/ToolGroupManager/createToolGroup.js +3 -1
  25. package/dist/esm/store/filterToolsWithAnnotationsForElement.js +3 -1
  26. package/dist/esm/tools/AdvancedMagnifyTool.js +3 -1
  27. package/dist/esm/tools/CrosshairsTool.js +4 -2
  28. package/dist/esm/tools/MIPJumpToClickTool.js +3 -1
  29. package/dist/esm/tools/OrientationControllerTool.js +6 -4
  30. package/dist/esm/tools/OverlayGridTool.js +5 -3
  31. package/dist/esm/tools/ReferenceCursors.js +3 -1
  32. package/dist/esm/tools/ReferenceLinesTool.js +3 -1
  33. package/dist/esm/tools/SculptorTool.js +7 -5
  34. package/dist/esm/tools/SegmentationIntersectionTool.js +3 -1
  35. package/dist/esm/tools/VolumeCroppingControlTool.js +5 -3
  36. package/dist/esm/tools/VolumeCroppingTool.js +5 -3
  37. package/dist/esm/tools/WindowLevelRegionTool.js +3 -1
  38. package/dist/esm/tools/annotation/AngleTool.js +3 -1
  39. package/dist/esm/tools/annotation/ArrowAnnotateTool.js +3 -1
  40. package/dist/esm/tools/annotation/BidirectionalTool.js +3 -1
  41. package/dist/esm/tools/annotation/CircleROITool.js +30 -33
  42. package/dist/esm/tools/annotation/CobbAngleTool.js +3 -1
  43. package/dist/esm/tools/annotation/DragProbeTool.js +3 -1
  44. package/dist/esm/tools/annotation/ETDRSGridTool.js +3 -1
  45. package/dist/esm/tools/annotation/EllipticalROITool.js +35 -38
  46. package/dist/esm/tools/annotation/HeightTool.js +3 -1
  47. package/dist/esm/tools/annotation/KeyImageTool.js +3 -1
  48. package/dist/esm/tools/annotation/LabelTool.js +3 -1
  49. package/dist/esm/tools/annotation/LengthTool.js +4 -2
  50. package/dist/esm/tools/annotation/LivewireContourTool.js +3 -1
  51. package/dist/esm/tools/annotation/PlanarFreehandROITool.d.ts +13 -2
  52. package/dist/esm/tools/annotation/PlanarFreehandROITool.js +28 -81
  53. package/dist/esm/tools/annotation/ProbeTool.js +3 -1
  54. package/dist/esm/tools/annotation/RectangleROITool.js +31 -20
  55. package/dist/esm/tools/annotation/SplineROITool.js +3 -1
  56. package/dist/esm/tools/annotation/UltrasoundDirectionalTool.js +3 -1
  57. package/dist/esm/tools/annotation/UltrasoundPleuraBLineTool/UltrasoundPleuraBLineTool.js +5 -3
  58. package/dist/esm/tools/annotation/VideoRedactionTool.js +3 -1
  59. package/dist/esm/tools/annotation/planarFreehandROITool/findOpenUShapedContourVectorToPeak.js +3 -1
  60. package/dist/esm/tools/base/AnnotationTool.js +3 -1
  61. package/dist/esm/tools/base/ContourBaseTool.js +3 -1
  62. package/dist/esm/tools/displayTools/Contour/contourDisplay.js +4 -2
  63. package/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js +3 -1
  64. package/dist/esm/tools/displayTools/Contour/contourHandler/utils.js +3 -1
  65. package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +4 -2
  66. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/legacyVolumePlan.js +4 -2
  67. package/dist/esm/tools/displayTools/Labelmap/syncStackLabelmapActors.js +3 -1
  68. package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js +6 -4
  69. package/dist/esm/tools/segmentation/BrushTool.js +9 -7
  70. package/dist/esm/tools/segmentation/CircleROIStartEndThresholdTool.js +3 -1
  71. package/dist/esm/tools/segmentation/CircleScissorsTool.js +3 -1
  72. package/dist/esm/tools/segmentation/LabelmapBaseTool.d.ts +1 -0
  73. package/dist/esm/tools/segmentation/LabelmapBaseTool.js +6 -1
  74. package/dist/esm/tools/segmentation/LabelmapEditWithContour.js +3 -1
  75. package/dist/esm/tools/segmentation/PaintFillTool.js +3 -1
  76. package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +3 -1
  77. package/dist/esm/tools/segmentation/RectangleROIThresholdTool.js +3 -1
  78. package/dist/esm/tools/segmentation/RectangleScissorsTool.js +3 -1
  79. package/dist/esm/tools/segmentation/SegmentBidirectionalTool.js +3 -1
  80. package/dist/esm/tools/segmentation/SegmentSelectTool.d.ts +6 -1
  81. package/dist/esm/tools/segmentation/SegmentSelectTool.js +30 -4
  82. package/dist/esm/tools/segmentation/SphereScissorsTool.js +3 -1
  83. package/dist/esm/tools/segmentation/strategies/compositions/circularCursor.js +3 -1
  84. package/dist/esm/tools/segmentation/strategies/compositions/index.js +1 -1
  85. package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.d.ts +8 -1
  86. package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js +6 -4
  87. package/dist/esm/types/SegmentationStateTypes.d.ts +4 -0
  88. package/dist/esm/utilities/calibrateImageSpacing.js +3 -1
  89. package/dist/esm/utilities/cine/playClip.js +3 -1
  90. package/dist/esm/utilities/contourSegmentation/applyContourStroke.js +3 -1
  91. package/dist/esm/utilities/contourSegmentation/contourSegmentationOperation.js +4 -2
  92. package/dist/esm/utilities/contourSegmentation/convertContourSegmentation.js +3 -1
  93. package/dist/esm/utilities/contourSegmentation/logicalOperators.js +6 -4
  94. package/dist/esm/utilities/contourSegmentation/mergeMultipleAnnotations.js +3 -1
  95. package/dist/esm/utilities/contourSegmentation/sharedOperations.js +3 -1
  96. package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js +3 -1
  97. package/dist/esm/utilities/contours/interpolation/findAnnotationForInterpolation.js +3 -1
  98. package/dist/esm/utilities/contours/interpolation/interpolate.js +3 -1
  99. package/dist/esm/utilities/dynamicVolume/generateImageFromTimeData.js +4 -2
  100. package/dist/esm/utilities/dynamicVolume/getDataInTime.js +3 -1
  101. package/dist/esm/utilities/index.d.ts +2 -1
  102. package/dist/esm/utilities/index.js +2 -1
  103. package/dist/esm/utilities/livewire/LivewireScissors.js +3 -1
  104. package/dist/esm/utilities/math/basic/Calculator.js +3 -1
  105. package/dist/esm/utilities/math/polyline/addCanvasPointsToArray.js +3 -1
  106. package/dist/esm/utilities/math/polyline/combinePolyline.js +4 -2
  107. package/dist/esm/utilities/math/polyline/getSubPixelSpacingAndXYDirections.js +12 -6
  108. package/dist/esm/utilities/math/polyline/intersectPolylines.js +4 -2
  109. package/dist/esm/utilities/math/polyline/subtractPolylines.js +4 -2
  110. package/dist/esm/utilities/sampleAreaAnnotationVoxels.d.ts +44 -0
  111. package/dist/esm/utilities/sampleAreaAnnotationVoxels.js +63 -0
  112. package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js +5 -3
  113. package/dist/esm/utilities/segmentation/getStatistics.js +3 -0
  114. package/dist/esm/utilities/segmentation/growCut/runFloodFillSegmentation.js +10 -5
  115. package/dist/esm/utilities/segmentation/growCut/runGrowCut.js +3 -1
  116. package/dist/esm/utilities/segmentation/growCut/runGrowCutForSphere.js +3 -1
  117. package/dist/esm/utilities/segmentation/growCut/runOneClickGrowCut.js +10 -8
  118. package/dist/esm/utilities/segmentation/isLineInSegment.js +3 -1
  119. package/dist/esm/utilities/segmentation/islandRemoval.js +3 -1
  120. package/dist/esm/utilities/segmentation/segmentContourAction.js +4 -2
  121. package/dist/esm/utilities/segmentation/utilsForWorker.d.ts +8 -1
  122. package/dist/esm/utilities/segmentation/utilsForWorker.js +4 -2
  123. package/dist/esm/utilities/spatial/areViewportsSpatiallyLinked.js +2 -1
  124. package/dist/esm/utilities/stackPrefetch/stackContextPrefetch.js +5 -3
  125. package/dist/esm/utilities/stackPrefetch/stackPrefetch.js +4 -2
  126. package/dist/esm/utilities/triggerAnnotationRenderForToolGroupIds.js +4 -2
  127. package/dist/esm/utilities/triggerAnnotationRenderForViewportIds.js +4 -2
  128. package/dist/esm/utilities/voi/colorbar/Colorbar.js +3 -1
  129. package/dist/esm/utilities/voi/windowlevel/extractWindowLevelRegionToolData.js +3 -1
  130. package/dist/esm/utilities/vtkjs/OrientationControllerWidget/index.js +4 -2
  131. package/dist/esm/version.d.ts +1 -1
  132. package/dist/esm/version.js +1 -1
  133. package/dist/esm/workers/computeWorker.js +5 -3
  134. package/package.json +4 -5
  135. package/LICENSE +0 -21
@@ -22,7 +22,11 @@ import { isViewportPreScaled } from '../../utilities/viewport/isViewportPreScale
22
22
  import { BasicStatsCalculator } from '../../utilities/math/basic/index.js';
23
23
  import { getStyleProperty } from '../../stateManagement/annotation/config/helpers.js';
24
24
  import { defaultAreaGetTextLines } from '../../utilities/defaultGetTextLines.js';
25
+ import sampleAreaAnnotationVoxels from '../../utilities/sampleAreaAnnotationVoxels.js';
26
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
27
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.annotation.RectangleROITool');
25
28
  const { transformWorldToIndex, transformWorldToIndexContinuous } = csUtils;
29
+ const { createRectangleShape } = csUtils.voxelSlab;
26
30
  class RectangleROITool extends AnnotationTool {
27
31
  constructor(toolProps = {}, defaultToolProps = {
28
32
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -360,7 +364,7 @@ class RectangleROITool extends AnnotationTool {
360
364
  }
361
365
  }
362
366
  if (!viewport.getRenderingEngine()) {
363
- console.warn('Rendering Engine has been destroyed');
367
+ cs3dLogger.warn('Rendering Engine has been destroyed');
364
368
  return renderStatus;
365
369
  }
366
370
  let activeHandleCanvasCoords;
@@ -445,17 +449,6 @@ class RectangleROITool extends AnnotationTool {
445
449
  const isHandleOutsideTarget = !this._isInsideVolume(pos1Index, pos2Index, dimensions);
446
450
  isHandleOutsideAnyTarget ||= isHandleOutsideTarget;
447
451
  if (!isHandleOutsideTarget) {
448
- const iMin = Math.min(pos1Index[0], pos2Index[0]);
449
- const iMax = Math.max(pos1Index[0], pos2Index[0]);
450
- const jMin = Math.min(pos1Index[1], pos2Index[1]);
451
- const jMax = Math.max(pos1Index[1], pos2Index[1]);
452
- const kMin = Math.min(pos1Index[2], pos2Index[2]);
453
- const kMax = Math.max(pos1Index[2], pos2Index[2]);
454
- const boundsIJK = [
455
- [iMin, iMax],
456
- [jMin, jMax],
457
- [kMin, kMax],
458
- ];
459
452
  const handles = [pos1Index, pos2Index];
460
453
  const calibrate = getCalibratedLengthUnitsAndScale(image, handles);
461
454
  const width = _a.calculateLengthInIndex(calibrate, [
@@ -473,14 +466,32 @@ class RectangleROITool extends AnnotationTool {
473
466
  isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
474
467
  };
475
468
  const modalityUnit = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
476
- let pointsInShape;
477
- if (voxelManager) {
478
- pointsInShape = voxelManager.forEach(this.configuration.statsCalculator.statsCallback, {
479
- boundsIJK,
480
- imageData,
481
- returnPoints: this.configuration.storePointData,
482
- });
483
- }
469
+ const pointsInShape = sampleAreaAnnotationVoxels({
470
+ annotation,
471
+ image,
472
+ voxelManager: voxelManager,
473
+ points: worldHandles,
474
+ createShape: ({ volume, planePoint, viewPlaneNormal }) => {
475
+ const majorAxis = vec3.sub(vec3.create(), worldHandles[1], worldHandles[0]);
476
+ const majorHalfLength = vec3.distance(worldHandles[0], worldHandles[1]) / 2;
477
+ const minorHalfLength = vec3.distance(worldHandles[0], worldHandles[2]) / 2;
478
+ if (!(majorHalfLength > 0) || !(minorHalfLength > 0)) {
479
+ return null;
480
+ }
481
+ return createRectangleShape({
482
+ volume,
483
+ planePoint,
484
+ viewPlaneNormal,
485
+ centerWorld: vec3.lerp(vec3.create(), worldHandles[0], worldHandles[3], 0.5),
486
+ majorAxis,
487
+ majorHalfLength,
488
+ minorHalfLength,
489
+ });
490
+ },
491
+ minimumPoints: 4,
492
+ onSample: this.configuration.statsCalculator.statsCallback,
493
+ storePointData: this.configuration.storePointData,
494
+ });
484
495
  const stats = this.configuration.statsCalculator.getStatistics();
485
496
  cachedStats[targetId] = {
486
497
  Modality: metadata.Modality,
@@ -18,6 +18,8 @@ import { BSpline } from './splines/BSpline.js';
18
18
  import ContourSegmentationBaseTool from '../base/ContourSegmentationBaseTool.js';
19
19
  import { triggerAnnotationRenderForViewportIds } from '../../utilities/index.js';
20
20
  import { convertContourSegmentationAnnotation } from '../../utilities/contourSegmentation/index.js';
21
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
22
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.annotation.SplineROITool');
21
23
  const SPLINE_MIN_POINTS = 3;
22
24
  const SPLINE_CLICK_CLOSE_CURVE_DIST = 10;
23
25
  const DEFAULT_SPLINE_CONFIG = {
@@ -817,7 +819,7 @@ SplineROITool.hydrate = (viewportId, points, options) => {
817
819
  return;
818
820
  }
819
821
  if (points.length < SPLINE_MIN_POINTS) {
820
- console.warn('Spline requires at least 3 control points');
822
+ cs3dLogger.warn('Spline requires at least 3 control points');
821
823
  return;
822
824
  }
823
825
  const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, viewUp, instance, viewport, } = _a.hydrateBase(_a, enabledElement, points, options);
@@ -12,6 +12,8 @@ import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnota
12
12
  import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor.js';
13
13
  import { getCalibratedProbeUnitsAndValue } from '../../utilities/getCalibratedUnits.js';
14
14
  import { lineSegment } from '../../utilities/math/index.js';
15
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
16
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.annotation.UltrasoundDirectionalTool');
15
17
  const { transformWorldToIndexContinuous } = csUtils;
16
18
  class UltrasoundDirectionalTool extends AnnotationTool {
17
19
  constructor(toolProps = {}, defaultToolProps = {
@@ -248,7 +250,7 @@ class UltrasoundDirectionalTool extends AnnotationTool {
248
250
  this._throttledCalculateCachedStats(annotation, renderingEngine, enabledElement);
249
251
  }
250
252
  if (!viewport.getRenderingEngine()) {
251
- console.warn('Rendering Engine has been destroyed');
253
+ cs3dLogger.warn('Rendering Engine has been destroyed');
252
254
  return renderStatus;
253
255
  }
254
256
  let handleGroupUID = '0';
@@ -15,6 +15,8 @@ import triggerAnnotationRenderForViewportIds from '../../../utilities/triggerAnn
15
15
  import { resetElementCursor, hideElementCursor, } from '../../../cursors/elementCursor.js';
16
16
  import { angleFromCenter, calculateInnerFanPercentage, clipInterval, intervalFromPoints, mergeIntervals, subtractIntervals, } from '../../../utilities/math/fan/fanUtils.js';
17
17
  import { calculateFanGeometry } from './utils/fanExtraction.js';
18
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
19
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.annotation.UltrasoundPleuraBLineTool.UltrasoundPleuraBLineTool');
18
20
  const { transformIndexToWorld } = utilities;
19
21
  class UltrasoundPleuraBLineTool extends AnnotationTool {
20
22
  constructor(toolProps = {}, defaultToolProps = {
@@ -328,7 +330,7 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
328
330
  });
329
331
  const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
330
332
  if (!viewport.getRenderingEngine()) {
331
- console.warn('Rendering Engine has been destroyed');
333
+ cs3dLogger.warn('Rendering Engine has been destroyed');
332
334
  return renderStatus;
333
335
  }
334
336
  let activeHandleCanvasCoords;
@@ -408,7 +410,7 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
408
410
  annotation.metadata.referencedImageId === currentImageId);
409
411
  pleuraAnnotationsToDraw.forEach((annotation) => {
410
412
  if (!viewport.getRenderingEngine()) {
411
- console.warn('Rendering Engine has been destroyed');
413
+ cs3dLogger.warn('Rendering Engine has been destroyed');
412
414
  return renderStatus;
413
415
  }
414
416
  drawAnnotation(annotation);
@@ -418,7 +420,7 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
418
420
  annotation.metadata.referencedImageId === currentImageId);
419
421
  bLineAnnotationsToDraw.forEach((annotation) => {
420
422
  if (!viewport.getRenderingEngine()) {
421
- console.warn('Rendering Engine has been destroyed');
423
+ cs3dLogger.warn('Rendering Engine has been destroyed');
422
424
  return renderStatus;
423
425
  }
424
426
  drawAnnotation(annotation);
@@ -11,6 +11,8 @@ import * as rectangle from '../../utilities/math/rectangle/index.js';
11
11
  import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor.js';
12
12
  import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds.js';
13
13
  import getWorldWidthAndHeightFromTwoPoints from '../../utilities/planar/getWorldWidthAndHeightFromTwoPoints.js';
14
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
15
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.annotation.VideoRedactionTool');
14
16
  class VideoRedactionTool extends AnnotationTool {
15
17
  constructor(toolConfiguration = {}) {
16
18
  super(toolConfiguration, {
@@ -276,7 +278,7 @@ class VideoRedactionTool extends AnnotationTool {
276
278
  const lineDash = this.getStyle('lineDash', styleSpecifier, annotation);
277
279
  const color = this.getStyle('color', styleSpecifier, annotation);
278
280
  if (!viewport.getRenderingEngine()) {
279
- console.warn('Rendering Engine has been destroyed');
281
+ cs3dLogger.warn('Rendering Engine has been destroyed');
280
282
  return;
281
283
  }
282
284
  let activeHandleCanvasCoords;
@@ -1,4 +1,6 @@
1
1
  import { vec2 } from 'gl-matrix';
2
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
3
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.annotation.planarFreehandROITool.findOpenUShapedContourVectorToPeak');
2
4
  export default function findOpenUShapedContourVectorToPeak(canvasPoints, viewport) {
3
5
  const first = canvasPoints[0];
4
6
  const last = canvasPoints[canvasPoints.length - 1];
@@ -85,7 +87,7 @@ function findOpenUShapedContourVectorToPeakOrthogonal(canvasPoints, viewport) {
85
87
  prevPoint = p;
86
88
  }
87
89
  if (!orthogonalPoint) {
88
- console.warn('No orthogonal intersection found for open U-shaped contour');
90
+ cs3dLogger.warn('No orthogonal intersection found for open U-shaped contour');
89
91
  return null;
90
92
  }
91
93
  const toOrthogonal = [
@@ -14,6 +14,8 @@ import { setAnnotationSelected } from '../../stateManagement/annotation/annotati
14
14
  import { addContourSegmentationAnnotation } from '../../utilities/contourSegmentation/index.js';
15
15
  import { safeStructuredClone } from '../../utilities/safeStructuredClone.js';
16
16
  import getViewportICamera from '../../utilities/getViewportICamera.js';
17
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
18
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.base.AnnotationTool');
17
19
  const { DefaultHistoryMemo } = csUtils.HistoryMemo;
18
20
  class AnnotationTool extends AnnotationDisplayTool {
19
21
  static createAnnotationForViewport(viewport, ...annotationBaseData) {
@@ -279,7 +281,7 @@ class AnnotationTool extends AnnotationDisplayTool {
279
281
  }
280
282
  const currentAnnotation = getAnnotation(annotationUID);
281
283
  if (!currentAnnotation) {
282
- console.warn('No current annotation');
284
+ cs3dLogger.warn('No current annotation');
283
285
  return;
284
286
  }
285
287
  Object.assign(currentAnnotation.data, state.data);
@@ -3,6 +3,8 @@ import { drawPath as drawPathSvg } from '../../drawingSvg/index.js';
3
3
  import AnnotationTool from './AnnotationTool.js';
4
4
  import updateContourPolyline from '../../utilities/contours/updateContourPolyline.js';
5
5
  import getContourHolesDataCanvas from '../../utilities/contours/getContourHolesDataCanvas.js';
6
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
7
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.base.ContourBaseTool');
6
8
  class ContourBaseTool extends AnnotationTool {
7
9
  constructor(toolProps, defaultToolProps) {
8
10
  super(toolProps, defaultToolProps);
@@ -29,7 +31,7 @@ class ContourBaseTool extends AnnotationTool {
29
31
  const { viewport } = enabledElement;
30
32
  const { element } = viewport;
31
33
  if (!viewport.getRenderingEngine()) {
32
- console.warn('Rendering Engine has been destroyed');
34
+ cs3dLogger.warn('Rendering Engine has been destroyed');
33
35
  return renderStatus;
34
36
  }
35
37
  let annotations = getAnnotations(this.getToolName(), element);
@@ -9,6 +9,8 @@ import { computeAndAddRepresentation } from '../../../utilities/segmentation/com
9
9
  import { getUniqueSegmentIndices } from '../../../utilities/segmentation/getUniqueSegmentIndices.js';
10
10
  import { getAnnotation } from '../../../stateManagement/annotation/annotationState.js';
11
11
  import { vec3 } from 'gl-matrix';
12
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
13
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.displayTools.Contour.contourDisplay');
12
14
  const polySegConversionInProgressForViewportId = new Map();
13
15
  const processedViewportSegmentations = new Map();
14
16
  function removeRepresentation(viewportId, segmentationId, renderImmediate = false) {
@@ -38,12 +40,12 @@ async function render(viewport, contourRepresentation) {
38
40
  contourData = await computeAndAddRepresentation(segmentationId, Representations.Contour, () => polySeg.computeContourData(segmentationId, { viewport }));
39
41
  }
40
42
  catch (error) {
41
- console.warn('Unable to compute contour data for segmentationId', segmentationId, error);
43
+ cs3dLogger.warn('Unable to compute contour data for segmentationId', segmentationId, error);
42
44
  }
43
45
  polySegConversionInProgressForViewportId.set(viewport.id, false);
44
46
  }
45
47
  else if (!contourData && !getPolySeg()) {
46
- console.debug(`No contour data found for segmentationId ${segmentationId} and PolySeg add-on is not configured. Unable to convert from other representations to contour. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.`);
48
+ cs3dLogger.debug(`No contour data found for segmentationId ${segmentationId} and PolySeg add-on is not configured. Unable to convert from other representations to contour. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.`);
47
49
  }
48
50
  if (!contourData) {
49
51
  return;
@@ -6,6 +6,8 @@ import getViewportICamera from '../../../../utilities/getViewportICamera.js';
6
6
  import { validateGeometry } from './utils.js';
7
7
  import { SegmentationRepresentations } from '../../../../enums/index.js';
8
8
  import { segmentationStyle } from '../../../../stateManagement/segmentation/SegmentationStyle.js';
9
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
10
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.displayTools.Contour.contourHandler.handleContourSegmentation');
9
11
  function handleContourSegmentation(viewport, geometryIds, annotationUIDsMap, contourRepresentation) {
10
12
  if (annotationUIDsMap.size) {
11
13
  viewport.render();
@@ -20,7 +22,7 @@ function addContourSetsToElement(viewport, geometryIds, contourRepresentation) {
20
22
  geometryIds.forEach((geometryId) => {
21
23
  const geometry = cache.getGeometry(geometryId);
22
24
  if (!geometry) {
23
- console.warn(`No geometry found for geometryId ${geometryId}. Skipping render.`);
25
+ cs3dLogger.warn(`No geometry found for geometryId ${geometryId}. Skipping render.`);
24
26
  return;
25
27
  }
26
28
  const segmentIndex = geometry.data.segmentIndex;
@@ -2,6 +2,8 @@ import { Enums } from '@cornerstonejs/core';
2
2
  import vtkCellArray from '@kitware/vtk.js/Common/Core/CellArray.js';
3
3
  import vtkPoints from '@kitware/vtk.js/Common/Core/Points.js';
4
4
  import vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData.js';
5
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
6
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.displayTools.Contour.contourHandler.utils');
5
7
  export function validateGeometry(geometry) {
6
8
  if (!geometry) {
7
9
  throw new Error(`No contours found for geometryId ${geometry.id}`);
@@ -11,7 +13,7 @@ export function validateGeometry(geometry) {
11
13
  throw new Error(`Geometry type ${geometry.type} not supported for rendering.`);
12
14
  }
13
15
  if (!geometry.data) {
14
- console.warn(`No contours found for geometryId ${geometryId}. Skipping render.`);
16
+ cs3dLogger.warn(`No contours found for geometryId ${geometryId}. Skipping render.`);
15
17
  return;
16
18
  }
17
19
  }
@@ -8,6 +8,8 @@ import { triggerSegmentationDataModified } from '../../../stateManagement/segmen
8
8
  import { defaultSegmentationStateManager } from '../../../stateManagement/segmentation/SegmentationStateManager.js';
9
9
  import { removeLabelmapRepresentationFromViewport, resolveLabelmapRenderPlan, } from './labelmapRenderPlan.js';
10
10
  import { MAX_NUMBER_COLORS, setLabelmapColorAndOpacity, } from './labelmapActorStyle.js';
11
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
12
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.displayTools.Labelmap.labelmapDisplay');
11
13
  export { MAX_NUMBER_COLORS };
12
14
  const unsupportedImageMapperStates = new Map();
13
15
  let polySegConversionInProgress = false;
@@ -28,7 +30,7 @@ async function render(viewport, representation) {
28
30
  const { segmentationId } = representation;
29
31
  const segmentation = getSegmentation(segmentationId);
30
32
  if (!segmentation) {
31
- console.warn('No segmentation found for segmentationId: ', segmentationId);
33
+ cs3dLogger.warn('No segmentation found for segmentationId: ', segmentationId);
32
34
  return;
33
35
  }
34
36
  let labelmapData = segmentation.representationData[SegmentationRepresentations.Labelmap];
@@ -52,7 +54,7 @@ async function render(viewport, representation) {
52
54
  polySegConversionInProgress = false;
53
55
  }
54
56
  else if (!labelmapData && !getPolySeg()) {
55
- console.debug(`No labelmap data found for segmentationId ${segmentationId} and PolySeg add-on is not configured. Unable to convert from other representations to labelmap. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.`);
57
+ cs3dLogger.debug(`No labelmap data found for segmentationId ${segmentationId} and PolySeg add-on is not configured. Unable to convert from other representations to labelmap. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.`);
56
58
  }
57
59
  if (!labelmapData) {
58
60
  return;
@@ -5,6 +5,8 @@ import { addVolumesAsIndependentComponents } from '../addVolumesAsIndependentCom
5
5
  import { createLabelmapRepresentationUID } from '../labelmapRepresentationUID.js';
6
6
  import { createLabelmapRenderPlan, getActorEntryRenderMode, } from './createLabelmapRenderPlan.js';
7
7
  import { addLabelmapToPlanarGenericViewport, isPlanarNextVolumeViewport, } from './planarGenericVolumeLabelmap.js';
8
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
9
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.displayTools.Labelmap.labelmapRenderPlan.legacyVolumePlan');
8
10
  const { uuidv4 } = utilities;
9
11
  function createLegacyVolumeLabelmapPlan({ config, isVolumeImageMapper, renderMode, segmentation, segmentationId, useSliceRendering, viewport, }) {
10
12
  return createLabelmapRenderPlan({
@@ -72,7 +74,7 @@ async function mountLegacyVolumeLabelmap({ config, labelMapData, segmentation, s
72
74
  if (!baseVolume || !segVolume) {
73
75
  useIndependentComponents = false;
74
76
  blendMode = Enums.BlendModes.MAXIMUM_INTENSITY_BLEND;
75
- console.debug('Independent components unavailable (missing reference or segmentation volume) - falling back to regular volume addition');
77
+ cs3dLogger.debug('Independent components unavailable (missing reference or segmentation volume) - falling back to regular volume addition');
76
78
  }
77
79
  else {
78
80
  const segDims = segVolume.dimensions;
@@ -82,7 +84,7 @@ async function mountLegacyVolumeLabelmap({ config, labelMapData, segmentation, s
82
84
  segDims[2] !== refDims[2]) {
83
85
  useIndependentComponents = false;
84
86
  blendMode = Enums.BlendModes.MAXIMUM_INTENSITY_BLEND;
85
- console.debug('Dimensions mismatch - falling back to regular volume addition');
87
+ cs3dLogger.debug('Dimensions mismatch - falling back to regular volume addition');
86
88
  }
87
89
  }
88
90
  }
@@ -11,6 +11,8 @@ import { getLabelmapActorEntries } from '../../../stateManagement/segmentation/h
11
11
  import getViewportLabelmapRenderMode from '../../../stateManagement/segmentation/helpers/getViewportLabelmapRenderMode.js';
12
12
  import { createLabelmapRepresentationUID } from './labelmapRepresentationUID.js';
13
13
  import removeLabelmapRepresentationData from './removeLabelmapRepresentationData.js';
14
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
15
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.displayTools.Labelmap.syncStackLabelmapActors');
14
16
  export function syncStackLabelmapActors(viewport, segmentationId) {
15
17
  if (typeof viewport
16
18
  .getCurrentImageId !== 'function') {
@@ -55,7 +57,7 @@ export function syncStackLabelmapActors(viewport, segmentationId) {
55
57
  derivedImageIds.forEach((derivedImageId) => {
56
58
  const derivedImage = cache.getImage(derivedImageId);
57
59
  if (!derivedImage) {
58
- console.warn('No derived image found in the cache for segmentation representation', { segmentationId, derivedImageId });
60
+ cs3dLogger.warn('No derived image found in the cache for segmentation representation', { segmentationId, derivedImageId });
59
61
  return;
60
62
  }
61
63
  const segmentationActorEntry = getLabelmapActorEntries(viewport.id, segmentationId)?.find((actorEntry) => actorEntry.referencedId === derivedImageId);
@@ -7,6 +7,8 @@ import { getColorLUT } from '../../../stateManagement/segmentation/getColorLUT.j
7
7
  import { getPolySeg } from '../../../config.js';
8
8
  import { computeAndAddRepresentation } from '../../../utilities/segmentation/computeAndAddRepresentation.js';
9
9
  import { internalGetHiddenSegmentIndices } from '../../../stateManagement/segmentation/helpers/internalGetHiddenSegmentIndices.js';
10
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
11
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.displayTools.Surface.surfaceDisplay');
10
12
  function removeRepresentation(viewportId, segmentationId, renderImmediate = false) {
11
13
  const enabledElement = getEnabledElementByViewportId(viewportId);
12
14
  if (!enabledElement) {
@@ -35,15 +37,15 @@ async function render(viewport, representation) {
35
37
  }
36
38
  }
37
39
  else if (!SurfaceData && !getPolySeg()) {
38
- console.debug(`No surface data found for segmentationId ${segmentationId} and PolySeg add-on is not configured. Unable to convert from other representations to surface. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.`);
40
+ cs3dLogger.debug(`No surface data found for segmentationId ${segmentationId} and PolySeg add-on is not configured. Unable to convert from other representations to surface. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.`);
39
41
  }
40
42
  if (!SurfaceData) {
41
- console.warn(`No Surface data found for segmentationId ${segmentationId}. Skipping render.`);
43
+ cs3dLogger.warn(`No Surface data found for segmentationId ${segmentationId}. Skipping render.`);
42
44
  return;
43
45
  }
44
46
  const { geometryIds } = SurfaceData;
45
47
  if (!geometryIds?.size) {
46
- console.warn(`No Surfaces found for segmentationId ${segmentationId}. Skipping render.`);
48
+ cs3dLogger.warn(`No Surfaces found for segmentationId ${segmentationId}. Skipping render.`);
47
49
  }
48
50
  const { colorLUTIndex } = representation;
49
51
  const colorLUT = getColorLUT(colorLUTIndex);
@@ -51,7 +53,7 @@ async function render(viewport, representation) {
51
53
  geometryIds.forEach((geometryId) => {
52
54
  const geometry = cache.getGeometry(geometryId);
53
55
  if (!geometry?.data) {
54
- console.warn(`No Surfaces found for geometryId ${geometryId}. Skipping render.`);
56
+ cs3dLogger.warn(`No Surfaces found for geometryId ${geometryId}. Skipping render.`);
55
57
  return;
56
58
  }
57
59
  const { segmentIndex } = geometry.data;
@@ -211,11 +211,11 @@ class BrushTool extends LabelmapBaseTool {
211
211
  return;
212
212
  }
213
213
  const memo = this.createMemo(operationData.segmentationId, strategyData.segmentationVoxelManager);
214
- this._previewData.preview = this.applyActiveStrategyCallback(getEnabledElement(this._previewData.element), {
214
+ this._setPreview(this.applyActiveStrategyCallback(getEnabledElement(this._previewData.element), {
215
215
  ...operationData,
216
216
  ...strategyData,
217
217
  memo,
218
- }, StrategyCallbacks.Preview);
218
+ }, StrategyCallbacks.Preview));
219
219
  };
220
220
  this._dragCallback = (evt) => {
221
221
  const eventData = evt.detail;
@@ -279,7 +279,7 @@ class BrushTool extends LabelmapBaseTool {
279
279
  vec3.clone(this._lastDragInfo.world),
280
280
  vec3.clone(currentWorld),
281
281
  ];
282
- this._previewData.preview = this.applyActiveStrategy(enabledElement, operationData);
282
+ this._setPreview(this.applyActiveStrategy(enabledElement, operationData));
283
283
  }
284
284
  const currentCanvasClone = vec2.clone(currentCanvas);
285
285
  this._lastDragInfo = {
@@ -310,10 +310,10 @@ class BrushTool extends LabelmapBaseTool {
310
310
  operationData.strokePointsWorld = this._lazyEdit
311
311
  .getStrokePointsWorld()
312
312
  .map((point) => vec3.clone(point));
313
- this.applyActiveStrategy(enabledElement, operationData);
313
+ this._setPreview(this.applyActiveStrategy(enabledElement, operationData));
314
314
  }
315
315
  else if (!this._previewData.preview && !this._previewData.isDrag) {
316
- this.applyActiveStrategy(enabledElement, operationData);
316
+ this._setPreview(this.applyActiveStrategy(enabledElement, operationData));
317
317
  }
318
318
  this.doneEditMemo();
319
319
  this._deactivateDraw(element);
@@ -467,7 +467,9 @@ class BrushTool extends LabelmapBaseTool {
467
467
  if (!operationData) {
468
468
  return;
469
469
  }
470
- this.applyActiveStrategyCallback(enabledElement, operationData, StrategyCallbacks.RejectPreview);
470
+ if (this._previewData.preview) {
471
+ this.applyActiveStrategyCallback(enabledElement, operationData, StrategyCallbacks.RejectPreview);
472
+ }
471
473
  this._previewData.preview = null;
472
474
  this._previewData.isDrag = false;
473
475
  }
@@ -486,7 +488,7 @@ class BrushTool extends LabelmapBaseTool {
486
488
  if (!enabledElement || !operationData) {
487
489
  return;
488
490
  }
489
- this._previewData.preview = this.applyActiveStrategyCallback(enabledElement, operationData, StrategyCallbacks.Interpolate, config.configuration);
491
+ this._setPreview(this.applyActiveStrategyCallback(enabledElement, operationData, StrategyCallbacks.Interpolate, config.configuration));
490
492
  this._previewData.isDrag = true;
491
493
  }
492
494
  invalidateBrushCursor() {
@@ -19,6 +19,8 @@ import { pointInEllipse } from '../../utilities/math/ellipse/index.js';
19
19
  import { BasicStatsCalculator } from '../../utilities/math/basic/index.js';
20
20
  import { filterAnnotationsWithinSamePlane } from '../../utilities/planar/index.js';
21
21
  import { getPixelValueUnits } from '../../utilities/getPixelValueUnits.js';
22
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
23
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.segmentation.CircleROIStartEndThresholdTool');
22
24
  const { transformWorldToIndex } = csUtils;
23
25
  class CircleROIStartEndThresholdTool extends CircleROITool {
24
26
  constructor(toolProps = {}, defaultToolProps = {
@@ -227,7 +229,7 @@ class CircleROIStartEndThresholdTool extends CircleROITool {
227
229
  }
228
230
  }
229
231
  if (!viewport.getRenderingEngine()) {
230
- console.warn('Rendering Engine has been destroyed');
232
+ cs3dLogger.warn('Rendering Engine has been destroyed');
231
233
  return renderStatus;
232
234
  }
233
235
  let activeHandleCanvasCoords;
@@ -14,6 +14,8 @@ import LabelmapBaseTool from './LabelmapBaseTool.js';
14
14
  import { getOrCreateLabelmapVolume, resolveLabelmapForSegment, } from '../../stateManagement/segmentation/helpers/labelmapSegmentationState.js';
15
15
  import getEllipseWorldCoordinates from '../../utilities/getEllipseWorldCoordinates.js';
16
16
  import getCenterAndRadiusInCanvas from '../../utilities/getCenterAndRadiusInCanvas.js';
17
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
18
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.segmentation.CircleScissorsTool');
17
19
  class CircleScissorsTool extends LabelmapBaseTool {
18
20
  constructor(toolProps = {}, defaultToolProps = {
19
21
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -206,7 +208,7 @@ class CircleScissorsTool extends LabelmapBaseTool {
206
208
  const { center, radius } = getCenterAndRadiusInCanvas(points, viewport);
207
209
  const color = `rgb(${toolMetadata.segmentColor.slice(0, 3)})`;
208
210
  if (!viewport.getRenderingEngine()) {
209
- console.warn('Rendering Engine has been destroyed');
211
+ cs3dLogger.warn('Rendering Engine has been destroyed');
210
212
  return renderStatus;
211
213
  }
212
214
  const circleUID = '0';
@@ -72,6 +72,7 @@ export default class LabelmapBaseTool extends BaseTool {
72
72
  protected _cancelTouchDraw(element: HTMLDivElement): void;
73
73
  protected _historyRedoHandler(evt: any): void;
74
74
  protected get _previewData(): PreviewData;
75
+ protected _setPreview(results: any): void;
75
76
  hasPreviewData(): boolean;
76
77
  shouldResolvePreviewRequests(): boolean;
77
78
  createMemo(segmentationId: string, segmentationVoxelManager: any): LabelmapMemo.LabelmapMemo;
@@ -67,6 +67,9 @@ class LabelmapBaseTool extends BaseTool {
67
67
  get _previewData() {
68
68
  return LabelmapBaseTool.previewData;
69
69
  }
70
+ _setPreview(results) {
71
+ this._previewData.preview = results?.modified ? results : null;
72
+ }
70
73
  hasPreviewData() {
71
74
  return !!this._previewData.preview;
72
75
  }
@@ -291,7 +294,9 @@ class LabelmapBaseTool extends BaseTool {
291
294
  if (!enabledElement || !operationData) {
292
295
  return;
293
296
  }
294
- this.applyActiveStrategyCallback(enabledElement, operationData, StrategyCallbacks.RejectPreview);
297
+ if (this._previewData.preview) {
298
+ this.applyActiveStrategyCallback(enabledElement, operationData, StrategyCallbacks.RejectPreview);
299
+ }
295
300
  this._previewData.preview = null;
296
301
  this._previewData.isDrag = false;
297
302
  }
@@ -4,6 +4,8 @@ import PlanarFreehandContourSegmentationTool from '../annotation/PlanarFreehandC
4
4
  import BrushTool from './BrushTool.js';
5
5
  import * as segmentation from '../../stateManagement/segmentation/index.js';
6
6
  import { getSegmentationRepresentationsBySegmentationId } from '../../stateManagement/segmentation/getSegmentationRepresentation.js';
7
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
8
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.segmentation.LabelmapEditWithContour');
7
9
  class LabelMapEditWithContourTool extends PlanarFreehandContourSegmentationTool {
8
10
  constructor(toolProps = {}) {
9
11
  const initialProps = utilities.deepMerge({
@@ -41,7 +43,7 @@ class LabelMapEditWithContourTool extends PlanarFreehandContourSegmentationTool
41
43
  }
42
44
  const activeSeg = segmentation.getActiveSegmentation(viewportId);
43
45
  if (!activeSeg) {
44
- console.log('No active segmentation detected');
46
+ cs3dLogger.info('No active segmentation detected');
45
47
  return false;
46
48
  }
47
49
  const segmentationId = activeSeg.segmentationId;
@@ -7,6 +7,8 @@ import floodFill from '../../utilities/segmentation/floodFill.js';
7
7
  import { getCurrentLabelmapImageIdForViewport, getSegmentation, } from '../../stateManagement/segmentation/segmentationState.js';
8
8
  import getViewportLabelmapRenderMode from '../../stateManagement/segmentation/helpers/getViewportLabelmapRenderMode.js';
9
9
  import { getOrCreateLabelmapVolume, resolveLabelmapForSegment, } from '../../stateManagement/segmentation/helpers/labelmapSegmentationState.js';
10
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
11
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.segmentation.PaintFillTool');
10
12
  const { transformWorldToIndex, isEqual } = csUtils;
11
13
  class PaintFillTool extends BaseTool {
12
14
  constructor(toolProps = {}, defaultToolProps = {
@@ -60,7 +62,7 @@ class PaintFillTool extends BaseTool {
60
62
  }
61
63
  const fixedDimension = this.getFixedDimension(viewPlaneNormal, direction);
62
64
  if (fixedDimension === undefined) {
63
- console.warn('Oblique paint fill not yet supported');
65
+ cs3dLogger.warn('Oblique paint fill not yet supported');
64
66
  return;
65
67
  }
66
68
  const { floodFillGetter, getLabelValue, getScalarDataPositionFromPlane, inPlaneSeedPoint, fixedDimensionValue, } = this.generateHelpers(voxelManager, dimensions, index, fixedDimension);
@@ -17,6 +17,8 @@ import { isViewportPreScaled } from '../../utilities/viewport/isViewportPreScale
17
17
  import { BasicStatsCalculator } from '../../utilities/math/basic/index.js';
18
18
  import { filterAnnotationsWithinSamePlane } from '../../utilities/planar/index.js';
19
19
  import { getPixelValueUnits } from '../../utilities/getPixelValueUnits.js';
20
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
21
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.segmentation.RectangleROIStartEndThresholdTool');
20
22
  const { transformWorldToIndex } = csUtils;
21
23
  class RectangleROIStartEndThresholdTool extends RectangleROITool {
22
24
  constructor(toolProps = {}, defaultToolProps = {
@@ -206,7 +208,7 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
206
208
  firstOrLastSlice = true;
207
209
  }
208
210
  if (!viewport.getRenderingEngine()) {
209
- console.warn('Rendering Engine has been destroyed');
211
+ cs3dLogger.warn('Rendering Engine has been destroyed');
210
212
  return renderStatus;
211
213
  }
212
214
  let activeHandleCanvasCoords;
@@ -8,6 +8,8 @@ import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnota
8
8
  import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility.js';
9
9
  import { triggerAnnotationModified } from '../../stateManagement/annotation/helpers/state.js';
10
10
  import RectangleROITool from '../annotation/RectangleROITool.js';
11
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
12
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.segmentation.RectangleROIThresholdTool');
11
13
  class RectangleROIThresholdTool extends RectangleROITool {
12
14
  constructor(toolProps = {}, defaultToolProps = {
13
15
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -110,7 +112,7 @@ class RectangleROIThresholdTool extends RectangleROITool {
110
112
  const lineDash = this.getStyle('lineDash', styleSpecifier, annotation);
111
113
  const color = this.getStyle('color', styleSpecifier, annotation);
112
114
  if (!viewport.getRenderingEngine()) {
113
- console.warn('Rendering Engine has been destroyed');
115
+ cs3dLogger.warn('Rendering Engine has been destroyed');
114
116
  return renderStatus;
115
117
  }
116
118
  triggerAnnotationModified(annotation, element);
@@ -13,6 +13,8 @@ import { getCurrentLabelmapImageIdForViewport, getSegmentation, } from '../../st
13
13
  import getViewportLabelmapRenderMode from '../../stateManagement/segmentation/helpers/getViewportLabelmapRenderMode.js';
14
14
  import LabelmapBaseTool from './LabelmapBaseTool.js';
15
15
  import { getOrCreateLabelmapVolume, resolveLabelmapForSegment, } from '../../stateManagement/segmentation/helpers/labelmapSegmentationState.js';
16
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
17
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.segmentation.RectangleScissorsTool');
16
18
  class RectangleScissorsTool extends LabelmapBaseTool {
17
19
  constructor(toolProps = {}, defaultToolProps = {
18
20
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -224,7 +226,7 @@ class RectangleScissorsTool extends LabelmapBaseTool {
224
226
  const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
225
227
  const color = `rgb(${toolMetadata.segmentColor.slice(0, 3)})`;
226
228
  if (!viewport.getRenderingEngine()) {
227
- console.warn('Rendering Engine has been destroyed');
229
+ cs3dLogger.warn('Rendering Engine has been destroyed');
228
230
  return renderStatus;
229
231
  }
230
232
  const rectangleUID = '0';