@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
@@ -1,6 +1,7 @@
1
1
  import { StackViewport, utilities as csUtils } from '@cornerstonejs/core';
2
2
  import { vec3 } from 'gl-matrix';
3
3
  import getViewportICamera from '../../getViewportICamera.js';
4
+ const { getEffectiveSpacingAlongDirection } = csUtils;
4
5
  const EPSILON = 1e-3;
5
6
  const getSubPixelSpacingAndXYDirections = (viewport, subPixelResolution) => {
6
7
  let spacing;
@@ -25,8 +26,11 @@ const getSubPixelSpacingAndXYDirections = (viewport, subPixelResolution) => {
25
26
  const iVector = direction.slice(0, 3);
26
27
  const jVector = direction.slice(3, 6);
27
28
  const kVector = direction.slice(6, 9);
29
+ const normalizedViewUp = vec3.create();
30
+ vec3.normalize(normalizedViewUp, viewUp);
28
31
  const viewRight = vec3.create();
29
- vec3.cross(viewRight, viewUp, viewPlaneNormal);
32
+ vec3.cross(viewRight, normalizedViewUp, viewPlaneNormal);
33
+ vec3.normalize(viewRight, viewRight);
30
34
  const absViewRightDotI = Math.abs(vec3.dot(viewRight, iVector));
31
35
  const absViewRightDotJ = Math.abs(vec3.dot(viewRight, jVector));
32
36
  const absViewRightDotK = Math.abs(vec3.dot(viewRight, kVector));
@@ -44,11 +48,12 @@ const getSubPixelSpacingAndXYDirections = (viewport, subPixelResolution) => {
44
48
  xDir = kVector;
45
49
  }
46
50
  else {
47
- throw new Error('No support yet for oblique plane planar contours');
51
+ xSpacing = getEffectiveSpacingAlongDirection(imageData, viewRight);
52
+ xDir = Array.from(viewRight);
48
53
  }
49
- const absViewUpDotI = Math.abs(vec3.dot(viewUp, iVector));
50
- const absViewUpDotJ = Math.abs(vec3.dot(viewUp, jVector));
51
- const absViewUpDotK = Math.abs(vec3.dot(viewUp, kVector));
54
+ const absViewUpDotI = Math.abs(vec3.dot(normalizedViewUp, iVector));
55
+ const absViewUpDotJ = Math.abs(vec3.dot(normalizedViewUp, jVector));
56
+ const absViewUpDotK = Math.abs(vec3.dot(normalizedViewUp, kVector));
52
57
  let ySpacing;
53
58
  if (Math.abs(1 - absViewUpDotI) < EPSILON) {
54
59
  ySpacing = volumeSpacing[0];
@@ -63,7 +68,8 @@ const getSubPixelSpacingAndXYDirections = (viewport, subPixelResolution) => {
63
68
  yDir = kVector;
64
69
  }
65
70
  else {
66
- throw new Error('No support yet for oblique plane planar contours');
71
+ ySpacing = getEffectiveSpacingAlongDirection(imageData, normalizedViewUp);
72
+ yDir = Array.from(normalizedViewUp);
67
73
  }
68
74
  spacing = [xSpacing, ySpacing];
69
75
  }
@@ -2,6 +2,8 @@ import { vec2 } from 'gl-matrix';
2
2
  import containsPoint from './containsPoint.js';
3
3
  import getSignedArea from './getSignedArea.js';
4
4
  import { EPSILON, IntersectionDirection, pointsAreEqual, PolylineNodeType, robustSegmentIntersection, } from './robustSegmentIntersection.js';
5
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
6
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('utilities.math.polyline.intersectPolylines');
5
7
  export default function intersectPolylines(mainPolyCoords, clipPolyCoordsInput) {
6
8
  if (mainPolyCoords.length < 3 || clipPolyCoordsInput.length < 3) {
7
9
  return [];
@@ -213,12 +215,12 @@ export default function intersectPolylines(mainPolyCoords, clipPolyCoordsInput)
213
215
  clipAugmented.forEach((n) => (n.processedInPath = false));
214
216
  do {
215
217
  if (safetyBreak++ > maxIter) {
216
- console.warn('Intersection: Max iterations in path tracing.', pathStartNode.id, currentNode.id);
218
+ cs3dLogger.warn('Intersection: Max iterations in path tracing.', pathStartNode.id, currentNode.id);
217
219
  currentPathCoords = [];
218
220
  break;
219
221
  }
220
222
  if (currentNode.processedInPath && currentNode !== pathStartNode) {
221
- console.warn('Intersection: Path processing loop detected, discarding path segment.', pathStartNode.id, currentNode.id);
223
+ cs3dLogger.warn('Intersection: Path processing loop detected, discarding path segment.', pathStartNode.id, currentNode.id);
222
224
  currentPathCoords = [];
223
225
  break;
224
226
  }
@@ -3,6 +3,8 @@ import getSignedArea from './getSignedArea.js';
3
3
  import { EPSILON, IntersectionDirection, pointsAreEqual, PolylineNodeType, robustSegmentIntersection, } from './robustSegmentIntersection.js';
4
4
  import containsPoint from './containsPoint.js';
5
5
  import arePolylinesIdentical from './arePolylinesIdentical.js';
6
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
7
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('utilities.math.polyline.subtractPolylines');
6
8
  export default function subtractPolylines(targetPolylineCoords, sourcePolylineCoordsInput) {
7
9
  if (targetPolylineCoords.length < 3) {
8
10
  return [];
@@ -169,7 +171,7 @@ export default function subtractPolylines(targetPolylineCoords, sourcePolylineCo
169
171
  const maxIter = (targetAugmented.length + sourceAugmented.length) * 2;
170
172
  do {
171
173
  if (safetyBreak++ > maxIter) {
172
- console.warn('Subtraction: Max iterations reached, possible infinite loop.');
174
+ cs3dLogger.warn('Subtraction: Max iterations reached, possible infinite loop.');
173
175
  break;
174
176
  }
175
177
  currentNode.visited = true;
@@ -191,7 +193,7 @@ export default function subtractPolylines(targetPolylineCoords, sourcePolylineCo
191
193
  onTargetList = true;
192
194
  }
193
195
  else {
194
- console.warn('Subtraction: Intersection on source without partner.');
196
+ cs3dLogger.warn('Subtraction: Intersection on source without partner.');
195
197
  }
196
198
  }
197
199
  }
@@ -0,0 +1,44 @@
1
+ import type { Types } from '@cornerstonejs/core';
2
+ import { utilities as csUtils } from '@cornerstonejs/core';
3
+ export type AreaAnnotationVolume = {
4
+ dimensions: Types.Point3;
5
+ direction: Types.Mat3;
6
+ spacing: Types.Point3;
7
+ origin: Types.Point3;
8
+ };
9
+ export type AreaAnnotationShape = csUtils.voxelSlab.VoxelSlabShape;
10
+ export type AreaAnnotationVoxel = {
11
+ value: number;
12
+ pointLPS: Types.Point3;
13
+ pointIJK: Types.Point3;
14
+ };
15
+ export interface AreaAnnotationVoxelsOptions {
16
+ annotation: {
17
+ metadata?: {
18
+ viewPlaneNormal?: Types.Point3;
19
+ planeRestriction?: {
20
+ referencePlaneThickness?: number;
21
+ inPlaneVector1?: Types.Point3;
22
+ inPlaneVector2?: Types.Point3;
23
+ };
24
+ };
25
+ };
26
+ image: AreaAnnotationVolume & {
27
+ imageData: any;
28
+ };
29
+ voxelManager: {
30
+ getAtIJKPoint(ijk: Types.Point3): number;
31
+ };
32
+ points: Types.Point3[];
33
+ boundsMargin?: number;
34
+ createShape: (args: {
35
+ volume: AreaAnnotationVolume;
36
+ planePoint: Types.Point3;
37
+ viewPlaneNormal: Types.Point3;
38
+ }) => AreaAnnotationShape | null | undefined;
39
+ planePoint?: Types.Point3;
40
+ minimumPoints?: number;
41
+ onSample?: (sample: AreaAnnotationVoxel) => void;
42
+ storePointData?: boolean;
43
+ }
44
+ export default function sampleAreaAnnotationVoxels({ annotation, image, voxelManager, points, boundsMargin, createShape, planePoint: planePointOverride, minimumPoints, onSample, storePointData, }: AreaAnnotationVoxelsOptions): AreaAnnotationVoxel[];
@@ -0,0 +1,63 @@
1
+ import { vec3 } from 'gl-matrix';
2
+ import { utilities as csUtils } from '@cornerstonejs/core';
3
+ import { getBoundingBoxAroundShapeIJK } from './boundingBox/index.js';
4
+ const { asUnitNormal, getMembershipHalfWidth, getVoxelThicknessAlongNormal, resolveReferencePlaneThickness, sampleVoxelsInShape, } = csUtils.voxelSlab;
5
+ export default function sampleAreaAnnotationVoxels({ annotation, image, voxelManager, points, boundsMargin = 0, createShape, planePoint: planePointOverride, minimumPoints = 3, onSample, storePointData, }) {
6
+ const viewPlaneNormal = resolveAnnotationNormal(annotation?.metadata);
7
+ if (!voxelManager ||
8
+ !image ||
9
+ !viewPlaneNormal ||
10
+ !(points?.length >= minimumPoints)) {
11
+ return [];
12
+ }
13
+ const planePoint = planePointOverride ?? points[0];
14
+ const { dimensions, direction, spacing, origin, imageData } = image;
15
+ const volume = { dimensions, direction, spacing, origin };
16
+ const voxelThickness = getVoxelThicknessAlongNormal(volume, viewPlaneNormal);
17
+ const referencePlaneThickness = resolveReferencePlaneThickness(annotation.metadata?.planeRestriction?.referencePlaneThickness, voxelThickness);
18
+ const shape = createShape({ volume, planePoint, viewPlaneNormal });
19
+ if (!shape) {
20
+ return [];
21
+ }
22
+ const slabThickness = shape.getRequiredThickness() || referencePlaneThickness;
23
+ return sampleVoxelsInShape({
24
+ volume,
25
+ planePoint,
26
+ viewPlaneNormal,
27
+ referencePlaneThickness: slabThickness,
28
+ bounds: getAnnotationIndexBounds(points, volume, imageData, viewPlaneNormal, getMembershipHalfWidth(slabThickness, voxelThickness), boundsMargin),
29
+ getShapeRuns: shape.getRuns,
30
+ voxelManager,
31
+ onSample,
32
+ storePointData,
33
+ });
34
+ }
35
+ function resolveAnnotationNormal(metadata) {
36
+ const recorded = metadata?.viewPlaneNormal;
37
+ if (recorded && vec3.squaredLength(recorded) > 0) {
38
+ return asUnitNormal(recorded);
39
+ }
40
+ const { inPlaneVector1, inPlaneVector2 } = metadata?.planeRestriction ?? {};
41
+ if (!inPlaneVector1 || !inPlaneVector2) {
42
+ return undefined;
43
+ }
44
+ const normal = vec3.cross(vec3.create(), inPlaneVector1, inPlaneVector2);
45
+ return vec3.squaredLength(normal) > 0
46
+ ? asUnitNormal(normal)
47
+ : undefined;
48
+ }
49
+ function getAnnotationIndexBounds(points, volume, imageData, viewPlaneNormal, halfWidth, margin) {
50
+ const { dimensions, direction, spacing } = volume;
51
+ const indexPoints = points.map((point) => imageData.worldToIndex(point));
52
+ const boundingBox = getBoundingBoxAroundShapeIJK(indexPoints);
53
+ return [0, 1, 2].map((axis) => {
54
+ const axisVector = direction.slice(axis * 3, axis * 3 + 3);
55
+ const dilation = Math.ceil((margin +
56
+ halfWidth * Math.abs(vec3.dot(axisVector, viewPlaneNormal))) /
57
+ spacing[axis]) + 1;
58
+ return [
59
+ Math.max(0, Math.floor(boundingBox[axis][0]) - dilation),
60
+ Math.min(dimensions[axis] - 1, Math.ceil(boundingBox[axis][1]) + dilation),
61
+ ];
62
+ });
63
+ }
@@ -7,6 +7,8 @@ import deleteRelatedAnnotations from './deleteRelatedAnnotations.js';
7
7
  import ChangeTypes from '../../../enums/ChangeTypes.js';
8
8
  import getViewportForAnnotation from '../../getViewportForAnnotation.js';
9
9
  import { addContourSegmentationAnnotation } from '../../contourSegmentation/addContourSegmentationAnnotation.js';
10
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
11
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('utilities.segmentation.InterpolationManager.InterpolationManager');
10
12
  const { uuidv4 } = csUtils;
11
13
  const ChangeTypesForInterpolation = [
12
14
  ChangeTypes.HandlesUpdated,
@@ -70,7 +72,7 @@ InterpolationManager.handleAnnotationCompleted = (evt) => {
70
72
  }
71
73
  const viewport = getViewportForAnnotation(annotation);
72
74
  if (!viewport) {
73
- console.warn('Unable to find viewport for', annotation);
75
+ cs3dLogger.warn('Unable to find viewport for', annotation);
74
76
  return;
75
77
  }
76
78
  const sliceData = getSliceData(viewport);
@@ -134,7 +136,7 @@ InterpolationManager.handleAnnotationUpdate = (evt) => {
134
136
  }
135
137
  const viewport = getViewportForAnnotation(annotation);
136
138
  if (!viewport) {
137
- console.warn('Unable to find matching viewport for annotation interpolation', annotation);
139
+ cs3dLogger.warn('Unable to find matching viewport for annotation interpolation', annotation);
138
140
  return;
139
141
  }
140
142
  if (annotation.autoGenerated) {
@@ -162,7 +164,7 @@ InterpolationManager.handleAnnotationDelete = (evt) => {
162
164
  }
163
165
  const viewport = getViewportForAnnotation(annotation);
164
166
  if (!viewport) {
165
- console.warn("No viewport, can't delete interpolated results", annotation);
167
+ cs3dLogger.warn("No viewport, can't delete interpolated results", annotation);
166
168
  return;
167
169
  }
168
170
  const sliceData = getSliceData(viewport);
@@ -45,6 +45,9 @@ async function calculateVolumeStatistics({ operationData, indices, unit, mode, }
45
45
  return VolumetricCalculator.getStatistics({ spacing });
46
46
  }
47
47
  const segmentationScalarData = segmentationVoxelManager.getCompleteScalarDataArray();
48
+ if (!segmentationScalarData?.length) {
49
+ return;
50
+ }
48
51
  const segmentationInfo = {
49
52
  scalarData: segmentationScalarData,
50
53
  dimensions: segmentationImageData.getDimensions(),
@@ -9,14 +9,19 @@ import { getViewportVoiMappingForVolume } from './getViewportVoiMappingForVolume
9
9
  const { transformWorldToIndex, mapScalarToViewportVoiIntensity, mapMappedBandToRawRange, } = csUtils;
10
10
  const { growCutLog: log } = csUtils.logger;
11
11
  const ENABLE_VERBOSE_FLOOD_FILL_LOGS = false;
12
+ const timingStarts = new Map();
12
13
  const timeStart = (label) => {
13
14
  if (ENABLE_VERBOSE_FLOOD_FILL_LOGS) {
14
- console.time(label);
15
+ timingStarts.set(label, performance.now());
15
16
  }
16
17
  };
17
18
  const timeEnd = (label) => {
18
19
  if (ENABLE_VERBOSE_FLOOD_FILL_LOGS) {
19
- console.timeEnd(label);
20
+ const start = timingStarts.get(label);
21
+ if (start !== undefined) {
22
+ log.debug(`${label}: ${performance.now() - start}ms`);
23
+ timingStarts.delete(label);
24
+ }
20
25
  }
21
26
  };
22
27
  const FLOOD_FILL_PREP_TIMING_LABEL = 'cornerstone.tools: floodFill: prep';
@@ -289,7 +294,7 @@ async function runFloodFillSegmentation({ referencedVolumeId, worldPosition, vie
289
294
  ...diagnostics,
290
295
  });
291
296
  if (ENABLE_VERBOSE_FLOOD_FILL_LOGS) {
292
- console.info('[cornerstone-tools] flood fill intensity range', {
297
+ log.info('[cornerstone-tools] flood fill intensity range', {
293
298
  rawMin: clampedRangeMin,
294
299
  rawMax: clampedRangeMax,
295
300
  strategy: diagnostics.strategy,
@@ -326,7 +331,7 @@ async function runFloodFillSegmentation({ referencedVolumeId, worldPosition, vie
326
331
  }
327
332
  }
328
333
  if (ENABLE_VERBOSE_FLOOD_FILL_LOGS) {
329
- console.info('[cornerstone-tools] flood fill seed + effective tolerance', {
334
+ log.info('[cornerstone-tools] flood fill seed + effective tolerance', {
330
335
  seedScalar,
331
336
  effectiveMin: positiveMin,
332
337
  effectiveMax: positiveMax,
@@ -504,7 +509,7 @@ async function runFloodFillSegmentation({ referencedVolumeId, worldPosition, vie
504
509
  otherCount += 1;
505
510
  }
506
511
  }
507
- console.info('[cornerstone-tools] flood fill final voxel check', {
512
+ log.info('[cornerstone-tools] flood fill final voxel check', {
508
513
  floodedPoints: floodedPoints.length,
509
514
  segmentIndex,
510
515
  paintIndex,
@@ -1,5 +1,7 @@
1
1
  import { cache } from '@cornerstonejs/core';
2
2
  import shaderCode from './growCutShader.js';
3
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
4
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('utilities.segmentation.growCut.runGrowCut');
3
5
  const GB = 1024 * 1024 * 1024;
4
6
  const WEBGPU_MEMORY_LIMIT = 1.99 * GB;
5
7
  const DEFAULT_GROWCUT_OPTIONS = {
@@ -273,7 +275,7 @@ async function runGrowCut(referenceVolumeId, labelmapVolumeId, options = DEFAULT
273
275
  }
274
276
  }
275
277
  if (limitProcessingTime && performance.now() > limitProcessingTime) {
276
- console.warn(`Exceeded processing time limit (${maxProcessingTime})ms`);
278
+ cs3dLogger.warn(`Exceeded processing time limit (${maxProcessingTime})ms`);
277
279
  break;
278
280
  }
279
281
  }
@@ -3,6 +3,8 @@ import { utilities as csUtils, cache, volumeLoader } from '@cornerstonejs/core';
3
3
  import getViewportICamera from '../../getViewportICamera.js';
4
4
  import { run } from './runGrowCut.js';
5
5
  import { getSphereBoundsInfo } from '../../getSphereBoundsInfo.js';
6
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
7
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('utilities.segmentation.growCut.runGrowCutForSphere');
6
8
  const { transformWorldToIndex } = csUtils;
7
9
  const POSITIVE_SEED_VALUE = 254;
8
10
  const NEGATIVE_SEED_VALUE = 255;
@@ -36,7 +38,7 @@ function _createSubVolumeFromSphere(referencedVolume, sphereInfo, viewport) {
36
38
  !csUtils.isEqual(Math.abs(vec[1]), 1) &&
37
39
  !csUtils.isEqual(Math.abs(vec[2]), 1));
38
40
  if (obliqueView) {
39
- console.warn('Oblique view is not supported!');
41
+ cs3dLogger.warn('Oblique view is not supported!');
40
42
  return;
41
43
  }
42
44
  const { boundsIJK: sphereBoundsIJK } = _getSphereBoundsInfo(referencedVolume, sphereInfo);
@@ -1,6 +1,8 @@
1
1
  import { utilities as csUtils, cache, volumeLoader } from '@cornerstonejs/core';
2
2
  import { run } from './runGrowCut.js';
3
3
  import { POSITIVE_SEED_LABEL, NEGATIVE_SEED_LABEL, DEFAULT_NEIGHBORHOOD_RADIUS, DEFAULT_POSITIVE_STD_DEV_MULTIPLIER, DEFAULT_NEGATIVE_STD_DEV_MULTIPLIER, DEFAULT_NEGATIVE_SEED_MARGIN, DEFAULT_NEGATIVE_SEEDS_COUNT, MAX_NEGATIVE_SEED_ATTEMPTS_MULTIPLIER, } from './constants.js';
4
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
5
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('utilities.segmentation.growCut.runOneClickGrowCut');
4
6
  const { transformWorldToIndex } = csUtils;
5
7
  const MAX_POSITIVE_SEEDS = 100000;
6
8
  function calculateGrowCutSeeds(referencedVolume, worldPosition, options) {
@@ -22,7 +24,7 @@ function calculateGrowCutSeeds(referencedVolume, worldPosition, options) {
22
24
  ijkStart[1] >= height ||
23
25
  ijkStart[2] < 0 ||
24
26
  ijkStart[2] >= numSlices) {
25
- console.warn('Click position is outside volume bounds.');
27
+ cs3dLogger.warn('Click position is outside volume bounds.');
26
28
  return null;
27
29
  }
28
30
  const initialStats = csUtils.calculateNeighborhoodStats(scalarData, dimensions, ijkStart, neighborhoodRadius);
@@ -54,7 +56,7 @@ function calculateGrowCutSeeds(referencedVolume, worldPosition, options) {
54
56
  minZ = maxZ = ijkStart[2];
55
57
  }
56
58
  else {
57
- console.warn('Clicked voxel intensity is outside the calculated positive range. No positive seeds generated.');
59
+ cs3dLogger.warn('Clicked voxel intensity is outside the calculated positive range. No positive seeds generated.');
58
60
  return { positiveSeedIndices: new Set(), negativeSeedIndices: new Set() };
59
61
  }
60
62
  let currentQueueIndex = 0;
@@ -95,10 +97,10 @@ function calculateGrowCutSeeds(referencedVolume, worldPosition, options) {
95
97
  }
96
98
  }
97
99
  if (positiveSeedIndices.size >= MAX_POSITIVE_SEEDS) {
98
- console.debug(`Reached maximum number of positive seeds (${MAX_POSITIVE_SEEDS}). Stopping BFS.`);
100
+ cs3dLogger.debug(`Reached maximum number of positive seeds (${MAX_POSITIVE_SEEDS}). Stopping BFS.`);
99
101
  }
100
102
  if (positiveSeedIndices.size === 0) {
101
- console.warn('No positive seeds found after BFS.');
103
+ cs3dLogger.warn('No positive seeds found after BFS.');
102
104
  return { positiveSeedIndices: new Set(), negativeSeedIndices: new Set() };
103
105
  }
104
106
  let positiveSum = 0;
@@ -161,10 +163,10 @@ function calculateGrowCutSeeds(referencedVolume, worldPosition, options) {
161
163
  }
162
164
  }
163
165
  if (negativeSeedIndices.size === 0) {
164
- console.warn('Could not find any negative seeds. GrowCut might fail or produce poor results.');
166
+ cs3dLogger.warn('Could not find any negative seeds. GrowCut might fail or produce poor results.');
165
167
  }
166
- console.debug('positiveSeedIndices', positiveSeedIndices.size);
167
- console.debug('negativeSeedIndices', negativeSeedIndices.size);
168
+ cs3dLogger.debug('positiveSeedIndices', positiveSeedIndices.size);
169
+ cs3dLogger.debug('negativeSeedIndices', negativeSeedIndices.size);
168
170
  return { positiveSeedIndices, negativeSeedIndices };
169
171
  }
170
172
  async function runOneClickGrowCut({ referencedVolumeId, worldPosition, options, }) {
@@ -186,7 +188,7 @@ async function runOneClickGrowCut({ referencedVolumeId, worldPosition, options,
186
188
  if (positiveSeedIndices.size < 10 ||
187
189
  positiveSeedIndices.size > MAX_POSITIVE_SEEDS ||
188
190
  negativeSeedIndices.size < 10) {
189
- console.warn('Not enough seeds found. GrowCut might fail or produce poor results.');
191
+ cs3dLogger.warn('Not enough seeds found. GrowCut might fail or produce poor results.');
190
192
  return labelmap;
191
193
  }
192
194
  positiveSeedIndices.forEach((index) => {
@@ -1,5 +1,7 @@
1
1
  import { cache } from '@cornerstonejs/core';
2
2
  import { vec3 } from 'gl-matrix';
3
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
4
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('utilities.segmentation.isLineInSegment');
3
5
  export default function isLineInSegment(point1, point2, isInSegment) {
4
6
  const ijk1 = isInSegment.toIJK(point1);
5
7
  const ijk2 = isInSegment.toIJK(point2);
@@ -43,7 +45,7 @@ function createIsInSegmentMetadata({ dimensions, imageData, voxelManager, segmen
43
45
  function createIsInSegment(segVolumeId, segmentIndex, containedSegmentIndices) {
44
46
  const vol = cache.getVolume(segVolumeId);
45
47
  if (!vol) {
46
- console.warn(`No volume found for ${segVolumeId}`);
48
+ cs3dLogger.warn(`No volume found for ${segVolumeId}`);
47
49
  return;
48
50
  }
49
51
  return createIsInSegmentMetadata({
@@ -1,5 +1,7 @@
1
1
  import { utilities } from '@cornerstonejs/core';
2
2
  import normalizeViewportPlane from '../normalizeViewportPlane.js';
3
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
4
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('utilities.segmentation.islandRemoval');
3
5
  const { RLEVoxelMap, VoxelManager } = utilities;
4
6
  const MAX_IMAGE_SIZE = 65535;
5
7
  export var SegmentationEnum;
@@ -43,7 +45,7 @@ export default class IslandRemoval {
43
45
  }
44
46
  const { toIJK, fromIJK, boundsIJKPrime, error } = normalizeViewportPlane(viewport, boundsIJK);
45
47
  if (error) {
46
- console.warn('Not performing island removal for planes not orthogonal to acquisition plane', error);
48
+ cs3dLogger.warn('Not performing island removal for planes not orthogonal to acquisition plane', error);
47
49
  return;
48
50
  }
49
51
  const [width, height, depth] = fromIJK(segmentationVoxelManager.dimensions);
@@ -5,8 +5,10 @@ import createBidirectionalToolData from './createBidirectionalToolData.js';
5
5
  import BidirectionalTool from '../../tools/annotation/BidirectionalTool.js';
6
6
  import { getSegmentations } from '../../stateManagement/segmentation/getSegmentations.js';
7
7
  import { getActiveSegmentIndex } from '../../stateManagement/segmentation/getActiveSegmentIndex.js';
8
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
9
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('utilities.segmentation.segmentContourAction');
8
10
  export default async function segmentContourAction(element, configuration) {
9
- console.warn('Deprecation Alert: There is a new getSegmentLargestBidirectional function that handles volume, stack and individual segment cases properly. This function is deprecated and will be removed in a future version.');
11
+ cs3dLogger.warn('Deprecation Alert: There is a new getSegmentLargestBidirectional function that handles volume, stack and individual segment cases properly. This function is deprecated and will be removed in a future version.');
10
12
  const { data: configurationData } = configuration;
11
13
  const enabledElement = getEnabledElement(element);
12
14
  const segment = (configurationData.getSegment || defaultGetSegment)(enabledElement, configurationData);
@@ -73,7 +75,7 @@ export default async function segmentContourAction(element, configuration) {
73
75
  enabledElement.viewport.render();
74
76
  }
75
77
  else {
76
- console.warn('No bidirectional found');
78
+ cs3dLogger.warn('No bidirectional found');
77
79
  }
78
80
  return newBidirectional;
79
81
  }
@@ -11,9 +11,16 @@ export declare const getSegmentationDataForWorker: (segmentationId: any, segment
11
11
  indices: any;
12
12
  };
13
13
  export declare const prepareVolumeStrategyDataForWorker: (operationData: any) => {
14
- segmentationImageData: any;
14
+ segmentationImageData: import("@kitware/vtk.js/Common/DataModel/ImageData").vtkImageData;
15
+ segmentationVoxelManager: import("packages/core/dist/esm/types").IVoxelManager<number> | import("packages/core/dist/esm/types").IVoxelManager<import("packages/core/dist/esm/types").RGB>;
15
16
  segmentationScalarData: any;
16
17
  imageScalarData: any;
18
+ imageVoxelManager: any;
19
+ imageData: any;
20
+ } | {
21
+ segmentationImageData: any;
22
+ readonly segmentationScalarData: unknown;
23
+ imageScalarData: any;
17
24
  segmentationVoxelManager: any;
18
25
  imageVoxelManager: any;
19
26
  imageData: any;
@@ -4,6 +4,8 @@ import { getSegmentation } from '../../stateManagement/segmentation/getSegmentat
4
4
  import { getStrategyData } from '../../tools/segmentation/strategies/utils/getStrategyData.js';
5
5
  import ensureSegmentationVolume from '../../tools/segmentation/strategies/compositions/ensureSegmentationVolume.js';
6
6
  import ensureImageVolume from '../../tools/segmentation/strategies/compositions/ensureImageVolume.js';
7
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
8
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('utilities.segmentation.utilsForWorker');
7
9
  export const triggerWorkerProgress = (workerType, progress) => {
8
10
  triggerEvent(eventTarget, Enums.Events.WEB_WORKER_PROGRESS, {
9
11
  progress,
@@ -13,13 +15,13 @@ export const triggerWorkerProgress = (workerType, progress) => {
13
15
  export const getSegmentationDataForWorker = (segmentationId, segmentIndices) => {
14
16
  const segmentation = getSegmentation(segmentationId);
15
17
  if (!segmentation?.representationData) {
16
- console.debug('getSegmentationDataForWorker: segmentation missing or not ready', segmentationId);
18
+ cs3dLogger.debug('getSegmentationDataForWorker: segmentation missing or not ready', segmentationId);
17
19
  return null;
18
20
  }
19
21
  const { representationData } = segmentation;
20
22
  const { Labelmap } = representationData;
21
23
  if (!Labelmap) {
22
- console.debug('No labelmap found for segmentation', segmentationId);
24
+ cs3dLogger.debug('No labelmap found for segmentation', segmentationId);
23
25
  return null;
24
26
  }
25
27
  const segVolumeId = Labelmap.volumeId;
@@ -39,7 +39,8 @@ export default function areViewportsSpatiallyLinked(source, target, options) {
39
39
  case 'toolGroup': {
40
40
  const sourceToolGroup = getToolGroupForViewport(source.id, source.renderingEngineId);
41
41
  const targetToolGroup = getToolGroupForViewport(target.id, target.renderingEngineId);
42
- return (!!sourceToolGroup && !!targetToolGroup &&
42
+ return (!!sourceToolGroup &&
43
+ !!targetToolGroup &&
43
44
  sourceToolGroup.id === targetToolGroup.id);
44
45
  }
45
46
  default:
@@ -2,6 +2,8 @@ import { imageLoader, Enums, eventTarget, imageLoadPoolManager, cache, metaData,
2
2
  import { addToolState, getToolState } from './state.js';
3
3
  import { getStackData, requestType, clearFromImageIds, getPromiseRemovedHandler, } from './stackPrefetchUtils.js';
4
4
  import { Events } from '../../enums/index.js';
5
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
6
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('utilities.stackPrefetch.stackContextPrefetch');
5
7
  const { imageRetrieveMetadataProvider } = utilities;
6
8
  let configuration = {
7
9
  maxImagesToPrefetch: Infinity,
@@ -19,7 +21,7 @@ const enable = (element, priority = 0) => {
19
21
  return;
20
22
  }
21
23
  if (!stack.imageIds?.length) {
22
- console.warn('CornerstoneTools.stackPrefetch: No images in stack.');
24
+ cs3dLogger.warn('CornerstoneTools.stackPrefetch: No images in stack.');
23
25
  return;
24
26
  }
25
27
  updateToolState(element);
@@ -37,7 +39,7 @@ function prefetch(element, priority = 0) {
37
39
  return;
38
40
  }
39
41
  if (!stack?.imageIds?.length) {
40
- console.warn('CornerstoneTools.stackPrefetch: No images in stack.');
42
+ cs3dLogger.warn('CornerstoneTools.stackPrefetch: No images in stack.');
41
43
  return;
42
44
  }
43
45
  const stackPrefetchData = getToolState(element);
@@ -154,7 +156,7 @@ const updateToolState = (element, usage) => {
154
156
  return;
155
157
  }
156
158
  if (!stack.imageIds?.length) {
157
- console.warn('CornerstoneTools.stackPrefetch: No images in stack.');
159
+ cs3dLogger.warn('CornerstoneTools.stackPrefetch: No images in stack.');
158
160
  return;
159
161
  }
160
162
  const { currentImageIdIndex } = stack;
@@ -2,6 +2,8 @@ import { imageLoader, Enums, eventTarget, imageLoadPoolManager, cache, metaData,
2
2
  import { addToolState, getToolState } from './state.js';
3
3
  import { getStackData, requestType, priority, getPromiseRemovedHandler, nearestIndex, range, } from './stackPrefetchUtils.js';
4
4
  import { Events } from '../../enums/index.js';
5
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
6
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('utilities.stackPrefetch.stackPrefetch');
5
7
  const { imageRetrieveMetadataProvider } = utilities;
6
8
  let configuration = {
7
9
  maxImagesToPrefetch: Infinity,
@@ -17,7 +19,7 @@ function prefetch(element) {
17
19
  const stackPrefetch = (stackPrefetchData || {});
18
20
  const stack = getStackData(element);
19
21
  if (!stack?.imageIds?.length) {
20
- console.warn('CornerstoneTools.stackPrefetch: No images in stack.');
22
+ cs3dLogger.warn('CornerstoneTools.stackPrefetch: No images in stack.');
21
23
  return;
22
24
  }
23
25
  const { currentImageIdIndex } = stack;
@@ -128,7 +130,7 @@ function onImageUpdated(e) {
128
130
  function enable(element) {
129
131
  const stack = getStackData(element);
130
132
  if (!stack || !stack.imageIds || stack.imageIds.length === 0) {
131
- console.warn('CornerstoneTools.stackPrefetch: No images in stack.');
133
+ cs3dLogger.warn('CornerstoneTools.stackPrefetch: No images in stack.');
132
134
  return;
133
135
  }
134
136
  const stackPrefetchData = {
@@ -1,11 +1,13 @@
1
1
  import { getRenderingEngine } from '@cornerstonejs/core';
2
2
  import triggerAnnotationRender from './triggerAnnotationRender.js';
3
3
  import { getToolGroup } from '../store/ToolGroupManager/index.js';
4
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
5
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('utilities.triggerAnnotationRenderForToolGroupIds');
4
6
  export function triggerAnnotationRenderForToolGroupIds(toolGroupIds) {
5
7
  toolGroupIds.forEach((toolGroupId) => {
6
8
  const toolGroup = getToolGroup(toolGroupId);
7
9
  if (!toolGroup) {
8
- console.warn(`ToolGroup not available for ${toolGroupId}`);
10
+ cs3dLogger.warn(`ToolGroup not available for ${toolGroupId}`);
9
11
  return;
10
12
  }
11
13
  const viewportsInfo = toolGroup.getViewportsInfo();
@@ -13,7 +15,7 @@ export function triggerAnnotationRenderForToolGroupIds(toolGroupIds) {
13
15
  const { renderingEngineId, viewportId } = viewportInfo;
14
16
  const renderingEngine = getRenderingEngine(renderingEngineId);
15
17
  if (!renderingEngine) {
16
- console.warn(`RenderingEngine not available for ${renderingEngineId}`);
18
+ cs3dLogger.warn(`RenderingEngine not available for ${renderingEngineId}`);
17
19
  return;
18
20
  }
19
21
  const viewport = renderingEngine.getViewport(viewportId);
@@ -1,5 +1,7 @@
1
1
  import { getEnabledElementByViewportId } from '@cornerstonejs/core';
2
2
  import triggerAnnotationRender from './triggerAnnotationRender.js';
3
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
4
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('utilities.triggerAnnotationRenderForViewportIds');
3
5
  export function triggerAnnotationRenderForViewportIds(viewportIdsToRender) {
4
6
  if (!viewportIdsToRender.length) {
5
7
  return;
@@ -7,12 +9,12 @@ export function triggerAnnotationRenderForViewportIds(viewportIdsToRender) {
7
9
  viewportIdsToRender.forEach((viewportId) => {
8
10
  const enabledElement = getEnabledElementByViewportId(viewportId);
9
11
  if (!enabledElement) {
10
- console.warn(`Viewport not available for ${viewportId}`);
12
+ cs3dLogger.warn(`Viewport not available for ${viewportId}`);
11
13
  return;
12
14
  }
13
15
  const { viewport } = enabledElement;
14
16
  if (!viewport) {
15
- console.warn(`Viewport not available for ${viewportId}`);
17
+ cs3dLogger.warn(`Viewport not available for ${viewportId}`);
16
18
  return;
17
19
  }
18
20
  const element = viewport.element;