@cornerstonejs/tools 2.0.0-beta.17 → 2.0.0-beta.19

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 (118) hide show
  1. package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js +11 -14
  2. package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +26 -27
  3. package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js +1 -4
  4. package/dist/esm/eventListeners/segmentation/segmentationModifiedEventListener.js +2 -11
  5. package/dist/esm/eventListeners/segmentation/segmentationRepresentationModifiedEventListener.js +10 -2
  6. package/dist/esm/eventListeners/segmentation/segmentationRepresentationRemovedEventListener.js +2 -2
  7. package/dist/esm/index.d.ts +2 -2
  8. package/dist/esm/index.js +2 -2
  9. package/dist/esm/stateManagement/index.d.ts +3 -3
  10. package/dist/esm/stateManagement/index.js +2 -2
  11. package/dist/esm/stateManagement/segmentation/SegmentationStateManager.d.ts +19 -18
  12. package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +87 -130
  13. package/dist/esm/stateManagement/segmentation/activeSegmentation.d.ts +4 -5
  14. package/dist/esm/stateManagement/segmentation/activeSegmentation.js +6 -23
  15. package/dist/esm/stateManagement/segmentation/addRepresentation.d.ts +3 -0
  16. package/dist/esm/stateManagement/segmentation/addRepresentation.js +51 -0
  17. package/dist/esm/stateManagement/segmentation/addRepresentations.d.ts +3 -0
  18. package/dist/esm/stateManagement/segmentation/addRepresentations.js +9 -0
  19. package/dist/esm/stateManagement/segmentation/config/index.d.ts +2 -2
  20. package/dist/esm/stateManagement/segmentation/config/index.js +2 -2
  21. package/dist/esm/stateManagement/segmentation/config/segmentationColor.d.ts +4 -4
  22. package/dist/esm/stateManagement/segmentation/config/segmentationColor.js +10 -10
  23. package/dist/esm/stateManagement/segmentation/config/segmentationConfig.d.ts +8 -8
  24. package/dist/esm/stateManagement/segmentation/config/segmentationConfig.js +19 -13
  25. package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.d.ts +7 -6
  26. package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.js +29 -54
  27. package/dist/esm/stateManagement/segmentation/convertStackToVolumeSegmentation.d.ts +1 -1
  28. package/dist/esm/stateManagement/segmentation/convertStackToVolumeSegmentation.js +5 -5
  29. package/dist/esm/stateManagement/segmentation/convertVolumeToStackSegmentation.d.ts +3 -3
  30. package/dist/esm/stateManagement/segmentation/convertVolumeToStackSegmentation.js +5 -5
  31. package/dist/esm/stateManagement/segmentation/helpers/getRepresentationRenderingConfig.d.ts +2 -0
  32. package/dist/esm/stateManagement/segmentation/helpers/{getRepresentationSpecificConfig.js → getRepresentationRenderingConfig.js} +1 -1
  33. package/dist/esm/stateManagement/segmentation/index.d.ts +3 -3
  34. package/dist/esm/stateManagement/segmentation/index.js +3 -3
  35. package/dist/esm/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js +2 -4
  36. package/dist/esm/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js +5 -6
  37. package/dist/esm/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.js +4 -4
  38. package/dist/esm/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.js +2 -6
  39. package/dist/esm/stateManagement/segmentation/removeRepresentationsFromViewport.d.ts +2 -0
  40. package/dist/esm/stateManagement/segmentation/removeRepresentationsFromViewport.js +23 -0
  41. package/dist/esm/stateManagement/segmentation/segmentIndex.js +6 -4
  42. package/dist/esm/stateManagement/segmentation/segmentationState.d.ts +23 -20
  43. package/dist/esm/stateManagement/segmentation/segmentationState.js +68 -95
  44. package/dist/esm/stateManagement/segmentation/triggerSegmentationEvents.d.ts +2 -2
  45. package/dist/esm/stateManagement/segmentation/triggerSegmentationEvents.js +4 -18
  46. package/dist/esm/store/ToolGroupManager/destroyToolGroup.js +0 -4
  47. package/dist/esm/tools/AdvancedMagnifyViewport.js +3 -3
  48. package/dist/esm/tools/ScaleOverlayTool.d.ts +1 -1
  49. package/dist/esm/tools/annotation/BidirectionalTool.js +6 -7
  50. package/dist/esm/tools/annotation/CircleROITool.js +14 -14
  51. package/dist/esm/tools/annotation/DragProbeTool.js +3 -3
  52. package/dist/esm/tools/annotation/EllipticalROITool.js +12 -12
  53. package/dist/esm/tools/annotation/LengthTool.js +2 -2
  54. package/dist/esm/tools/annotation/PlanarFreehandROITool.js +13 -15
  55. package/dist/esm/tools/annotation/ProbeTool.js +10 -10
  56. package/dist/esm/tools/annotation/RectangleROITool.js +12 -12
  57. package/dist/esm/tools/annotation/SplineROITool.js +5 -5
  58. package/dist/esm/tools/base/ContourSegmentationBaseTool.d.ts +0 -1
  59. package/dist/esm/tools/base/ContourSegmentationBaseTool.js +42 -33
  60. package/dist/esm/tools/displayTools/Contour/contourDisplay.d.ts +4 -4
  61. package/dist/esm/tools/displayTools/Contour/contourDisplay.js +17 -30
  62. package/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.d.ts +4 -4
  63. package/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js +20 -11
  64. package/dist/esm/tools/displayTools/Contour/contourHandler/utils.d.ts +0 -2
  65. package/dist/esm/tools/displayTools/Contour/contourHandler/utils.js +0 -11
  66. package/dist/esm/tools/displayTools/Contour/removeContourFromElement.d.ts +1 -1
  67. package/dist/esm/tools/displayTools/Contour/removeContourFromElement.js +3 -3
  68. package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.d.ts +5 -5
  69. package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +51 -54
  70. package/dist/esm/tools/displayTools/SegmentationRenderingEngine.d.ts +19 -0
  71. package/dist/esm/tools/displayTools/SegmentationRenderingEngine.js +136 -0
  72. package/dist/esm/tools/displayTools/Surface/surfaceDisplay.d.ts +5 -5
  73. package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js +14 -25
  74. package/dist/esm/tools/index.d.ts +1 -2
  75. package/dist/esm/tools/index.js +1 -2
  76. package/dist/esm/tools/segmentation/BrushTool.d.ts +15 -2
  77. package/dist/esm/tools/segmentation/BrushTool.js +13 -14
  78. package/dist/esm/tools/segmentation/CircleScissorsTool.js +3 -4
  79. package/dist/esm/tools/segmentation/PaintFillTool.js +1 -2
  80. package/dist/esm/tools/segmentation/RectangleScissorsTool.js +3 -4
  81. package/dist/esm/tools/segmentation/SegmentSelectTool.d.ts +3 -2
  82. package/dist/esm/tools/segmentation/SegmentSelectTool.js +5 -5
  83. package/dist/esm/tools/segmentation/SphereScissorsTool.js +4 -5
  84. package/dist/esm/tools/segmentation/strategies/compositions/preview.js +2 -2
  85. package/dist/esm/types/EventTypes.d.ts +0 -3
  86. package/dist/esm/types/SegmentationStateTypes.d.ts +24 -23
  87. package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +2 -2
  88. package/dist/esm/types/index.d.ts +2 -2
  89. package/dist/esm/utilities/getCalibratedUnits.d.ts +6 -0
  90. package/dist/esm/utilities/getCalibratedUnits.js +16 -8
  91. package/dist/esm/utilities/getPixelValueUnits.d.ts +6 -0
  92. package/dist/esm/utilities/{getModalityUnit.js → getPixelValueUnits.js} +2 -2
  93. package/dist/esm/utilities/segmentation/getSegmentIndexAtLabelmapBorder.d.ts +7 -0
  94. package/dist/esm/utilities/segmentation/{getSegmentAtLabelmapBorder.js → getSegmentIndexAtLabelmapBorder.js} +3 -3
  95. package/dist/esm/utilities/segmentation/getSegmentIndexAtWorldPoint.d.ts +11 -0
  96. package/dist/esm/utilities/segmentation/{getSegmentAtWorldPoint.js → getSegmentIndexAtWorldPoint.js} +7 -7
  97. package/dist/esm/utilities/segmentation/index.d.ts +3 -3
  98. package/dist/esm/utilities/segmentation/index.js +3 -3
  99. package/dist/esm/utilities/segmentation/triggerSegmentationRender.d.ts +2 -17
  100. package/dist/esm/utilities/segmentation/triggerSegmentationRender.js +4 -106
  101. package/dist/esm/utilities/segmentation/triggerSegmentationRenderForViewports.d.ts +3 -0
  102. package/dist/esm/utilities/segmentation/triggerSegmentationRenderForViewports.js +6 -0
  103. package/dist/esm/utilities/triggerAnnotationRenderForViewportIds.js +7 -2
  104. package/dist/umd/index.js +1 -1
  105. package/dist/umd/index.js.map +1 -1
  106. package/package.json +3 -4
  107. package/dist/esm/stateManagement/segmentation/addSegmentationRepresentation.d.ts +0 -3
  108. package/dist/esm/stateManagement/segmentation/addSegmentationRepresentation.js +0 -63
  109. package/dist/esm/stateManagement/segmentation/addSegmentationRepresentations.d.ts +0 -3
  110. package/dist/esm/stateManagement/segmentation/addSegmentationRepresentations.js +0 -14
  111. package/dist/esm/stateManagement/segmentation/helpers/getRepresentationSpecificConfig.d.ts +0 -2
  112. package/dist/esm/stateManagement/segmentation/removeSegmentationsFromToolGroup.d.ts +0 -2
  113. package/dist/esm/stateManagement/segmentation/removeSegmentationsFromToolGroup.js +0 -39
  114. package/dist/esm/tools/displayTools/SegmentationDisplayTool.d.ts +0 -13
  115. package/dist/esm/tools/displayTools/SegmentationDisplayTool.js +0 -101
  116. package/dist/esm/utilities/getModalityUnit.d.ts +0 -6
  117. package/dist/esm/utilities/segmentation/getSegmentAtLabelmapBorder.d.ts +0 -7
  118. package/dist/esm/utilities/segmentation/getSegmentAtWorldPoint.d.ts +0 -11
