@cornerstonejs/tools 5.8.2 → 5.10.2

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 (128) 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/CircleROIStartEndThresholdTool.js +3 -1
  70. package/dist/esm/tools/segmentation/CircleScissorsTool.js +3 -1
  71. package/dist/esm/tools/segmentation/LabelmapEditWithContour.js +3 -1
  72. package/dist/esm/tools/segmentation/PaintFillTool.js +3 -1
  73. package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +3 -1
  74. package/dist/esm/tools/segmentation/RectangleROIThresholdTool.js +3 -1
  75. package/dist/esm/tools/segmentation/RectangleScissorsTool.js +3 -1
  76. package/dist/esm/tools/segmentation/SegmentBidirectionalTool.js +3 -1
  77. package/dist/esm/tools/segmentation/SegmentSelectTool.d.ts +6 -1
  78. package/dist/esm/tools/segmentation/SegmentSelectTool.js +30 -4
  79. package/dist/esm/tools/segmentation/SphereScissorsTool.js +3 -1
  80. package/dist/esm/tools/segmentation/strategies/compositions/circularCursor.js +3 -1
  81. package/dist/esm/tools/segmentation/strategies/compositions/index.js +1 -1
  82. package/dist/esm/types/SegmentationStateTypes.d.ts +4 -0
  83. package/dist/esm/utilities/calibrateImageSpacing.js +3 -1
  84. package/dist/esm/utilities/cine/playClip.js +3 -1
  85. package/dist/esm/utilities/contourSegmentation/applyContourStroke.js +3 -1
  86. package/dist/esm/utilities/contourSegmentation/contourSegmentationOperation.js +4 -2
  87. package/dist/esm/utilities/contourSegmentation/convertContourSegmentation.js +3 -1
  88. package/dist/esm/utilities/contourSegmentation/logicalOperators.js +6 -4
  89. package/dist/esm/utilities/contourSegmentation/mergeMultipleAnnotations.js +3 -1
  90. package/dist/esm/utilities/contourSegmentation/sharedOperations.js +3 -1
  91. package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js +3 -1
  92. package/dist/esm/utilities/contours/interpolation/findAnnotationForInterpolation.js +3 -1
  93. package/dist/esm/utilities/contours/interpolation/interpolate.js +3 -1
  94. package/dist/esm/utilities/dynamicVolume/generateImageFromTimeData.js +4 -2
  95. package/dist/esm/utilities/dynamicVolume/getDataInTime.js +3 -1
  96. package/dist/esm/utilities/index.d.ts +2 -1
  97. package/dist/esm/utilities/index.js +2 -1
  98. package/dist/esm/utilities/livewire/LivewireScissors.js +3 -1
  99. package/dist/esm/utilities/math/basic/Calculator.js +3 -1
  100. package/dist/esm/utilities/math/polyline/addCanvasPointsToArray.js +3 -1
  101. package/dist/esm/utilities/math/polyline/combinePolyline.js +4 -2
  102. package/dist/esm/utilities/math/polyline/getSubPixelSpacingAndXYDirections.js +12 -6
  103. package/dist/esm/utilities/math/polyline/intersectPolylines.js +4 -2
  104. package/dist/esm/utilities/math/polyline/subtractPolylines.js +4 -2
  105. package/dist/esm/utilities/sampleAreaAnnotationVoxels.d.ts +44 -0
  106. package/dist/esm/utilities/sampleAreaAnnotationVoxels.js +63 -0
  107. package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js +5 -3
  108. package/dist/esm/utilities/segmentation/growCut/runFloodFillSegmentation.js +10 -5
  109. package/dist/esm/utilities/segmentation/growCut/runGrowCut.js +3 -1
  110. package/dist/esm/utilities/segmentation/growCut/runGrowCutForSphere.js +3 -1
  111. package/dist/esm/utilities/segmentation/growCut/runOneClickGrowCut.js +10 -8
  112. package/dist/esm/utilities/segmentation/isLineInSegment.js +3 -1
  113. package/dist/esm/utilities/segmentation/islandRemoval.js +3 -1
  114. package/dist/esm/utilities/segmentation/segmentContourAction.js +4 -2
  115. package/dist/esm/utilities/segmentation/utilsForWorker.js +4 -2
  116. package/dist/esm/utilities/spatial/areViewportsSpatiallyLinked.js +2 -1
  117. package/dist/esm/utilities/stackPrefetch/stackContextPrefetch.js +5 -3
  118. package/dist/esm/utilities/stackPrefetch/stackPrefetch.js +4 -2
  119. package/dist/esm/utilities/triggerAnnotationRenderForToolGroupIds.js +4 -2
  120. package/dist/esm/utilities/triggerAnnotationRenderForViewportIds.js +4 -2
  121. package/dist/esm/utilities/voi/colorbar/Colorbar.js +3 -1
  122. package/dist/esm/utilities/voi/windowlevel/extractWindowLevelRegionToolData.js +3 -1
  123. package/dist/esm/utilities/vtkjs/OrientationControllerWidget/index.js +4 -2
  124. package/dist/esm/version.d.ts +1 -1
  125. package/dist/esm/version.js +1 -1
  126. package/dist/esm/workers/computeWorker.js +5 -3
  127. package/package.json +4 -5
  128. package/LICENSE +0 -21