@@ -1,6 +1,6 @@
1
1
  import { SegmentationRepresentations } from '../../../enums';
2
2
  import { validateLabelmap } from '../../../tools/displayTools/Labelmap';
3
- import { findSegmentationRepresentationByUID, getSegmentation, } from '../segmentationState';
3
+ import { getRepresentation, getSegmentation } from '../segmentationState';
4
4
  const conversionPaths = new Map([
5
5
  [
6
6
  SegmentationRepresentations.Labelmap,
@@ -22,11 +22,7 @@ const conversionPaths = new Map([
22
22
  ],
23
23
  ]);
24
24
  function canComputeRequestedRepresentation(segmentationRepresentationUID) {
25
- const representationInfo = findSegmentationRepresentationByUID(segmentationRepresentationUID);
26
- if (!representationInfo?.segmentationRepresentation) {
27
- return false;
28
- }
29
- const { segmentationRepresentation } = representationInfo;
25
+ const segmentationRepresentation = getRepresentation(segmentationRepresentationUID);
30
26
  const { type: representationType, polySeg } = segmentationRepresentation;
31
27
  if (!polySeg || !polySeg.enabled) {
32
28
  return false;
@@ -0,0 +1,2 @@
1
+ declare function removeRepresentationsFromViewport(viewportId: string, segmentationRepresentationUIDs?: string[] | undefined, immediate?: boolean): void;
2
+ export default removeRepresentationsFromViewport;
@@ -0,0 +1,23 @@
1
+ import SegmentationRepresentations from '../../enums/SegmentationRepresentations';
2
+ import { labelmapDisplay } from '../../tools/displayTools/Labelmap';
3
+ import { contourDisplay } from '../../tools/displayTools/Contour';
4
+ import { getRepresentation } from './segmentationState';
5
+ function removeRepresentationsFromViewport(viewportId, segmentationRepresentationUIDs, immediate) {
6
+ segmentationRepresentationUIDs.forEach((segmentationDataUID) => {
7
+ _removeSegmentation(viewportId, segmentationDataUID, immediate);
8
+ });
9
+ }
10
+ function _removeSegmentation(viewportId, segmentationRepresentationUID, immediate) {
11
+ const segmentationRepresentation = getRepresentation(segmentationRepresentationUID);
12
+ const { type } = segmentationRepresentation;
13
+ if (type === SegmentationRepresentations.Labelmap) {
14
+ labelmapDisplay.removeRepresentation(viewportId, segmentationRepresentationUID, immediate);
15
+ }
16
+ else if (type === SegmentationRepresentations.Contour) {
17
+ contourDisplay.removeRepresentation(viewportId, segmentationRepresentationUID, immediate);
18
+ }
19
+ else {
20
+ throw new Error(`The representation ${type} is not supported yet`);
21
+ }
22
+ }
23
+ export default removeRepresentationsFromViewport;
@@ -1,5 +1,6 @@
1
+ import { getToolGroupForViewport } from '../../store/ToolGroupManager';
1
2
  import { invalidateBrushCursor } from '../../utilities/segmentation/';
2
- import { getSegmentation, getToolGroupIdsWithSegmentation, } from './segmentationState';
3
+ import { getSegmentation, getViewportIdsWithSegmentationId, } from './segmentationState';
3
4
  import { triggerSegmentationModified } from './triggerSegmentationEvents';
4
5
  function setActiveSegmentIndex(segmentationId, segmentIndex) {
5
6
  const segmentation = getSegmentation(segmentationId);
@@ -11,9 +12,10 @@ function setActiveSegmentIndex(segmentationId, segmentIndex) {
11
12
  segmentation.activeSegmentIndex = segmentIndex;
12
13
  triggerSegmentationModified(segmentationId);
13
14
  }
14
- const toolGroups = getToolGroupIdsWithSegmentation(segmentationId);
15
- toolGroups.forEach((toolGroupId) => {
16
- invalidateBrushCursor(toolGroupId);
15
+ const viewportIds = getViewportIdsWithSegmentationId(segmentationId);
16
+ viewportIds.forEach((viewportId) => {
17
+ const toolGroup = getToolGroupForViewport(viewportId);
18
+ invalidateBrushCursor(toolGroup.id);
17
19
  });
18
20
  }
19
21
  function getActiveSegmentIndex(segmentationId) {
@@ -1,33 +1,36 @@
1
1
  import type { Types } from '@cornerstonejs/core';
2
- import type { RepresentationConfig, Segmentation, SegmentationPublicInput, SegmentationRepresentationConfig, SegmentSpecificRepresentationConfig, ToolGroupSpecificRepresentation, ToolGroupSpecificRepresentations } from '../../types/SegmentationStateTypes';
2
+ import type { RepresentationConfig, Segmentation, SegmentationPublicInput, SegmentationRepresentationConfig, SegmentRepresentationConfig, SegmentationRepresentation } from '../../types/SegmentationStateTypes';
3
3
  declare function getDefaultSegmentationStateManager(): import("./SegmentationStateManager").default;
4
4
  declare function getSegmentation(segmentationId: string): Segmentation | undefined;
5
5
  declare function getSegmentations(): Segmentation[] | [];
6
6
  declare function addSegmentation(segmentationInput: SegmentationPublicInput, suppressEvents?: boolean): void;
7
- declare function getSegmentationRepresentations(toolGroupId: string): ToolGroupSpecificRepresentations | [];
8
- declare function getAllSegmentationRepresentations(): Record<string, ToolGroupSpecificRepresentation[]>;
9
- declare function getSegmentationIdRepresentations(segmentationId: any): any[];
10
- declare function findSegmentationRepresentationByUID(segmentationRepresentationUID: string): {
11
- toolGroupId: string;
12
- segmentationRepresentation: ToolGroupSpecificRepresentation;
7
+ declare function getRepresentations(): SegmentationRepresentation[];
8
+ declare function getRepresentation(segmentationRepresentationUID: string): SegmentationRepresentation | undefined;
9
+ declare function getRepresentationsBySegmentationId(segmentationId: string): SegmentationRepresentation[];
10
+ declare function getAllSegmentsConfig(segmentationRepresentationUID: string): RepresentationConfig;
11
+ declare function setAllSegmentsConfig(segmentationRepresentationUID: string, config: RepresentationConfig, suppressEvents?: boolean): void;
12
+ declare function getPerSegmentConfig(segmentationRepresentationUID: string): SegmentRepresentationConfig;
13
+ declare function setPerSegmentConfig(segmentationRepresentationUID: string, config: SegmentRepresentationConfig, suppressEvents?: boolean): void;
14
+ declare function getViewportIdsWithSegmentationId(segmentationId: string): string[];
15
+ declare function getRepresentationsForViewport(viewportId: string): SegmentationRepresentation[] | [];
16
+ declare function getRepresentationsRenderingStateForViewport(viewportId: string): {
17
+ [segRepUID: string]: {
18
+ visible: boolean;
19
+ segmentsHidden: Set<number>;
20
+ active: boolean;
21
+ };
13
22
  };
14
- declare function getToolGroupIdsWithSegmentation(segmentationId: string): string[];
15
- declare function getToolGroupSpecificConfig(toolGroupId: string): SegmentationRepresentationConfig;
16
- declare function setToolGroupSpecificConfig(toolGroupId: string, config: SegmentationRepresentationConfig, suppressEvents?: boolean): void;
17
- declare function setSegmentationRepresentationSpecificConfig(toolGroupId: string, segmentationRepresentationUID: string, config: RepresentationConfig, suppressEvents?: boolean): void;
18
- declare function getSegmentationRepresentationSpecificConfig(toolGroupId: string, segmentationRepresentationUID: string): RepresentationConfig;
19
- declare function getSegmentSpecificRepresentationConfig(toolGroupId: string, segmentationRepresentationUID: string, segmentIndex: number): RepresentationConfig;
20
- declare function setSegmentSpecificRepresentationConfig(toolGroupId: string, segmentationRepresentationUID: string, config: SegmentSpecificRepresentationConfig, suppressEvents?: boolean): void;
21
- declare function getToolGroupIdFromSegmentationRepresentationUID(segmentationRepresentationUID: string): string;
22
- declare function addSegmentationRepresentation(toolGroupId: string, segmentationRepresentation: ToolGroupSpecificRepresentation, suppressEvents?: boolean): void;
23
+ declare function addRepresentationToViewport(viewportId: string, segmentationRepresentation: SegmentationRepresentation, suppressEvents?: boolean): void;
23
24
  declare function getGlobalConfig(): SegmentationRepresentationConfig;
24
25
  declare function setGlobalConfig(config: SegmentationRepresentationConfig, suppressEvents?: boolean): void;
25
- declare function getSegmentationRepresentationByUID(toolGroupId: string, segmentationRepresentationUID: string): ToolGroupSpecificRepresentation | undefined;
26
26
  declare function removeSegmentation(segmentationId: string): void;
27
- declare function removeSegmentationRepresentation(toolGroupId: string, segmentationRepresentationUID: string): void;
28
- declare function removeSegmentationRepresentations(toolGroupId: string): void;
27
+ declare function removeRepresentation(segmentationRepresentationUID: string, suppressEvents?: boolean): void;
29
28
  declare function removeColorLUT(colorLUTIndex: number): void;
30
29
  declare function getColorLUT(index: number): Types.ColorLUT | undefined;
31
30
  declare function getNextColorLUTIndex(): number;
32
31
  declare function addColorLUT(colorLUT: Types.ColorLUT, index: number): void;
33
- export { getDefaultSegmentationStateManager, getSegmentation, getSegmentations, addSegmentation, removeSegmentation, getSegmentationRepresentations, addSegmentationRepresentation, removeSegmentationRepresentation, removeSegmentationRepresentations, getToolGroupSpecificConfig, setToolGroupSpecificConfig, getGlobalConfig, setGlobalConfig, getSegmentationRepresentationSpecificConfig, setSegmentationRepresentationSpecificConfig, getSegmentSpecificRepresentationConfig, setSegmentSpecificRepresentationConfig, getToolGroupIdsWithSegmentation, getAllSegmentationRepresentations, getSegmentationRepresentationByUID, getSegmentationIdRepresentations, addColorLUT, getColorLUT, getNextColorLUTIndex, removeColorLUT, findSegmentationRepresentationByUID, getToolGroupIdFromSegmentationRepresentationUID, };
32
+ declare function getRepresentationVisibility(viewportId: string, segmentationRepresentationUID: string): boolean;
33
+ declare function setRepresentationVisibility(viewportId: string, segmentationRepresentationUID: string, visible: boolean): void;
34
+ declare function getActiveRepresentation(viewportId: string): SegmentationRepresentation | undefined;
35
+ declare function setActiveRepresentation(viewportId: string, segmentationRepresentationUID: string, suppressEvents?: boolean): void;
36
+ export { getDefaultSegmentationStateManager, getSegmentation, getSegmentations, addSegmentation, removeSegmentation, getRepresentations, getRepresentation, removeRepresentation, getGlobalConfig, setGlobalConfig, getAllSegmentsConfig, setAllSegmentsConfig, getPerSegmentConfig, setPerSegmentConfig, getRepresentationsForViewport, addRepresentationToViewport, getRepresentationsRenderingStateForViewport, addColorLUT, getColorLUT, getNextColorLUTIndex, removeColorLUT, getRepresentationsBySegmentationId, getRepresentationVisibility, setRepresentationVisibility, getViewportIdsWithSegmentationId, getActiveRepresentation, setActiveRepresentation, };
@@ -21,109 +21,71 @@ function addSegmentation(segmentationInput, suppressEvents) {
21
21
  triggerSegmentationModified(segmentation.segmentationId);
22
22
  }
23
23
  }
24
- function getSegmentationRepresentations(toolGroupId) {
24
+ function getRepresentations() {
25
25
  const segmentationStateManager = getDefaultSegmentationStateManager();
26
- return segmentationStateManager.getSegmentationRepresentations(toolGroupId);
26
+ const state = segmentationStateManager.getState();
27
+ return Object.values(state.representations);
27
28
  }
28
- function getAllSegmentationRepresentations() {
29
+ function getRepresentation(segmentationRepresentationUID) {
29
30
  const segmentationStateManager = getDefaultSegmentationStateManager();
30
- return segmentationStateManager.getAllSegmentationRepresentations();
31
+ return segmentationStateManager.getRepresentation(segmentationRepresentationUID);
31
32
  }
32
- function getSegmentationIdRepresentations(segmentationId) {
33
- const allRepresentations = getAllSegmentationRepresentations() || {};
34
- const foundRepresentations = [];
35
- for (const toolGroupId in allRepresentations) {
36
- const toolGroupRepresentations = allRepresentations[toolGroupId];
37
- const foundRepresentation = toolGroupRepresentations.find((representation) => representation.segmentationId === segmentationId);
38
- if (foundRepresentation) {
39
- foundRepresentations.push(foundRepresentation);
40
- }
41
- }
42
- return foundRepresentations;
43
- }
44
- function findSegmentationRepresentationByUID(segmentationRepresentationUID) {
45
- const allToolGroupRepresentations = getAllSegmentationRepresentations() || [];
46
- const toolGroupIds = Object.keys(allToolGroupRepresentations);
47
- for (const toolGroupId of toolGroupIds) {
48
- const toolGroupRepresentations = getAllSegmentationRepresentations()[toolGroupId];
49
- const foundRepresentation = toolGroupRepresentations.find((representation) => representation.segmentationRepresentationUID ===
50
- segmentationRepresentationUID);
51
- if (foundRepresentation) {
52
- return {
53
- segmentationRepresentation: foundRepresentation,
54
- toolGroupId,
55
- };
56
- }
57
- }
33
+ function getRepresentationsBySegmentationId(segmentationId) {
34
+ const allRepresentations = getRepresentations();
35
+ return allRepresentations.filter((representation) => representation.segmentationId === segmentationId);
58
36
  }
59
- function getToolGroupIdsWithSegmentation(segmentationId) {
60
- if (!segmentationId) {
61
- throw new Error('getToolGroupIdsWithSegmentation: segmentationId is empty');
62
- }
37
+ function getAllSegmentsConfig(segmentationRepresentationUID) {
63
38
  const segmentationStateManager = getDefaultSegmentationStateManager();
64
- const state = segmentationStateManager.getState();
65
- const toolGroupIds = Object.keys(state.toolGroups);
66
- const foundToolGroupIds = [];
67
- toolGroupIds.forEach((toolGroupId) => {
68
- const toolGroupSegmentationRepresentations = segmentationStateManager.getSegmentationRepresentations(toolGroupId);
69
- toolGroupSegmentationRepresentations.forEach((representation) => {
70
- if (representation.segmentationId === segmentationId) {
71
- foundToolGroupIds.push(toolGroupId);
72
- }
73
- });
74
- });
75
- return foundToolGroupIds;
76
- }
77
- function getToolGroupSpecificConfig(toolGroupId) {
78
- const segmentationStateManager = getDefaultSegmentationStateManager();
79
- return segmentationStateManager.getToolGroupSpecificConfig(toolGroupId);
39
+ return segmentationStateManager.getAllSegmentsConfig(segmentationRepresentationUID);
80
40
  }
81
- function setToolGroupSpecificConfig(toolGroupId, config, suppressEvents) {
41
+ function setAllSegmentsConfig(segmentationRepresentationUID, config, suppressEvents) {
82
42
  const segmentationStateManager = getDefaultSegmentationStateManager();
83
- segmentationStateManager.setSegmentationRepresentationConfig(toolGroupId, config);
43
+ segmentationStateManager.setAllSegmentsConfig(segmentationRepresentationUID, config);
84
44
  if (!suppressEvents) {
85
- triggerSegmentationRepresentationModified(toolGroupId);
45
+ triggerSegmentationRepresentationModified(segmentationRepresentationUID);
86
46
  }
87
47
  }
88
- function setSegmentationRepresentationSpecificConfig(toolGroupId, segmentationRepresentationUID, config, suppressEvents = false) {
48
+ function getPerSegmentConfig(segmentationRepresentationUID) {
89
49
  const segmentationStateManager = getDefaultSegmentationStateManager();
90
- segmentationStateManager.setSegmentationRepresentationSpecificConfig(toolGroupId, segmentationRepresentationUID, config);
91
- if (!suppressEvents) {
92
- triggerSegmentationRepresentationModified(toolGroupId, segmentationRepresentationUID);
93
- }
50
+ return segmentationStateManager.getPerSegmentConfig(segmentationRepresentationUID);
94
51
  }
95
- function getSegmentationRepresentationSpecificConfig(toolGroupId, segmentationRepresentationUID) {
52
+ function setPerSegmentConfig(segmentationRepresentationUID, config, suppressEvents) {
96
53
  const segmentationStateManager = getDefaultSegmentationStateManager();
97
- return segmentationStateManager.getSegmentationRepresentationSpecificConfig(toolGroupId, segmentationRepresentationUID);
54
+ segmentationStateManager.setPerSegmentConfig(segmentationRepresentationUID, config);
55
+ if (!suppressEvents) {
56
+ triggerSegmentationRepresentationModified(segmentationRepresentationUID);
57
+ }
98
58
  }
99
- function getSegmentSpecificRepresentationConfig(toolGroupId, segmentationRepresentationUID, segmentIndex) {
59
+ function getViewportIdsWithSegmentationId(segmentationId) {
100
60
  const segmentationStateManager = getDefaultSegmentationStateManager();
101
- return segmentationStateManager.getSegmentSpecificConfig(toolGroupId, segmentationRepresentationUID, segmentIndex);
61
+ const state = segmentationStateManager.getState();
62
+ const viewports = state.viewports;
63
+ return Object.keys(viewports).filter((viewportId) => {
64
+ const viewport = viewports[viewportId];
65
+ return Object.keys(viewport).some((segRepUID) => state.representations[segRepUID].segmentationId === segmentationId);
66
+ });
102
67
  }
103
- function setSegmentSpecificRepresentationConfig(toolGroupId, segmentationRepresentationUID, config, suppressEvents = false) {
104
- const segmentationStateManager = getDefaultSegmentationStateManager();
105
- segmentationStateManager.setSegmentSpecificConfig(toolGroupId, segmentationRepresentationUID, config);
106
- if (!suppressEvents) {
107
- triggerSegmentationRepresentationModified(toolGroupId, segmentationRepresentationUID);
68
+ function getRepresentationsForViewport(viewportId) {
69
+ const viewportRenderingState = getRepresentationsRenderingStateForViewport(viewportId);
70
+ if (!viewportRenderingState) {
71
+ return [];
108
72
  }
73
+ const segRepUIDs = Object.keys(viewportRenderingState);
74
+ return segRepUIDs
75
+ .map((segRepUID) => getRepresentation(segRepUID))
76
+ .filter(Boolean);
109
77
  }
110
- function getToolGroupIdFromSegmentationRepresentationUID(segmentationRepresentationUID) {
111
- const allToolGroupRepresentations = getAllSegmentationRepresentations() || [];
112
- const toolGroupIds = Object.keys(allToolGroupRepresentations);
113
- for (const toolGroupId of toolGroupIds) {
114
- const toolGroupRepresentations = getAllSegmentationRepresentations()[toolGroupId];
115
- const foundRepresentation = toolGroupRepresentations.find((representation) => representation.segmentationRepresentationUID ===
116
- segmentationRepresentationUID);
117
- if (foundRepresentation) {
118
- return toolGroupId;
119
- }
120
- }
78
+ function getRepresentationsRenderingStateForViewport(viewportId) {
79
+ const segmentationStateManager = getDefaultSegmentationStateManager();
80
+ const state = segmentationStateManager.getState();
81
+ return state.viewports?.[viewportId] || {};
121
82
  }
122
- function addSegmentationRepresentation(toolGroupId, segmentationRepresentation, suppressEvents) {
83
+ function addRepresentationToViewport(viewportId, segmentationRepresentation, suppressEvents) {
123
84
  const segmentationStateManager = getDefaultSegmentationStateManager();
124
- segmentationStateManager.addSegmentationRepresentation(toolGroupId, segmentationRepresentation);
85
+ segmentationStateManager.addRepresentation(segmentationRepresentation);
86
+ segmentationStateManager.addRepresentationToViewport(viewportId, segmentationRepresentation.segmentationRepresentationUID);
125
87
  if (!suppressEvents) {
126
- triggerSegmentationRepresentationModified(toolGroupId, segmentationRepresentation.segmentationRepresentationUID);
88
+ triggerSegmentationRepresentationModified(segmentationRepresentation.segmentationRepresentationUID);
127
89
  }
128
90
  }
129
91
  function getGlobalConfig() {
@@ -137,25 +99,17 @@ function setGlobalConfig(config, suppressEvents) {
137
99
  triggerSegmentationModified();
138
100
  }
139
101
  }
140
- function getSegmentationRepresentationByUID(toolGroupId, segmentationRepresentationUID) {
141
- const segmentationStateManager = getDefaultSegmentationStateManager();
142
- return segmentationStateManager.getSegmentationRepresentationByUID(toolGroupId, segmentationRepresentationUID);
143
- }
144
102
  function removeSegmentation(segmentationId) {
145
103
  const segmentationStateManager = getDefaultSegmentationStateManager();
146
104
  segmentationStateManager.removeSegmentation(segmentationId);
147
105
  triggerSegmentationRemoved(segmentationId);
148
106
  }
149
- function removeSegmentationRepresentation(toolGroupId, segmentationRepresentationUID) {
107
+ function removeRepresentation(segmentationRepresentationUID, suppressEvents) {
150
108
  const segmentationStateManager = getDefaultSegmentationStateManager();
151
- segmentationStateManager.removeSegmentationRepresentation(toolGroupId, segmentationRepresentationUID);
152
- triggerSegmentationRepresentationRemoved(toolGroupId, segmentationRepresentationUID);
153
- }
154
- function removeSegmentationRepresentations(toolGroupId) {
155
- const segmentationRepresentations = getSegmentationRepresentations(toolGroupId) || [];
156
- segmentationRepresentations.forEach((representation) => {
157
- removeSegmentationRepresentation(toolGroupId, representation.segmentationRepresentationUID);
158
- });
109
+ segmentationStateManager.removeRepresentation(segmentationRepresentationUID);
110
+ if (!suppressEvents) {
111
+ triggerSegmentationRepresentationRemoved(segmentationRepresentationUID);
112
+ }
159
113
  }
160
114
  function removeColorLUT(colorLUTIndex) {
161
115
  const segmentationStateManager = getDefaultSegmentationStateManager();
@@ -173,4 +127,23 @@ function addColorLUT(colorLUT, index) {
173
127
  const segmentationStateManager = getDefaultSegmentationStateManager();
174
128
  segmentationStateManager.addColorLUT(colorLUT, index);
175
129
  }
176
- export { getDefaultSegmentationStateManager, getSegmentation, getSegmentations, addSegmentation, removeSegmentation, getSegmentationRepresentations, addSegmentationRepresentation, removeSegmentationRepresentation, removeSegmentationRepresentations, getToolGroupSpecificConfig, setToolGroupSpecificConfig, getGlobalConfig, setGlobalConfig, getSegmentationRepresentationSpecificConfig, setSegmentationRepresentationSpecificConfig, getSegmentSpecificRepresentationConfig, setSegmentSpecificRepresentationConfig, getToolGroupIdsWithSegmentation, getAllSegmentationRepresentations, getSegmentationRepresentationByUID, getSegmentationIdRepresentations, addColorLUT, getColorLUT, getNextColorLUTIndex, removeColorLUT, findSegmentationRepresentationByUID, getToolGroupIdFromSegmentationRepresentationUID, };
130
+ function getRepresentationVisibility(viewportId, segmentationRepresentationUID) {
131
+ const segmentationStateManager = getDefaultSegmentationStateManager();
132
+ return segmentationStateManager.getRepresentationVisibility(viewportId, segmentationRepresentationUID);
133
+ }
134
+ function setRepresentationVisibility(viewportId, segmentationRepresentationUID, visible) {
135
+ const segmentationStateManager = getDefaultSegmentationStateManager();
136
+ segmentationStateManager.setRepresentationVisibility(viewportId, segmentationRepresentationUID, visible);
137
+ }
138
+ function getActiveRepresentation(viewportId) {
139
+ const segmentationStateManager = getDefaultSegmentationStateManager();
140
+ return segmentationStateManager.getActiveRepresentation(viewportId);
141
+ }
142
+ function setActiveRepresentation(viewportId, segmentationRepresentationUID, suppressEvents) {
143
+ const segmentationStateManager = getDefaultSegmentationStateManager();
144
+ segmentationStateManager.setActiveRepresentation(viewportId, segmentationRepresentationUID);
145
+ if (!suppressEvents) {
146
+ triggerSegmentationRepresentationModified(segmentationRepresentationUID);
147
+ }
148
+ }
149
+ export { getDefaultSegmentationStateManager, getSegmentation, getSegmentations, addSegmentation, removeSegmentation, getRepresentations, getRepresentation, removeRepresentation, getGlobalConfig, setGlobalConfig, getAllSegmentsConfig, setAllSegmentsConfig, getPerSegmentConfig, setPerSegmentConfig, getRepresentationsForViewport, addRepresentationToViewport, getRepresentationsRenderingStateForViewport, addColorLUT, getColorLUT, getNextColorLUTIndex, removeColorLUT, getRepresentationsBySegmentationId, getRepresentationVisibility, setRepresentationVisibility, getViewportIdsWithSegmentationId, getActiveRepresentation, setActiveRepresentation, };
@@ -1,6 +1,6 @@
1
1
  declare function triggerSegmentationRemoved(segmentationId: string): void;
2
- declare function triggerSegmentationRepresentationRemoved(toolGroupId: string, segmentationRepresentationUID: string): void;
3
- declare function triggerSegmentationRepresentationModified(toolGroupId: string, segmentationRepresentationUID?: string): void;
2
+ declare function triggerSegmentationRepresentationRemoved(segmentationRepresentationUID: string): void;
3
+ declare function triggerSegmentationRepresentationModified(segmentationRepresentationUID: string): void;
4
4
  declare function triggerSegmentationModified(segmentationId?: string): void;
5
5
  declare function triggerSegmentationDataModified(segmentationId: string, modifiedSlicesToUse?: number[]): void;
6
6
  export { triggerSegmentationRepresentationModified, triggerSegmentationRepresentationRemoved, triggerSegmentationDataModified, triggerSegmentationModified, triggerSegmentationRemoved, };
@@ -1,6 +1,6 @@
1
1
  import { triggerEvent, eventTarget } from '@cornerstonejs/core';
2
2
  import { Events } from '../../enums';
3
- import { getSegmentationRepresentations, getSegmentations, } from '../../stateManagement/segmentation/segmentationState';
3
+ import { getSegmentations } from '../../stateManagement/segmentation/segmentationState';
4
4
  import { setSegmentationDirty } from '../../utilities/segmentation/getUniqueSegmentIndices';
5
5
  function triggerSegmentationRemoved(segmentationId) {
6
6
  const eventDetail = {
@@ -8,31 +8,17 @@ function triggerSegmentationRemoved(segmentationId) {
8
8
  };
9
9
  triggerEvent(eventTarget, Events.SEGMENTATION_REMOVED, eventDetail);
10
10
  }
11
- function triggerSegmentationRepresentationRemoved(toolGroupId, segmentationRepresentationUID) {
11
+ function triggerSegmentationRepresentationRemoved(segmentationRepresentationUID) {
12
12
  const eventDetail = {
13
- toolGroupId,
14
13
  segmentationRepresentationUID,
15
14
  };
16
15
  triggerEvent(eventTarget, Events.SEGMENTATION_REPRESENTATION_REMOVED, eventDetail);
17
16
  }
18
- function triggerSegmentationRepresentationModified(toolGroupId, segmentationRepresentationUID) {
17
+ function triggerSegmentationRepresentationModified(segmentationRepresentationUID) {
19
18
  const eventDetail = {
20
- toolGroupId,
21
19
  segmentationRepresentationUID,
22
20
  };
23
- if (segmentationRepresentationUID) {
24
- triggerEvent(eventTarget, Events.SEGMENTATION_REPRESENTATION_MODIFIED, eventDetail);
25
- return;
26
- }
27
- const segmentationRepresentations = getSegmentationRepresentations(toolGroupId) || [];
28
- segmentationRepresentations.forEach((segmentationRepresentation) => {
29
- const { segmentationRepresentationUID } = segmentationRepresentation;
30
- const eventDetail = {
31
- toolGroupId,
32
- segmentationRepresentationUID,
33
- };
34
- triggerEvent(eventTarget, Events.SEGMENTATION_REPRESENTATION_MODIFIED, eventDetail);
35
- });
21
+ triggerEvent(eventTarget, Events.SEGMENTATION_REPRESENTATION_MODIFIED, eventDetail);
36
22
  }
37
23
  function triggerSegmentationModified(segmentationId) {
38
24
  let segmentationIds;
@@ -1,11 +1,7 @@
1
1
  import { state } from '../index';
2
- import { removeSegmentationsFromToolGroup } from '../../stateManagement/segmentation';
3
- import { segmentationRenderingEngine } from '../../utilities/segmentation/triggerSegmentationRender';
4
2
  function destroyToolGroup(toolGroupId) {
5
3
  const toolGroupIndex = state.toolGroups.findIndex((tg) => tg.id === toolGroupId);
6
4
  if (toolGroupIndex > -1) {
7
- segmentationRenderingEngine.removeToolGroup(toolGroupId);
8
- removeSegmentationsFromToolGroup(toolGroupId);
9
5
  state.toolGroups.splice(toolGroupIndex, 1);
10
6
  }
11
7
  }
@@ -4,7 +4,7 @@ import { SegmentationRepresentations, ToolModes, Events as cstEvents, } from '..
4
4
  import { ToolGroupManager, state } from '../store';
5
5
  import { debounce } from '../utilities';
6
6
  import { segmentation } from '..';
7
- import { AnnotationTool, AdvancedMagnifyTool, SegmentationDisplayTool, } from './';
7
+ import { AnnotationTool, AdvancedMagnifyTool } from './';
8
8
  import { distanceToPoint } from '../utilities/math/point';
9
9
  const MAGNIFY_CLASSNAME = 'advancedMagnifyTool';
10
10
  const MAGNIFY_VIEWPORT_INITIAL_RADIUS = 125;
@@ -147,11 +147,11 @@ class AdvancedMagnifyViewport {
147
147
  const toolInstance = sourceToolGroup.getToolInstance(toolName);
148
148
  const isAnnotationTool = toolInstance instanceof AnnotationTool &&
149
149
  !(toolInstance instanceof AdvancedMagnifyTool);
150
- return (isAnnotationTool || toolName === SegmentationDisplayTool.toolName);
150
+ return isAnnotationTool;
151
151
  });
152
152
  magnifyToolGroup.addViewport(magnifyViewport.id, magnifyViewport.renderingEngineId);
153
153
  sourceActors.filter(isSegmentation).forEach((actor) => {
154
- segmentation.addSegmentationRepresentations(magnifyToolGroupId, [
154
+ segmentation.addRepresentations(this.viewportId, [
155
155
  {
156
156
  segmentationId: actor.referencedId,
157
157
  type: SegmentationRepresentations.Labelmap,
@@ -1,7 +1,7 @@
1
1
  import AnnotationDisplayTool from './base/AnnotationDisplayTool';
2
2
  import { ScaleOverlayAnnotation } from '../types/ToolSpecificAnnotationTypes';
3
3
  import type { Types } from '@cornerstonejs/core';
4
- import { PublicToolProps, ToolProps, SVGDrawingHelper } from '../types';
4
+ import { EventTypes, PublicToolProps, ToolProps, SVGDrawingHelper } from '../types';
5
5
  declare class ScaleOverlayTool extends AnnotationDisplayTool {
6
6
  static toolName: any;
7
7
  touchDragCallback: any;
@@ -609,13 +609,13 @@ class BidirectionalTool extends AnnotationTool {
609
609
  const index4 = transformWorldToIndex(imageData, worldPos4);
610
610
  const handles1 = [index1, index2];
611
611
  const handles2 = [index3, index4];
612
- const { scale: scale1, units: units1 } = getCalibratedLengthUnitsAndScale(image, handles1);
613
- const { scale: scale2, units: units2 } = getCalibratedLengthUnitsAndScale(image, handles2);
612
+ const { scale: scale1, lengthUnits: units1 } = getCalibratedLengthUnitsAndScale(image, handles1);
613
+ const { scale: scale2, lengthUnits: units2 } = getCalibratedLengthUnitsAndScale(image, handles2);
614
614
  const dist1 = this._calculateLength(worldPos1, worldPos2) / scale1;
615
615
  const dist2 = this._calculateLength(worldPos3, worldPos4) / scale2;
616
616
  const length = dist1 > dist2 ? dist1 : dist2;
617
617
  const width = dist1 > dist2 ? dist2 : dist1;
618
- const lengthUnit = dist1 > dist2 ? units1 : units2;
618
+ const lengthUnits = dist1 > dist2 ? units1 : units2;
619
619
  const widthUnit = dist1 > dist2 ? units2 : units1;
620
620
  this._isInsideVolume(index1, index2, index3, index4, dimensions)
621
621
  ? (this.isHandleOutsideImage = false)
@@ -623,8 +623,7 @@ class BidirectionalTool extends AnnotationTool {
623
623
  cachedStats[targetId] = {
624
624
  length,
625
625
  width,
626
- unit: units1,
627
- lengthUnit,
626
+ lengthUnits,
628
627
  widthUnit,
629
628
  };
630
629
  }
@@ -714,7 +713,7 @@ class BidirectionalTool extends AnnotationTool {
714
713
  }
715
714
  function defaultGetTextLines(data, targetId) {
716
715
  const { cachedStats, label } = data;
717
- const { length, width, unit, lengthUnit, widthUnit } = cachedStats[targetId];
716
+ const { length, width, unit, lengthUnits, widthUnit } = cachedStats[targetId];
718
717
  const textLines = [];
719
718
  if (label) {
720
719
  textLines.push(label);
@@ -722,7 +721,7 @@ function defaultGetTextLines(data, targetId) {
722
721
  if (length === undefined) {
723
722
  return textLines;
724
723
  }
725
- textLines.push(`L: ${roundNumber(length)} ${lengthUnit || unit}`, `W: ${roundNumber(width)} ${widthUnit || unit}`);
724
+ textLines.push(`L: ${roundNumber(length)} ${lengthUnits || unit}`, `W: ${roundNumber(width)} ${widthUnit || unit}`);
726
725
  return textLines;
727
726
  }
728
727
  BidirectionalTool.toolName = 'Bidirectional';
@@ -16,7 +16,7 @@ import getWorldWidthAndHeightFromTwoPoints from '../../utilities/planar/getWorld
16
16
  import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
17
17
  import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
18
18
  import { pointInShapeCallback } from '../../utilities';
19
- import { getModalityUnit } from '../../utilities/getModalityUnit';
19
+ import { getPixelValueUnits } from '../../utilities/getPixelValueUnits';
20
20
  import { isViewportPreScaled } from '../../utilities/viewport/isViewportPreScaled';
21
21
  import { getCanvasCircleCorners, getCanvasCircleRadius, } from '../../utilities/math/circle';
22
22
  import { pointInEllipse } from '../../utilities/math/ellipse';
@@ -347,14 +347,14 @@ class CircleROITool extends AnnotationTool {
347
347
  const canvasCorners = getCanvasCircleCorners(canvasCoordinates);
348
348
  const { centerPointRadius } = this.configuration;
349
349
  if (!data.cachedStats[targetId] ||
350
- data.cachedStats[targetId].areaUnit == null) {
350
+ data.cachedStats[targetId].areaUnits == null) {
351
351
  data.cachedStats[targetId] = {
352
352
  Modality: null,
353
353
  area: null,
354
354
  max: null,
355
355
  mean: null,
356
356
  stdDev: null,
357
- areaUnit: null,
357
+ areaUnits: null,
358
358
  radius: null,
359
359
  radiusUnit: null,
360
360
  perimeter: null,
@@ -508,16 +508,16 @@ class CircleROITool extends AnnotationTool {
508
508
  const { worldWidth, worldHeight } = getWorldWidthAndHeightFromTwoPoints(viewPlaneNormal, viewUp, worldPos1, worldPos2);
509
509
  const isEmptyArea = worldWidth === 0 && worldHeight === 0;
510
510
  const handles = [pos1Index, pos2Index];
511
- const { scale, units, areaUnits } = getCalibratedLengthUnitsAndScale(image, handles);
511
+ const { scale, lengthUnits, areaUnits } = getCalibratedLengthUnitsAndScale(image, handles);
512
512
  const aspect = getCalibratedAspect(image);
513
513
  const area = Math.abs(Math.PI *
514
514
  (worldWidth / scale / 2) *
515
515
  (worldHeight / aspect / scale / 2));
516
- const modalityUnitOptions = {
516
+ const pixelUnitsOptions = {
517
517
  isPreScaled: isViewportPreScaled(viewport, targetId),
518
518
  isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
519
519
  };
520
- const modalityUnit = getModalityUnit(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
520
+ const pixelValueUnits = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
521
521
  const pointsInShape = pointInShapeCallback(imageData, (pointLPS) => pointInEllipse(ellipseObj, pointLPS, {
522
522
  fast: true,
523
523
  }), this.configuration.statsCalculator.statsCallback, boundsIJK);
@@ -531,11 +531,11 @@ class CircleROITool extends AnnotationTool {
531
531
  statsArray: stats.array,
532
532
  pointsInShape: pointsInShape,
533
533
  isEmptyArea,
534
- areaUnit: areaUnits,
534
+ areaUnits,
535
535
  radius: worldWidth / 2 / scale,
536
- radiusUnit: units,
536
+ radiusUnit: lengthUnits,
537
537
  perimeter: (2 * Math.PI * (worldWidth / 2)) / scale,
538
- modalityUnit,
538
+ pixelValueUnits,
539
539
  };
540
540
  }
541
541
  else {
@@ -558,7 +558,7 @@ class CircleROITool extends AnnotationTool {
558
558
  }
559
559
  function defaultGetTextLines(data, targetId) {
560
560
  const cachedVolumeStats = data.cachedStats[targetId];
561
- const { radius, radiusUnit, area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit, } = cachedVolumeStats;
561
+ const { radius, radiusUnit, area, mean, stdDev, max, isEmptyArea, areaUnits, pixelValueUnits, } = cachedVolumeStats;
562
562
  const textLines = [];
563
563
  if (radius) {
564
564
  const radiusLine = isEmptyArea
@@ -569,17 +569,17 @@ function defaultGetTextLines(data, targetId) {
569
569
  if (area) {
570
570
  const areaLine = isEmptyArea
571
571
  ? `Area: Oblique not supported`
572
- : `Area: ${roundNumber(area)} ${areaUnit}`;
572
+ : `Area: ${roundNumber(area)} ${areaUnits}`;
573
573
  textLines.push(areaLine);
574
574
  }
575
575
  if (mean) {
576
- textLines.push(`Mean: ${roundNumber(mean)} ${modalityUnit}`);
576
+ textLines.push(`Mean: ${roundNumber(mean)} ${pixelValueUnits}`);
577
577
  }
578
578
  if (max) {
579
- textLines.push(`Max: ${roundNumber(max)} ${modalityUnit}`);
579
+ textLines.push(`Max: ${roundNumber(max)} ${pixelValueUnits}`);
580
580
  }
581
581
  if (stdDev) {
582
- textLines.push(`Std Dev: ${roundNumber(stdDev)} ${modalityUnit}`);
582
+ textLines.push(`Std Dev: ${roundNumber(stdDev)} ${pixelValueUnits}`);
583
583
  }
584
584
  return textLines;
585
585
  }
@@ -84,7 +84,7 @@ class DragProbeTool extends ProbeTool {
84
84
  annotation,
85
85
  styleSpecifier,
86
86
  });
87
- const modalityUnitOptions = {
87
+ const pixelUnitsOptions = {
88
88
  isPreScaled: isViewportPreScaled(viewport, targetId),
89
89
  isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
90
90
  };
@@ -122,13 +122,13 @@ class DragProbeTool extends ProbeTool {
122
122
  }
123
123
  function defaultGetTextLines(data, targetId) {
124
124
  const cachedVolumeStats = data.cachedStats[targetId];
125
- const { index, value, modalityUnit } = cachedVolumeStats;
125
+ const { index, value, pixelValueUnits } = cachedVolumeStats;
126
126
  if (value === undefined) {
127
127
  return;
128
128
  }
129
129
  const textLines = [];
130
130
  textLines.push(`(${index[0]}, ${index[1]}, ${index[2]})`);
131
- textLines.push(`${value.toFixed(2)} ${modalityUnit}`);
131
+ textLines.push(`${value.toFixed(2)} ${pixelValueUnits}`);
132
132
  return textLines;
133
133
  }
134
134
  DragProbeTool.toolName = 'DragProbe';