@@ -6,6 +6,8 @@ import { state } from '../state.js';
6
6
  import { MouseCursor, SVGMouseCursor } from '../../cursors/index.js';
7
7
  import { initElementCursor } from '../../cursors/elementCursor.js';
8
8
  import getToolGroup from './getToolGroup.js';
9
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
10
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('store.ToolGroupManager.ToolGroup');
9
11
  const { Active, Passive, Enabled, Disabled } = ToolModes;
10
12
  const PRIMARY_BINDINGS = [{ mouseButton: MouseBindings.Primary }];
11
13
  export default class ToolGroup {
@@ -27,7 +29,7 @@ export default class ToolGroup {
27
29
  getToolInstance(toolInstanceName) {
28
30
  const toolInstance = this._toolInstances[toolInstanceName];
29
31
  if (!toolInstance) {
30
- console.warn(`'${toolInstanceName}' is not registered with this toolGroup (${this.id}).`);
32
+ cs3dLogger.warn(`'${toolInstanceName}' is not registered with this toolGroup (${this.id}).`);
31
33
  return;
32
34
  }
33
35
  return toolInstance;
@@ -43,15 +45,15 @@ export default class ToolGroup {
43
45
  const hasToolName = typeof toolName !== 'undefined' && toolName !== '';
44
46
  const localToolInstance = this.toolOptions[toolName];
45
47
  if (!hasToolName) {
46
- console.warn('Tool with configuration did not produce a toolName: ', configuration);
48
+ cs3dLogger.warn('Tool with configuration did not produce a toolName: ', configuration);
47
49
  return;
48
50
  }
49
51
  if (!toolDefinition) {
50
- console.warn(`'${toolName}' is not registered with the library. You need to use cornerstoneTools.addTool to register it.`);
52
+ cs3dLogger.warn(`'${toolName}' is not registered with the library. You need to use cornerstoneTools.addTool to register it.`);
51
53
  return;
52
54
  }
53
55
  if (localToolInstance) {
54
- console.warn(`'${toolName}' is already registered for ToolGroup ${this.id}.`);
56
+ cs3dLogger.warn(`'${toolName}' is already registered for ToolGroup ${this.id}.`);
55
57
  return;
56
58
  }
57
59
  const { toolClass: ToolClass } = toolDefinition;
@@ -128,14 +130,14 @@ export default class ToolGroup {
128
130
  setActiveStrategy(toolName, strategyName) {
129
131
  const toolInstance = this._toolInstances[toolName];
130
132
  if (toolInstance === undefined) {
131
- console.warn(`Tool ${toolName} not added to toolGroup, can't set tool configuration.`);
133
+ cs3dLogger.warn(`Tool ${toolName} not added to toolGroup, can't set tool configuration.`);
132
134
  return;
133
135
  }
134
136
  toolInstance.setActiveStrategy(strategyName);
135
137
  }
136
138
  setToolMode(toolName, mode, options = {}) {
137
139
  if (!toolName) {
138
- console.warn('setToolMode: toolName must be defined');
140
+ cs3dLogger.warn('setToolMode: toolName must be defined');
139
141
  return;
140
142
  }
141
143
  if (mode === ToolModes.Active) {
@@ -154,16 +156,16 @@ export default class ToolGroup {
154
156
  this.setToolDisabled(toolName);
155
157
  return;
156
158
  }
157
- console.warn('setToolMode: mode must be defined');
159
+ cs3dLogger.warn('setToolMode: mode must be defined');
158
160
  }
159
161
  setToolActive(toolName, toolBindingsOptions = {}) {
160
162
  const toolInstance = this._toolInstances[toolName];
161
163
  if (toolInstance === undefined) {
162
- console.warn(`Tool ${toolName} not added to toolGroup, can't set tool mode.`);
164
+ cs3dLogger.warn(`Tool ${toolName} not added to toolGroup, can't set tool mode.`);
163
165
  return;
164
166
  }
165
167
  if (!toolInstance) {
166
- console.warn(`'${toolName}' instance ${toolInstance} is not registered with this toolGroup, can't set tool mode.`);
168
+ cs3dLogger.warn(`'${toolName}' instance ${toolInstance} is not registered with this toolGroup, can't set tool mode.`);
167
169
  return;
168
170
  }
169
171
  const prevBindings = this.toolOptions[toolName]
@@ -223,7 +225,7 @@ export default class ToolGroup {
223
225
  setToolPassive(toolName, options) {
224
226
  const toolInstance = this._toolInstances[toolName];
225
227
  if (toolInstance === undefined) {
226
- console.warn(`Tool ${toolName} not added to toolGroup, can't set tool mode.`);
228
+ cs3dLogger.warn(`Tool ${toolName} not added to toolGroup, can't set tool mode.`);
227
229
  return;
228
230
  }
229
231
  const prevToolOptions = this.getToolOptions(toolName);
@@ -254,7 +256,7 @@ export default class ToolGroup {
254
256
  setToolEnabled(toolName) {
255
257
  const toolInstance = this._toolInstances[toolName];
256
258
  if (toolInstance === undefined) {
257
- console.warn(`Tool ${toolName} not added to toolGroup, can't set tool mode.`);
259
+ cs3dLogger.warn(`Tool ${toolName} not added to toolGroup, can't set tool mode.`);
258
260
  return;
259
261
  }
260
262
  const toolOptions = {
@@ -272,7 +274,7 @@ export default class ToolGroup {
272
274
  setToolDisabled(toolName) {
273
275
  const toolInstance = this._toolInstances[toolName];
274
276
  if (toolInstance === undefined) {
275
- console.warn(`Tool ${toolName} not added to toolGroup, can't set tool mode.`);
277
+ cs3dLogger.warn(`Tool ${toolName} not added to toolGroup, can't set tool mode.`);
276
278
  return;
277
279
  }
278
280
  const toolOptions = {
@@ -345,7 +347,7 @@ export default class ToolGroup {
345
347
  setToolConfiguration(toolName, configuration, overwrite) {
346
348
  const toolInstance = this._toolInstances[toolName];
347
349
  if (toolInstance === undefined) {
348
- console.warn(`Tool ${toolName} not present, can't set tool configuration.`);
350
+ cs3dLogger.warn(`Tool ${toolName} not present, can't set tool configuration.`);
349
351
  return false;
350
352
  }
351
353
  let _configuration;
@@ -370,7 +372,7 @@ export default class ToolGroup {
370
372
  }
371
373
  getToolConfiguration(toolName, configurationPath) {
372
374
  if (this._toolInstances[toolName] === undefined) {
373
- console.warn(`Tool ${toolName} not present, can't set tool configuration.`);
375
+ cs3dLogger.warn(`Tool ${toolName} not present, can't set tool configuration.`);
374
376
  return;
375
377
  }
376
378
  const _configuration = get(this._toolInstances[toolName].configuration, configurationPath) ||
@@ -393,7 +395,7 @@ export default class ToolGroup {
393
395
  clone(newToolGroupId, fnToolFilter = null) {
394
396
  let toolGroup = getToolGroup(newToolGroupId);
395
397
  if (toolGroup) {
396
- console.debug(`ToolGroup ${newToolGroupId} already exists`);
398
+ cs3dLogger.debug(`ToolGroup ${newToolGroupId} already exists`);
397
399
  return toolGroup;
398
400
  }
399
401
  toolGroup = new ToolGroup(newToolGroupId);
@@ -1,9 +1,11 @@
1
1
  import { state } from '../state.js';
2
2
  import ToolGroup from './ToolGroup.js';
3
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
4
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('store.ToolGroupManager.createToolGroup');
3
5
  function createToolGroup(toolGroupId) {
4
6
  const toolGroupWithIdExists = state.toolGroups.some((tg) => tg.id === toolGroupId);
5
7
  if (toolGroupWithIdExists) {
6
- console.warn(`'${toolGroupId}' already exists.`);
8
+ cs3dLogger.warn(`'${toolGroupId}' already exists.`);
7
9
  return;
8
10
  }
9
11
  const toolGroup = new ToolGroup(toolGroupId);
@@ -1,10 +1,12 @@
1
1
  import { getAnnotations } from '../stateManagement/annotation/annotationState.js';
2
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
3
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('store.filterToolsWithAnnotationsForElement');
2
4
  export default function filterToolsWithAnnotationsForElement(element, tools) {
3
5
  const result = [];
4
6
  for (let i = 0; i < tools.length; i++) {
5
7
  const tool = tools[i];
6
8
  if (!tool) {
7
- console.warn('undefined tool in filterToolsWithAnnotationsForElement');
9
+ cs3dLogger.warn('undefined tool in filterToolsWithAnnotationsForElement');
8
10
  continue;
9
11
  }
10
12
  let annotations = getAnnotations(tool.constructor.toolName, element);
@@ -18,6 +18,8 @@ import { getToolGroupForViewport } from '../store/ToolGroupManager/index.js';
18
18
  import debounce from '../utilities/debounce.js';
19
19
  import { distanceToPoint } from '../utilities/math/point/index.js';
20
20
  import { addSegmentationRepresentations } from '../stateManagement/segmentation/index.js';
21
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
22
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.AdvancedMagnifyTool');
21
23
  const MAGNIFY_CLASSNAME = 'advancedMagnifyTool';
22
24
  const MAGNIFY_VIEWPORT_INITIAL_RADIUS = 125;
23
25
  const { Events: csEvents } = Enums;
@@ -330,7 +332,7 @@ class AdvancedMagnifyTool extends AnnotationTool {
330
332
  const lineDash = this.getStyle('lineDash', styleSpecifier, annotation);
331
333
  const color = this.getStyle('color', styleSpecifier, annotation);
332
334
  if (!viewport.getRenderingEngine()) {
333
- console.warn('Rendering Engine has been destroyed');
335
+ cs3dLogger.warn('Rendering Engine has been destroyed');
334
336
  return renderStatus;
335
337
  }
336
338
  let activeHandleCanvasCoords;
@@ -18,6 +18,8 @@ import { isMobile } from '../utilities/touch/index.js';
18
18
  import * as lineSegment from '../utilities/math/line/index.js';
19
19
  import { isAnnotationLocked } from '../stateManagement/annotation/annotationLocking.js';
20
20
  import triggerAnnotationRenderForViewportIds from '../utilities/triggerAnnotationRenderForViewportIds.js';
21
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
22
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.CrosshairsTool');
21
23
  const { RENDERING_DEFAULTS } = CONSTANTS;
22
24
  function getDisplayedCanvasSize(viewport) {
23
25
  if (csUtils.isGenericViewport(viewport)) {
@@ -189,7 +191,7 @@ class CrosshairsTool extends AnnotationTool {
189
191
  };
190
192
  this._computeToolCenter = (viewportsInfo) => {
191
193
  if (!viewportsInfo.length || viewportsInfo.length === 1) {
192
- console.warn('For crosshairs to operate, at least two viewports must be given.');
194
+ cs3dLogger.warn('For crosshairs to operate, at least two viewports must be given.');
193
195
  return;
194
196
  }
195
197
  viewportsInfo.forEach((viewportInfo) => {
@@ -236,7 +238,7 @@ class CrosshairsTool extends AnnotationTool {
236
238
  return filteredAnnotations[0];
237
239
  };
238
240
  this.cancel = () => {
239
- console.log('Not implemented yet');
241
+ cs3dLogger.info('Not implemented yet');
240
242
  };
241
243
  this.handleSelectedCallback = (evt, annotation) => {
242
244
  const eventDetail = evt.detail;
@@ -3,6 +3,8 @@ import { getEnabledElement, VolumeViewport } from '@cornerstonejs/core';
3
3
  import { utilities } from '@cornerstonejs/core';
4
4
  import { getPointInLineOfSightWithCriteria } from '../utilities/planar/index.js';
5
5
  import { getToolGroupForViewport } from '../store/ToolGroupManager/index.js';
6
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
7
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.MIPJumpToClickTool');
6
8
  class MIPJumpToClickTool extends BaseTool {
7
9
  constructor(toolProps = {}, defaultToolProps = {
8
10
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -47,7 +49,7 @@ class MIPJumpToClickTool extends BaseTool {
47
49
  viewport.jumpToWorld(brightestPoint);
48
50
  }
49
51
  else {
50
- console.warn('Cannot jump to specified world coordinates for a viewport that is not a VolumeViewport');
52
+ cs3dLogger.warn('Cannot jump to specified world coordinates for a viewport that is not a VolumeViewport');
51
53
  }
52
54
  });
53
55
  }
@@ -5,6 +5,8 @@ import setViewportCamera, { resetViewportCamera, } from '../utilities/setViewpor
5
5
  import * as ToolsEnums from '../enums/index.js';
6
6
  import { vec3, mat4, quat } from 'gl-matrix';
7
7
  import { vtkOrientationControllerWidget } from '../utilities/vtkjs/OrientationControllerWidget/index.js';
8
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
9
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.OrientationControllerTool');
8
10
  const ADD_MARKER_DELAY_MS = 500;
9
11
  const POSITION_RETRY_DELAY_MS = 1000;
10
12
  const FACE_COLOR_SCHEMES = {
@@ -276,12 +278,12 @@ class OrientationControllerTool extends BaseTool {
276
278
  }
277
279
  const enabledElement = getEnabledElementByIds(viewportId, renderingEngineId);
278
280
  if (!enabledElement) {
279
- console.warn('OrientationControllerTool: No enabled element found');
281
+ cs3dLogger.warn('OrientationControllerTool: No enabled element found');
280
282
  return;
281
283
  }
282
284
  const { viewport } = enabledElement;
283
285
  if (!viewport.isOrientationChangeable()) {
284
- console.warn('OrientationControllerTool: Viewport does not support orientation changes');
286
+ cs3dLogger.warn('OrientationControllerTool: Viewport does not support orientation changes');
285
287
  return;
286
288
  }
287
289
  const element = viewport.element;
@@ -290,14 +292,14 @@ class OrientationControllerTool extends BaseTool {
290
292
  this.widget.addActorsToViewport(viewportId, volumeViewport, actors);
291
293
  const positioned = this.widget.positionActors(volumeViewport, actors, this.getPositionConfig());
292
294
  if (!positioned) {
293
- console.warn('OrientationControllerTool: Initial positioning failed, retrying...');
295
+ cs3dLogger.warn('OrientationControllerTool: Initial positioning failed, retrying...');
294
296
  setTimeout(() => {
295
297
  const repositioned = this.widget.positionActors(volumeViewport, actors, this.getPositionConfig());
296
298
  if (repositioned) {
297
299
  viewport.render();
298
300
  }
299
301
  else {
300
- console.error('OrientationControllerTool: Retry positioning also failed');
302
+ cs3dLogger.error('OrientationControllerTool: Retry positioning also failed');
301
303
  }
302
304
  }, POSITION_RETRY_DELAY_MS);
303
305
  }
@@ -6,6 +6,8 @@ import { drawLine as drawLineSvg } from '../drawingSvg/index.js';
6
6
  import getViewportICamera from '../utilities/getViewportICamera.js';
7
7
  import triggerAnnotationRenderForViewportIds from '../utilities/triggerAnnotationRenderForViewportIds.js';
8
8
  import AnnotationDisplayTool from './base/AnnotationDisplayTool.js';
9
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
10
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.OverlayGridTool');
9
11
  const { EPSILON } = CONSTANTS;
10
12
  class OverlayGridTool extends AnnotationDisplayTool {
11
13
  constructor(toolProps = {}, defaultToolProps = {
@@ -24,18 +26,18 @@ class OverlayGridTool extends AnnotationDisplayTool {
24
26
  this._init = () => {
25
27
  const sourceImageIds = this.configuration.sourceImageIds;
26
28
  if (!sourceImageIds?.length) {
27
- console.warn('OverlayGridTool: No sourceImageIds provided in configuration');
29
+ cs3dLogger.warn('OverlayGridTool: No sourceImageIds provided in configuration');
28
30
  return;
29
31
  }
30
32
  const imagePlaneModule = metaData.get('imagePlaneModule', sourceImageIds[0]);
31
33
  if (!imagePlaneModule) {
32
- console.warn('OverlayGridTool: No imagePlaneModule found for sourceImageIds');
34
+ cs3dLogger.warn('OverlayGridTool: No imagePlaneModule found for sourceImageIds');
33
35
  return;
34
36
  }
35
37
  const { frameOfReferenceUID } = imagePlaneModule;
36
38
  const viewportsInfo = getToolGroup(this.toolGroupId).viewportsInfo;
37
39
  if (!viewportsInfo?.length) {
38
- console.warn('OverlayGridTool: No viewports found');
40
+ cs3dLogger.warn('OverlayGridTool: No viewports found');
39
41
  return;
40
42
  }
41
43
  const annotations = getAnnotations(this.getToolName(), frameOfReferenceUID);
@@ -11,6 +11,8 @@ import vtkMath from '@kitware/vtk.js/Common/Core/Math.js';
11
11
  import { hideElementCursor, resetElementCursor, } from '../cursors/elementCursor.js';
12
12
  import { getToolGroup } from '../store/ToolGroupManager/index.js';
13
13
  import { jumpToFocalPoint } from '../utilities/genericViewportToolHelpers.js';
14
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
15
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.ReferenceCursors');
14
16
  class ReferenceCursors extends AnnotationDisplayTool {
15
17
  constructor(toolProps = {}, defaultToolProps = {
16
18
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -170,7 +172,7 @@ class ReferenceCursors extends AnnotationDisplayTool {
170
172
  }
171
173
  const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
172
174
  if (!viewport.getRenderingEngine()) {
173
- console.warn('Rendering Engine has been destroyed');
175
+ cs3dLogger.warn('Rendering Engine has been destroyed');
174
176
  return renderStatus;
175
177
  }
176
178
  if (!isAnnotationVisible(annotationUID)) {
@@ -7,6 +7,8 @@ import { filterViewportsWithToolEnabled } from '../utilities/viewportFilters/ind
7
7
  import triggerAnnotationRenderForViewportIds from '../utilities/triggerAnnotationRenderForViewportIds.js';
8
8
  import getViewportICamera from '../utilities/getViewportICamera.js';
9
9
  import AnnotationDisplayTool from './base/AnnotationDisplayTool.js';
10
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
11
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.ReferenceLinesTool');
10
12
  const { EPSILON } = CONSTANTS;
11
13
  class ReferenceLines extends AnnotationDisplayTool {
12
14
  constructor(toolProps = {}, defaultToolProps = {
@@ -196,7 +198,7 @@ class ReferenceLines extends AnnotationDisplayTool {
196
198
  });
197
199
  }
198
200
  catch (err) {
199
- console.log(err);
201
+ cs3dLogger.info(err);
200
202
  }
201
203
  }
202
204
  return canvasCoordinates;
@@ -12,6 +12,8 @@ import CircleSculptCursor from './SculptorTool/CircleSculptCursor.js';
12
12
  import { distancePointToContour } from './distancePointToContour.js';
13
13
  import { getToolGroupForViewport } from '../store/ToolGroupManager/index.js';
14
14
  import { getSignedArea, containsPoint } from '../utilities/math/polyline/index.js';
15
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
16
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.SculptorTool');
15
17
  const { isEqual } = utilities;
16
18
  class SculptorTool extends BaseTool {
17
19
  constructor(toolProps = {}, defaultToolProps = {
@@ -137,7 +139,7 @@ class SculptorTool extends BaseTool {
137
139
  if (contourSelections.length > 1) {
138
140
  const signedArea = getSignedArea(newPoints.map(viewport.worldToCanvas));
139
141
  if (signedArea < 0) {
140
- console.warn('Skipping internal area');
142
+ cs3dLogger.warn('Skipping internal area');
141
143
  continue;
142
144
  }
143
145
  }
@@ -242,12 +244,12 @@ class SculptorTool extends BaseTool {
242
244
  for (let enterCount = 0; enterCount < enterLength; enterCount++) {
243
245
  const enter = this.findNext(intersections, lastAngle);
244
246
  if (!enter) {
245
- console.error("Couldnt' find an entry");
247
+ cs3dLogger.error("Couldnt' find an entry");
246
248
  continue;
247
249
  }
248
250
  const exit = this.findNext(intersections, enter.angle, false);
249
251
  if (!exit) {
250
- console.error("Couldn't find an exit for", enter);
252
+ cs3dLogger.error("Couldn't find an exit for", enter);
251
253
  continue;
252
254
  }
253
255
  exit.relIndex ||=
@@ -266,7 +268,7 @@ class SculptorTool extends BaseTool {
266
268
  }
267
269
  }
268
270
  if (result.length > 1) {
269
- console.warn('************* More than 1 result', result);
271
+ cs3dLogger.warn('************* More than 1 result', result);
270
272
  }
271
273
  return result;
272
274
  }
@@ -300,7 +302,7 @@ class SculptorTool extends BaseTool {
300
302
  }
301
303
  }
302
304
  if (!foundItem) {
303
- console.warn("Couldn't find an exit point for entry", JSON.stringify(intersections));
305
+ cs3dLogger.warn("Couldn't find an exit point for entry", JSON.stringify(intersections));
304
306
  return;
305
307
  }
306
308
  intersections.splice(foundItem.i, 1);
@@ -7,6 +7,8 @@ import AnnotationDisplayTool from './base/AnnotationDisplayTool.js';
7
7
  import { distanceToPoint } from '../utilities/math/point/index.js';
8
8
  import { pointToString } from '../utilities/pointToString.js';
9
9
  import { polyDataUtils } from '../utilities/index.js';
10
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
11
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.SegmentationIntersectionTool');
10
12
  class SegmentationIntersectionTool extends AnnotationDisplayTool {
11
13
  constructor(toolProps = {}, defaultToolProps = {
12
14
  configuration: {
@@ -17,7 +19,7 @@ class SegmentationIntersectionTool extends AnnotationDisplayTool {
17
19
  this._init = () => {
18
20
  const viewportsInfo = getToolGroup(this.toolGroupId).viewportsInfo;
19
21
  if (!viewportsInfo?.length) {
20
- console.warn(this.getToolName() + 'Tool: No viewports found');
22
+ cs3dLogger.warn(this.getToolName() + 'Tool: No viewports found');
21
23
  return;
22
24
  }
23
25
  const firstViewport = getRenderingEngine(viewportsInfo[0].renderingEngineId)?.getViewport(viewportsInfo[0].viewportId);
@@ -15,6 +15,8 @@ import * as lineSegment from '../utilities/math/line/index.js';
15
15
  import { isAnnotationLocked } from '../stateManagement/annotation/annotationLocking.js';
16
16
  import triggerAnnotationRenderForViewportIds from '../utilities/triggerAnnotationRenderForViewportIds.js';
17
17
  import { NUM_CLIPPING_PLANES, LINE_INTERSECTION_TOLERANCE, POINT_PROXIMITY_THRESHOLD_PIXELS, copyClippingPlanes, getColorKeyForPlaneIndex, getOrientationFromNormal, computePlanePlaneIntersection, findLineBoundsIntersection, } from '../utilities/volumeCropping/index.js';
18
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
19
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.VolumeCroppingControlTool');
18
20
  const OPERATION = {
19
21
  DRAG: 1,
20
22
  ROTATE: 2,
@@ -50,7 +52,7 @@ class VolumeCroppingControlTool extends AnnotationTool {
50
52
  this.clippingPlanes = [];
51
53
  this.initializeViewport = ({ renderingEngineId, viewportId, }) => {
52
54
  if (!renderingEngineId || !viewportId) {
53
- console.warn('VolumeCroppingControlTool: Missing renderingEngineId or viewportId');
55
+ cs3dLogger.warn('VolumeCroppingControlTool: Missing renderingEngineId or viewportId');
54
56
  return;
55
57
  }
56
58
  const enabledElement = getEnabledElementByIds(viewportId, renderingEngineId);
@@ -130,7 +132,7 @@ class VolumeCroppingControlTool extends AnnotationTool {
130
132
  };
131
133
  this._initializeViewports = (viewportsInfo) => {
132
134
  if (!viewportsInfo?.length || !viewportsInfo[0]) {
133
- console.warn('VolumeCroppingControlTool: No valid viewportsInfo for initialization.');
135
+ cs3dLogger.warn('VolumeCroppingControlTool: No valid viewportsInfo for initialization.');
134
136
  return;
135
137
  }
136
138
  viewportsInfo.forEach((vpInfo) => {
@@ -528,7 +530,7 @@ class VolumeCroppingControlTool extends AnnotationTool {
528
530
  }
529
531
  const volumeActors = viewport.getActors();
530
532
  if (!volumeActors || !volumeActors.length) {
531
- console.warn(`VolumeCroppingControlTool: No volume actors found in viewport ${viewportId}.`);
533
+ cs3dLogger.warn(`VolumeCroppingControlTool: No volume actors found in viewport ${viewportId}.`);
532
534
  return;
533
535
  }
534
536
  const imageData = volumeActors[0].actor.getMapper().getInputData();
@@ -15,6 +15,8 @@ import { PLANEINDEX, SPHEREINDEX, NUM_CLIPPING_PLANES, extractVolumeDirectionVec
15
15
  import { addLine3DBetweenPoints, calculateAdaptiveSphereRadius, } from '../utilities/draw3D/index.js';
16
16
  import { isDragOwnedBy } from '../utilities/interactionDragCoordinator.js';
17
17
  import { applyViewportPresentation, getViewportPresentation, } from '../utilities/viewportPresentation.js';
18
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
19
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.VolumeCroppingTool');
18
20
  class VolumeCroppingTool extends BaseTool {
19
21
  constructor(toolProps = {}, defaultToolProps = {
20
22
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -302,7 +304,7 @@ class VolumeCroppingTool extends BaseTool {
302
304
  };
303
305
  this._initialize3DViewports = (viewportsInfo) => {
304
306
  if (!viewportsInfo?.length || !viewportsInfo[0]) {
305
- console.warn('VolumeCroppingTool: No viewportsInfo available for initialization of volumecroppingtool.');
307
+ cs3dLogger.warn('VolumeCroppingTool: No viewportsInfo available for initialization of volumecroppingtool.');
306
308
  return;
307
309
  }
308
310
  const viewport = this._getViewport();
@@ -311,12 +313,12 @@ class VolumeCroppingTool extends BaseTool {
311
313
  }
312
314
  const volumeActor = this._getVolumeActor(viewport);
313
315
  if (!volumeActor) {
314
- console.warn('VolumeCroppingTool: No volume actors found in the viewport.');
316
+ cs3dLogger.warn('VolumeCroppingTool: No volume actors found in the viewport.');
315
317
  return;
316
318
  }
317
319
  const imageData = volumeActor.getMapper().getInputData();
318
320
  if (!imageData) {
319
- console.warn('VolumeCroppingTool: No image data found for volume actor.');
321
+ cs3dLogger.warn('VolumeCroppingTool: No image data found for volume actor.');
320
322
  return;
321
323
  }
322
324
  this.seriesInstanceUID = imageData.seriesInstanceUID || 'unknown';
@@ -10,6 +10,8 @@ import { getViewportIdsWithToolToRender } from '../utilities/viewportFilters/ind
10
10
  import { resetElementCursor, hideElementCursor, } from '../cursors/elementCursor.js';
11
11
  import triggerAnnotationRenderForViewportIds from '../utilities/triggerAnnotationRenderForViewportIds.js';
12
12
  import { windowLevel } from '../utilities/voi/index.js';
13
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
14
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.WindowLevelRegionTool');
13
15
  class WindowLevelRegionTool extends AnnotationTool {
14
16
  constructor(toolProps = {}, defaultToolProps = {
15
17
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -154,7 +156,7 @@ class WindowLevelRegionTool extends AnnotationTool {
154
156
  styleSpecifier,
155
157
  });
156
158
  if (!viewport.getRenderingEngine()) {
157
- console.warn('Rendering Engine has been destroyed');
159
+ cs3dLogger.warn('Rendering Engine has been destroyed');
158
160
  return renderStatus;
159
161
  }
160
162
  const dataId = `${annotationUID}-rect`;
@@ -15,6 +15,8 @@ import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../st
15
15
  import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor.js';
16
16
  import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility.js';
17
17
  import { getStyleProperty } from '../../stateManagement/annotation/config/helpers.js';
18
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
19
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.annotation.AngleTool');
18
20
  class AngleTool extends AnnotationTool {
19
21
  constructor(toolProps = {}, defaultToolProps = {
20
22
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -290,7 +292,7 @@ class AngleTool extends AnnotationTool {
290
292
  activeHandleCanvasCoords = [canvasCoordinates[activeHandleIndex]];
291
293
  }
292
294
  if (!viewport.getRenderingEngine()) {
293
- console.warn('Rendering Engine has been destroyed');
295
+ cs3dLogger.warn('Rendering Engine has been destroyed');
294
296
  return renderStatus;
295
297
  }
296
298
  if (!isAnnotationVisible(annotationUID)) {
@@ -14,6 +14,8 @@ import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCur
14
14
  import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility.js';
15
15
  import { setAnnotationLabel } from '../../utilities/index.js';
16
16
  import { getStyleProperty } from '../../stateManagement/annotation/config/helpers.js';
17
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
18
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.annotation.ArrowAnnotateTool');
17
19
  class ArrowAnnotateTool extends AnnotationTool {
18
20
  constructor(toolProps = {}, defaultToolProps = {
19
21
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -294,7 +296,7 @@ class ArrowAnnotateTool extends AnnotationTool {
294
296
  activeHandleCanvasCoords = [canvasCoordinates[activeHandleIndex]];
295
297
  }
296
298
  if (!viewport.getRenderingEngine()) {
297
- console.warn('Rendering Engine has been destroyed');
299
+ cs3dLogger.warn('Rendering Engine has been destroyed');
298
300
  return renderStatus;
299
301
  }
300
302
  if (!isAnnotationVisible(annotationUID)) {
@@ -16,6 +16,8 @@ import * as lineSegment from '../../utilities/math/line/index.js';
16
16
  import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor.js';
17
17
  import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds.js';
18
18
  import { getStyleProperty } from '../../stateManagement/annotation/config/helpers.js';
19
+ import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
20
+ const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger('tools.annotation.BidirectionalTool');
19
21
  class BidirectionalTool extends AnnotationTool {
20
22
  constructor(toolProps = {}, defaultToolProps = {
21
23
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -501,7 +503,7 @@ class BidirectionalTool extends AnnotationTool {
501
503
  this._throttledCalculateCachedStats(annotation, renderingEngine, enabledElement);
502
504
  }
503
505
  if (!viewport.getRenderingEngine()) {
504
- console.warn('Rendering Engine has been destroyed');
506
+ cs3dLogger.warn('Rendering Engine has been destroyed');
505
507
  return renderStatus;
506
508
  }
507
509
  let activeHandleCanvasCoords;