@cornerstonejs/tools 0.4.2 → 0.5.0

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 (140) hide show
  1. package/README.md +7 -1
  2. package/dist/cjs/eventListeners/segmentation/segmentationDataModifiedEventListener.js +2 -2
  3. package/dist/cjs/eventListeners/segmentation/segmentationDataModifiedEventListener.js.map +1 -1
  4. package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.d.ts +2 -2
  5. package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.js.map +1 -1
  6. package/dist/cjs/stateManagement/segmentation/addSegmentationRepresentations.d.ts +1 -1
  7. package/dist/cjs/stateManagement/segmentation/addSegmentationRepresentations.js +6 -2
  8. package/dist/cjs/stateManagement/segmentation/addSegmentationRepresentations.js.map +1 -1
  9. package/dist/cjs/stateManagement/segmentation/helpers/normalizeSegmentationInput.js +1 -1
  10. package/dist/cjs/stateManagement/segmentation/helpers/normalizeSegmentationInput.js.map +1 -1
  11. package/dist/cjs/stateManagement/segmentation/helpers/validateSegmentationInput.js +1 -1
  12. package/dist/cjs/stateManagement/segmentation/helpers/validateSegmentationInput.js.map +1 -1
  13. package/dist/cjs/stateManagement/segmentation/index.d.ts +1 -2
  14. package/dist/cjs/stateManagement/segmentation/index.js +1 -3
  15. package/dist/cjs/stateManagement/segmentation/index.js.map +1 -1
  16. package/dist/cjs/stateManagement/segmentation/segmentIndex.d.ts +3 -5
  17. package/dist/cjs/stateManagement/segmentation/segmentIndex.js +4 -30
  18. package/dist/cjs/stateManagement/segmentation/segmentIndex.js.map +1 -1
  19. package/dist/cjs/stateManagement/segmentation/segmentLocking.d.ts +4 -6
  20. package/dist/cjs/stateManagement/segmentation/segmentLocking.js +7 -36
  21. package/dist/cjs/stateManagement/segmentation/segmentLocking.js.map +1 -1
  22. package/dist/cjs/stateManagement/segmentation/segmentationState.d.ts +2 -2
  23. package/dist/cjs/stateManagement/segmentation/segmentationState.js +0 -9
  24. package/dist/cjs/stateManagement/segmentation/segmentationState.js.map +1 -1
  25. package/dist/cjs/tools/annotation/BidirectionalTool.d.ts +2 -27
  26. package/dist/cjs/tools/annotation/BidirectionalTool.js.map +1 -1
  27. package/dist/cjs/tools/annotation/EllipticalROITool.d.ts +2 -29
  28. package/dist/cjs/tools/annotation/EllipticalROITool.js.map +1 -1
  29. package/dist/cjs/tools/annotation/LengthTool.d.ts +2 -25
  30. package/dist/cjs/tools/annotation/LengthTool.js.map +1 -1
  31. package/dist/cjs/tools/annotation/ProbeTool.d.ts +2 -17
  32. package/dist/cjs/tools/annotation/ProbeTool.js.map +1 -1
  33. package/dist/cjs/tools/annotation/RectangleROITool.d.ts +2 -34
  34. package/dist/cjs/tools/annotation/RectangleROITool.js.map +1 -1
  35. package/dist/cjs/tools/displayTools/Labelmap/labelmapConfig.js +0 -2
  36. package/dist/cjs/tools/displayTools/Labelmap/labelmapConfig.js.map +1 -1
  37. package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.d.ts +1 -1
  38. package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js +7 -5
  39. package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
  40. package/dist/cjs/tools/segmentation/BrushTool.d.ts +2 -1
  41. package/dist/cjs/tools/segmentation/BrushTool.js +101 -98
  42. package/dist/cjs/tools/segmentation/BrushTool.js.map +1 -1
  43. package/dist/cjs/tools/segmentation/CircleScissorsTool.js +4 -4
  44. package/dist/cjs/tools/segmentation/CircleScissorsTool.js.map +1 -1
  45. package/dist/cjs/tools/segmentation/RectangleROIStartEndThresholdTool.d.ts +2 -29
  46. package/dist/cjs/tools/segmentation/RectangleROIStartEndThresholdTool.js.map +1 -1
  47. package/dist/cjs/tools/segmentation/RectangleROIThresholdTool.d.ts +1 -22
  48. package/dist/cjs/tools/segmentation/RectangleROIThresholdTool.js.map +1 -1
  49. package/dist/cjs/tools/segmentation/RectangleScissorsTool.js +4 -4
  50. package/dist/cjs/tools/segmentation/RectangleScissorsTool.js.map +1 -1
  51. package/dist/cjs/tools/segmentation/SphereScissorsTool.js +4 -4
  52. package/dist/cjs/tools/segmentation/SphereScissorsTool.js.map +1 -1
  53. package/dist/cjs/types/LabelmapTypes.d.ts +1 -2
  54. package/dist/cjs/types/SegmentationStateTypes.d.ts +6 -5
  55. package/dist/cjs/types/ToolSpecificAnnotationTypes.d.ts +168 -0
  56. package/dist/cjs/types/ToolSpecificAnnotationTypes.js +3 -0
  57. package/dist/cjs/types/ToolSpecificAnnotationTypes.js.map +1 -0
  58. package/dist/cjs/types/index.d.ts +2 -1
  59. package/dist/cjs/utilities/segmentation/createLabelmapVolumeForViewport.d.ts +18 -0
  60. package/dist/cjs/{stateManagement/segmentation/createNewSegmentationForToolGroup.js → utilities/segmentation/createLabelmapVolumeForViewport.js} +8 -10
  61. package/dist/cjs/utilities/segmentation/createLabelmapVolumeForViewport.js.map +1 -0
  62. package/dist/cjs/utilities/segmentation/index.d.ts +2 -1
  63. package/dist/cjs/utilities/segmentation/index.js +3 -1
  64. package/dist/cjs/utilities/segmentation/index.js.map +1 -1
  65. package/dist/cjs/utilities/segmentation/thresholdVolumeByRange.d.ts +2 -2
  66. package/dist/cjs/utilities/segmentation/thresholdVolumeByRange.js +2 -2
  67. package/dist/cjs/utilities/segmentation/thresholdVolumeByRange.js.map +1 -1
  68. package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js +2 -2
  69. package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js.map +1 -1
  70. package/dist/esm/stateManagement/segmentation/SegmentationStateManager.d.ts +2 -2
  71. package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js.map +1 -1
  72. package/dist/esm/stateManagement/segmentation/addSegmentationRepresentations.d.ts +1 -1
  73. package/dist/esm/stateManagement/segmentation/addSegmentationRepresentations.js +6 -2
  74. package/dist/esm/stateManagement/segmentation/addSegmentationRepresentations.js.map +1 -1
  75. package/dist/esm/stateManagement/segmentation/helpers/normalizeSegmentationInput.js +1 -1
  76. package/dist/esm/stateManagement/segmentation/helpers/normalizeSegmentationInput.js.map +1 -1
  77. package/dist/esm/stateManagement/segmentation/helpers/validateSegmentationInput.js +1 -1
  78. package/dist/esm/stateManagement/segmentation/helpers/validateSegmentationInput.js.map +1 -1
  79. package/dist/esm/stateManagement/segmentation/index.d.ts +1 -2
  80. package/dist/esm/stateManagement/segmentation/index.js +1 -2
  81. package/dist/esm/stateManagement/segmentation/index.js.map +1 -1
  82. package/dist/esm/stateManagement/segmentation/segmentIndex.d.ts +3 -5
  83. package/dist/esm/stateManagement/segmentation/segmentIndex.js +3 -27
  84. package/dist/esm/stateManagement/segmentation/segmentIndex.js.map +1 -1
  85. package/dist/esm/stateManagement/segmentation/segmentLocking.d.ts +4 -6
  86. package/dist/esm/stateManagement/segmentation/segmentLocking.js +4 -31
  87. package/dist/esm/stateManagement/segmentation/segmentLocking.js.map +1 -1
  88. package/dist/esm/stateManagement/segmentation/segmentationState.d.ts +2 -2
  89. package/dist/esm/stateManagement/segmentation/segmentationState.js +1 -10
  90. package/dist/esm/stateManagement/segmentation/segmentationState.js.map +1 -1
  91. package/dist/esm/tools/annotation/BidirectionalTool.d.ts +2 -27
  92. package/dist/esm/tools/annotation/BidirectionalTool.js.map +1 -1
  93. package/dist/esm/tools/annotation/EllipticalROITool.d.ts +2 -29
  94. package/dist/esm/tools/annotation/EllipticalROITool.js.map +1 -1
  95. package/dist/esm/tools/annotation/LengthTool.d.ts +2 -25
  96. package/dist/esm/tools/annotation/LengthTool.js.map +1 -1
  97. package/dist/esm/tools/annotation/ProbeTool.d.ts +2 -17
  98. package/dist/esm/tools/annotation/ProbeTool.js.map +1 -1
  99. package/dist/esm/tools/annotation/RectangleROITool.d.ts +2 -34
  100. package/dist/esm/tools/annotation/RectangleROITool.js.map +1 -1
  101. package/dist/esm/tools/displayTools/Labelmap/labelmapConfig.js +0 -2
  102. package/dist/esm/tools/displayTools/Labelmap/labelmapConfig.js.map +1 -1
  103. package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.d.ts +1 -1
  104. package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +7 -5
  105. package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
  106. package/dist/esm/tools/segmentation/BrushTool.d.ts +2 -1
  107. package/dist/esm/tools/segmentation/BrushTool.js +101 -98
  108. package/dist/esm/tools/segmentation/BrushTool.js.map +1 -1
  109. package/dist/esm/tools/segmentation/CircleScissorsTool.js +4 -4
  110. package/dist/esm/tools/segmentation/CircleScissorsTool.js.map +1 -1
  111. package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.d.ts +2 -29
  112. package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js.map +1 -1
  113. package/dist/esm/tools/segmentation/RectangleROIThresholdTool.d.ts +1 -22
  114. package/dist/esm/tools/segmentation/RectangleROIThresholdTool.js.map +1 -1
  115. package/dist/esm/tools/segmentation/RectangleScissorsTool.js +4 -4
  116. package/dist/esm/tools/segmentation/RectangleScissorsTool.js.map +1 -1
  117. package/dist/esm/tools/segmentation/SphereScissorsTool.js +4 -4
  118. package/dist/esm/tools/segmentation/SphereScissorsTool.js.map +1 -1
  119. package/dist/esm/types/LabelmapTypes.d.ts +1 -2
  120. package/dist/esm/types/SegmentationStateTypes.d.ts +6 -5
  121. package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +168 -0
  122. package/dist/esm/types/ToolSpecificAnnotationTypes.js +2 -0
  123. package/dist/esm/types/ToolSpecificAnnotationTypes.js.map +1 -0
  124. package/dist/esm/types/index.d.ts +2 -1
  125. package/dist/esm/utilities/segmentation/createLabelmapVolumeForViewport.d.ts +18 -0
  126. package/dist/esm/{stateManagement/segmentation/createNewSegmentationForToolGroup.js → utilities/segmentation/createLabelmapVolumeForViewport.js} +7 -10
  127. package/dist/esm/utilities/segmentation/createLabelmapVolumeForViewport.js.map +1 -0
  128. package/dist/esm/utilities/segmentation/index.d.ts +2 -1
  129. package/dist/esm/utilities/segmentation/index.js +2 -1
  130. package/dist/esm/utilities/segmentation/index.js.map +1 -1
  131. package/dist/esm/utilities/segmentation/thresholdVolumeByRange.d.ts +2 -2
  132. package/dist/esm/utilities/segmentation/thresholdVolumeByRange.js +2 -2
  133. package/dist/esm/utilities/segmentation/thresholdVolumeByRange.js.map +1 -1
  134. package/dist/umd/index.js +1 -1
  135. package/dist/umd/index.js.map +1 -1
  136. package/package.json +6 -6
  137. package/dist/cjs/stateManagement/segmentation/createNewSegmentationForToolGroup.d.ts +0 -14
  138. package/dist/cjs/stateManagement/segmentation/createNewSegmentationForToolGroup.js.map +0 -1
  139. package/dist/esm/stateManagement/segmentation/createNewSegmentationForToolGroup.d.ts +0 -14
  140. package/dist/esm/stateManagement/segmentation/createNewSegmentationForToolGroup.js.map +0 -1
@@ -2,7 +2,6 @@ import type { vtkColorTransferFunction } from 'vtk.js/Sources/Rendering/Core/Col
2
2
  import type { vtkPiecewiseFunction } from 'vtk.js/Sources/Common/DataModel/PiecewiseFunction';
3
3
  export declare type labelmapConfig = {
4
4
  renderOutline?: boolean;
5
- outlineWidth?: number;
6
5
  outlineWidthActive?: number;
7
6
  outlineWidthInactive?: number;
8
7
  renderFill?: boolean;
@@ -13,7 +12,7 @@ export declare type LabelmapRenderingConfig = {
13
12
  cfun?: vtkColorTransferFunction;
14
13
  ofun?: vtkPiecewiseFunction;
15
14
  };
16
- export declare type LabelmapRepresentationData = {
15
+ export declare type LabelmapSegmentationData = {
17
16
  volumeId: string;
18
17
  referencedVolumeId?: string;
19
18
  };
@@ -1,5 +1,5 @@
1
1
  import * as Enums from '../enums';
2
- import type { labelmapConfig, LabelmapRepresentationData, LabelmapRenderingConfig } from './LabelmapTypes';
2
+ import type { labelmapConfig, LabelmapSegmentationData, LabelmapRenderingConfig } from './LabelmapTypes';
3
3
  export declare type Color = [number, number, number, number];
4
4
  export declare type ColorLut = Array<Color>;
5
5
  export declare type RepresentationConfig = {
@@ -10,7 +10,7 @@ export declare type SegmentationRepresentationConfig = {
10
10
  representations: RepresentationConfig;
11
11
  };
12
12
  export declare type SegmentationRepresentationData = {
13
- LABELMAP?: LabelmapRepresentationData;
13
+ LABELMAP?: LabelmapSegmentationData;
14
14
  };
15
15
  export declare type Segmentation = {
16
16
  segmentationId: string;
@@ -21,7 +21,7 @@ export declare type Segmentation = {
21
21
  cachedStats: {
22
22
  [key: string]: number;
23
23
  };
24
- representations: SegmentationRepresentationData;
24
+ representationData: SegmentationRepresentationData;
25
25
  };
26
26
  export declare type ToolGroupSpecificRepresentationState = {
27
27
  segmentationRepresentationUID: string;
@@ -36,13 +36,14 @@ export declare type ToolGroupSpecificLabelmapRepresentation = ToolGroupSpecificR
36
36
  config: LabelmapRenderingConfig;
37
37
  };
38
38
  export declare type ToolGroupSpecificRepresentation = ToolGroupSpecificLabelmapRepresentation;
39
+ export declare type ToolGroupSpecificRepresentations = Array<ToolGroupSpecificRepresentation>;
39
40
  export declare type SegmentationState = {
40
41
  colorLut: ColorLut[];
41
42
  segmentations: Segmentation[];
42
43
  globalConfig: SegmentationRepresentationConfig;
43
44
  toolGroups: {
44
45
  [key: string]: {
45
- segmentationRepresentations: ToolGroupSpecificRepresentation[];
46
+ segmentationRepresentations: ToolGroupSpecificRepresentations;
46
47
  config: SegmentationRepresentationConfig;
47
48
  };
48
49
  };
@@ -51,7 +52,7 @@ export declare type SegmentationPublicInput = {
51
52
  segmentationId: string;
52
53
  representation: {
53
54
  type: Enums.SegmentationRepresentations;
54
- data: LabelmapRepresentationData;
55
+ data: LabelmapSegmentationData;
55
56
  };
56
57
  };
57
58
  export declare type RepresentationPublicInput = {
@@ -0,0 +1,168 @@
1
+ import type { Types } from '@cornerstonejs/core';
2
+ import { Annotation } from './AnnotationTypes';
3
+ interface ROICachedStats {
4
+ [targetId: string]: {
5
+ Modality: string;
6
+ area: number;
7
+ max: number;
8
+ mean: number;
9
+ stdDev: number;
10
+ };
11
+ }
12
+ export interface RectangleROIAnnotation extends Annotation {
13
+ data: {
14
+ handles: {
15
+ points: Types.Point3[];
16
+ activeHandleIndex: number | null;
17
+ textBox: {
18
+ hasMoved: boolean;
19
+ worldPosition: Types.Point3;
20
+ worldBoundingBox: {
21
+ topLeft: Types.Point3;
22
+ topRight: Types.Point3;
23
+ bottomLeft: Types.Point3;
24
+ bottomRight: Types.Point3;
25
+ };
26
+ };
27
+ };
28
+ label: string;
29
+ cachedStats?: ROICachedStats | {
30
+ projectionPoints?: Types.Point3[];
31
+ projectionPointsImageIds?: string[];
32
+ };
33
+ };
34
+ }
35
+ export interface ProbeAnnotation extends Annotation {
36
+ data: {
37
+ handles: {
38
+ points: Types.Point3[];
39
+ };
40
+ cachedStats: {
41
+ [targetId: string]: {
42
+ Modality: string;
43
+ index: Types.Point3;
44
+ value: number;
45
+ };
46
+ };
47
+ label: string;
48
+ };
49
+ }
50
+ export interface LengthAnnotation extends Annotation {
51
+ data: {
52
+ handles: {
53
+ points: Types.Point3[];
54
+ activeHandleIndex: number | null;
55
+ textBox: {
56
+ hasMoved: boolean;
57
+ worldPosition: Types.Point3;
58
+ worldBoundingBox: {
59
+ topLeft: Types.Point3;
60
+ topRight: Types.Point3;
61
+ bottomLeft: Types.Point3;
62
+ bottomRight: Types.Point3;
63
+ };
64
+ };
65
+ };
66
+ label: string;
67
+ cachedStats: {
68
+ [targetId: string]: {
69
+ length: number;
70
+ };
71
+ };
72
+ };
73
+ }
74
+ export interface EllipticalROIAnnotation extends Annotation {
75
+ data: {
76
+ handles: {
77
+ points: [Types.Point3, Types.Point3, Types.Point3, Types.Point3];
78
+ activeHandleIndex: number | null;
79
+ textBox?: {
80
+ hasMoved: boolean;
81
+ worldPosition: Types.Point3;
82
+ worldBoundingBox: {
83
+ topLeft: Types.Point3;
84
+ topRight: Types.Point3;
85
+ bottomLeft: Types.Point3;
86
+ bottomRight: Types.Point3;
87
+ };
88
+ };
89
+ };
90
+ label: string;
91
+ cachedStats?: ROICachedStats;
92
+ };
93
+ }
94
+ export interface BidirectionalAnnotation extends Annotation {
95
+ data: {
96
+ handles: {
97
+ points: Types.Point3[];
98
+ activeHandleIndex: number | null;
99
+ textBox: {
100
+ hasMoved: boolean;
101
+ worldPosition: Types.Point3;
102
+ worldBoundingBox: {
103
+ topLeft: Types.Point3;
104
+ topRight: Types.Point3;
105
+ bottomLeft: Types.Point3;
106
+ bottomRight: Types.Point3;
107
+ };
108
+ };
109
+ };
110
+ label: string;
111
+ cachedStats: {
112
+ [targetId: string]: {
113
+ length: number;
114
+ width: number;
115
+ };
116
+ };
117
+ };
118
+ }
119
+ export interface RectangleROIThresholdAnnotation extends Annotation {
120
+ metadata: {
121
+ cameraPosition?: Types.Point3;
122
+ cameraFocalPoint?: Types.Point3;
123
+ viewPlaneNormal?: Types.Point3;
124
+ viewUp?: Types.Point3;
125
+ annotationUID?: string;
126
+ FrameOfReferenceUID: string;
127
+ referencedImageId?: string;
128
+ toolName: string;
129
+ enabledElement: Types.IEnabledElement;
130
+ volumeId: string;
131
+ };
132
+ data: {
133
+ label: string;
134
+ handles: {
135
+ points: Types.Point3[];
136
+ activeHandleIndex: number | null;
137
+ };
138
+ };
139
+ }
140
+ export interface RectangleROIStartEndThresholdAnnotation extends Annotation {
141
+ metadata: {
142
+ cameraPosition?: Types.Point3;
143
+ cameraFocalPoint?: Types.Point3;
144
+ viewPlaneNormal?: Types.Point3;
145
+ viewUp?: Types.Point3;
146
+ annotationUID?: string;
147
+ FrameOfReferenceUID: string;
148
+ referencedImageId?: string;
149
+ toolName: string;
150
+ enabledElement: any;
151
+ volumeId: string;
152
+ spacingInNormal: number;
153
+ };
154
+ data: {
155
+ label: string;
156
+ startSlice: number;
157
+ endSlice: number;
158
+ cachedStats: {
159
+ projectionPoints: Types.Point3[][];
160
+ projectionPointsImageIds: string[];
161
+ };
162
+ handles: {
163
+ points: Types.Point3[];
164
+ activeHandleIndex: number | null;
165
+ };
166
+ };
167
+ }
168
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ToolSpecificAnnotationTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolSpecificAnnotationTypes.js","sourceRoot":"","sources":["../../../src/types/ToolSpecificAnnotationTypes.ts"],"names":[],"mappings":""}
@@ -4,10 +4,11 @@ import type IPoints from './IPoints';
4
4
  import type PlanarBoundingBox from './PlanarBoundingBox';
5
5
  import type { SetToolBindingsType, IToolBinding, ToolOptionsType } from './ISetToolModeOptions';
6
6
  import type IToolGroup from './IToolGroup';
7
+ import type * as ToolSpecificAnnotationTypes from './ToolSpecificAnnotationTypes';
7
8
  import type ToolHandle from './ToolHandle';
8
9
  import type { AnnotationHandle, TextBoxHandle } from './ToolHandle';
9
10
  import type InteractionTypes from './InteractionTypes';
10
11
  import type { ToolProps, PublicToolProps } from './ToolProps';
11
12
  import type { SVGCursorDescriptor, SVGPoint } from './CursorTypes';
12
13
  import type { Color, ColorLut, RepresentationConfig, SegmentationRepresentationConfig, SegmentationRepresentationData, Segmentation, ToolGroupSpecificRepresentationState, ToolGroupSpecificLabelmapRepresentation, ToolGroupSpecificRepresentation, SegmentationState } from './SegmentationStateTypes';
13
- export type { Annotation, Annotations, FrameOfReferenceSpecificAnnotations, AnnotationState, PlanarBoundingBox, ToolProps, PublicToolProps, EventTypes, IPoints, IToolBinding, SetToolBindingsType, ToolOptionsType, InteractionTypes, IToolGroup, ToolHandle, AnnotationHandle, TextBoxHandle, Segmentation, SegmentationState, SegmentationRepresentationData, SegmentationRepresentationConfig, RepresentationConfig, ToolGroupSpecificRepresentationState, ToolGroupSpecificLabelmapRepresentation, ToolGroupSpecificRepresentation, Color, ColorLut, SVGCursorDescriptor, SVGPoint, };
14
+ export type { Annotation, Annotations, FrameOfReferenceSpecificAnnotations, AnnotationState, ToolSpecificAnnotationTypes, PlanarBoundingBox, ToolProps, PublicToolProps, EventTypes, IPoints, IToolBinding, SetToolBindingsType, ToolOptionsType, InteractionTypes, IToolGroup, ToolHandle, AnnotationHandle, TextBoxHandle, Segmentation, SegmentationState, SegmentationRepresentationData, SegmentationRepresentationConfig, RepresentationConfig, ToolGroupSpecificRepresentationState, ToolGroupSpecificLabelmapRepresentation, ToolGroupSpecificRepresentation, Color, ColorLut, SVGCursorDescriptor, SVGPoint, };
@@ -0,0 +1,18 @@
1
+ import type { Types } from '@cornerstonejs/core';
2
+ export default function createLabelmapVolumeForViewport(input: {
3
+ viewportId: string;
4
+ renderingEngineId: string;
5
+ segmentationId?: string;
6
+ options?: {
7
+ volumeId?: string;
8
+ scalarData?: Float32Array | Uint8Array;
9
+ targetBuffer?: {
10
+ type: 'Float32Array' | 'Uint8Array';
11
+ };
12
+ metadata?: any;
13
+ dimensions?: Types.Point3;
14
+ spacing?: Types.Point3;
15
+ origin?: Types.Point3;
16
+ direction?: Float32Array;
17
+ };
18
+ }): Promise<string>;
@@ -1,12 +1,8 @@
1
1
  import { _cloneDeep } from 'lodash.clonedeep';
2
2
  import { getEnabledElementByIds, volumeLoader, VolumeViewport, utilities as csUtils, } from '@cornerstonejs/core';
3
- import { getToolGroup } from '../../store/ToolGroupManager';
4
- async function createNewSegmentationForToolGroup(toolGroupId, options) {
5
- const toolGroup = getToolGroup(toolGroupId);
6
- if (!toolGroup) {
7
- throw new Error(`ToolGroup with Id ${toolGroupId} not found`);
8
- }
9
- const { viewportId, renderingEngineId } = toolGroup.viewportsInfo[0];
3
+ export default async function createLabelmapVolumeForViewport(input) {
4
+ const { viewportId, renderingEngineId, options } = input;
5
+ let { segmentationId } = input;
10
6
  const enabledElement = getEnabledElementByIds(viewportId, renderingEngineId);
11
7
  if (!enabledElement) {
12
8
  throw new Error('element disabled');
@@ -16,7 +12,9 @@ async function createNewSegmentationForToolGroup(toolGroupId, options) {
16
12
  throw new Error('Segmentation not ready for stackViewport');
17
13
  }
18
14
  const { uid } = viewport.getDefaultActor();
19
- const segmentationId = `${uid}-based-segmentation-${options?.volumeId ?? csUtils.uuidv4().slice(0, 8)}`;
15
+ if (segmentationId === undefined) {
16
+ segmentationId = `${uid}-based-segmentation-${options?.volumeId ?? csUtils.uuidv4().slice(0, 8)}`;
17
+ }
20
18
  if (options) {
21
19
  const properties = _cloneDeep(options);
22
20
  await volumeLoader.createLocalVolume(properties, segmentationId);
@@ -29,5 +27,4 @@ async function createNewSegmentationForToolGroup(toolGroupId, options) {
29
27
  }
30
28
  return segmentationId;
31
29
  }
32
- export default createNewSegmentationForToolGroup;
33
- //# sourceMappingURL=createNewSegmentationForToolGroup.js.map
30
+ //# sourceMappingURL=createLabelmapVolumeForViewport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createLabelmapVolumeForViewport.js","sourceRoot":"","sources":["../../../../src/utilities/segmentation/createLabelmapVolumeForViewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,SAAS,IAAI,OAAO,GACrB,MAAM,qBAAqB,CAAA;AAc5B,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,+BAA+B,CAAC,KAgB7D;IACC,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,GAAG,KAAK,CAAA;IACxD,IAAI,EAAE,cAAc,EAAE,GAAG,KAAK,CAAA;IAC9B,MAAM,cAAc,GAAG,sBAAsB,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAA;IAE5E,IAAI,CAAC,cAAc,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;KACpC;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAA;IACnC,IAAI,CAAC,CAAC,QAAQ,YAAY,cAAc,CAAC,EAAE;QACzC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;KAC5D;IAED,MAAM,EAAE,GAAG,EAAE,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAA;IAE1C,IAAI,cAAc,KAAK,SAAS,EAAE;QAEhC,cAAc,GAAG,GAAG,GAAG,uBACrB,OAAO,EAAE,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAClD,EAAE,CAAA;KACH;IAED,IAAI,OAAO,EAAE;QAGX,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;QACtC,MAAM,YAAY,CAAC,iBAAiB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAA;KACjE;SAAM;QAEL,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAA;QACpD,MAAM,YAAY,CAAC,2BAA2B,CAAC,QAAQ,EAAE;YACvD,QAAQ,EAAE,cAAc;SACzB,CAAC,CAAA;KACH;IAED,OAAO,cAAc,CAAA;AACvB,CAAC"}
@@ -3,4 +3,5 @@ import thresholdVolumeByRange from './thresholdVolumeByRange';
3
3
  import createMergedLabelmapForIndex from './createMergedLabelmapForIndex';
4
4
  import isValidRepresentationConfig from './isValidRepresentationConfig';
5
5
  import getDefaultRepresentationConfig from './getDefaultRepresentationConfig';
6
- export { getBoundingBoxAroundShape, extend2DBoundingBoxInViewAxis, thresholdVolumeByRange, createMergedLabelmapForIndex, isValidRepresentationConfig, getDefaultRepresentationConfig, };
6
+ import createLabelmapVolumeForViewport from './createLabelmapVolumeForViewport';
7
+ export { getBoundingBoxAroundShape, extend2DBoundingBoxInViewAxis, thresholdVolumeByRange, createMergedLabelmapForIndex, isValidRepresentationConfig, getDefaultRepresentationConfig, createLabelmapVolumeForViewport, };
@@ -3,5 +3,6 @@ import thresholdVolumeByRange from './thresholdVolumeByRange';
3
3
  import createMergedLabelmapForIndex from './createMergedLabelmapForIndex';
4
4
  import isValidRepresentationConfig from './isValidRepresentationConfig';
5
5
  import getDefaultRepresentationConfig from './getDefaultRepresentationConfig';
6
- export { getBoundingBoxAroundShape, extend2DBoundingBoxInViewAxis, thresholdVolumeByRange, createMergedLabelmapForIndex, isValidRepresentationConfig, getDefaultRepresentationConfig, };
6
+ import createLabelmapVolumeForViewport from './createLabelmapVolumeForViewport';
7
+ export { getBoundingBoxAroundShape, extend2DBoundingBoxInViewAxis, thresholdVolumeByRange, createMergedLabelmapForIndex, isValidRepresentationConfig, getDefaultRepresentationConfig, createLabelmapVolumeForViewport, };
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/segmentation/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,sBAAsB,MAAM,0BAA0B,CAAA;AAC7D,OAAO,4BAA4B,MAAM,gCAAgC,CAAA;AACzE,OAAO,2BAA2B,MAAM,+BAA+B,CAAA;AACvE,OAAO,8BAA8B,MAAM,kCAAkC,CAAA;AAE7E,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAE7B,sBAAsB,EACtB,4BAA4B,EAC5B,2BAA2B,EAC3B,8BAA8B,GAC/B,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/segmentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,sBAAsB,MAAM,0BAA0B,CAAA;AAC7D,OAAO,4BAA4B,MAAM,gCAAgC,CAAA;AACzE,OAAO,2BAA2B,MAAM,+BAA+B,CAAA;AACvE,OAAO,8BAA8B,MAAM,kCAAkC,CAAA;AAC7E,OAAO,+BAA+B,MAAM,mCAAmC,CAAA;AAE/E,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,EAC5B,2BAA2B,EAC3B,8BAA8B,EAC9B,+BAA+B,GAChC,CAAA"}
@@ -14,8 +14,8 @@ export declare type AnnotationForThresholding = {
14
14
  handles: {
15
15
  points: Types.Point3[];
16
16
  };
17
- cachedStats: {
18
- projectionPoints: Types.Point3[][];
17
+ cachedStats?: {
18
+ projectionPoints?: Types.Point3[][];
19
19
  };
20
20
  };
21
21
  };
@@ -13,8 +13,8 @@ function thresholdVolumeByRange(annotations, referenceVolumes, segmentationRepre
13
13
  if (!segmentation) {
14
14
  throw new Error('No Segmentation Found');
15
15
  }
16
- const { type, representations } = segmentation;
17
- const { volumeId } = representations[type];
16
+ const { type, representationData } = segmentation;
17
+ const { volumeId } = representationData[type];
18
18
  const segmentationVolume = cache.getVolume(volumeId);
19
19
  const { scalarData, imageData: segmentationImageData } = segmentationVolume;
20
20
  const { lowerThreshold, higherThreshold, numSlicesToProject, overwrite } = options;
@@ -1 +1 @@
1
- {"version":3,"file":"thresholdVolumeByRange.js","sourceRoot":"","sources":["../../../../src/utilities/segmentation/thresholdVolumeByRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAG3C,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,+BAA+B,EAAE,MAAM,8DAA8D,CAAA;AAE9G,OAAO,wBAAwB,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,iBAAiB,MAAM,sDAAsD,CAAA;AAiCzF,SAAS,sBAAsB,CAC7B,WAAwC,EACxC,gBAAsC,EACtC,0BAA2D,EAC3D,OAA8B;IAE9B,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;KAC3E;IAED,MAAM,YAAY,GAAG,iBAAiB,CAAC,eAAe,CACpD,0BAA0B,CAAC,cAAc,CAC1C,CAAA;IACD,MAAM,EAAE,cAAc,EAAE,GAAG,0BAA0B,CAAA;IAErD,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,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AAC,wBAAwB,CAAC,SAAS,EAAE,KAAK,CAAiB,CACtE,CAAA;QACD,IAAI,SAAS,GAAG,yBAAyB,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAA;QAI1E,IAAI,kBAAkB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,gBAAgB,EAAE;YAC7D,SAAS,GAAG,uCAAuC,CACjD,SAAS,EACT,kBAAkB,CACnB,CAAA;SACF;QAED,MAAM,QAAQ,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;YACvC,MAAM,MAAM,GAAG,SAAS,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAA;YACrD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;YAC5B,IAAI,KAAK,IAAI,cAAc,IAAI,KAAK,IAAI,eAAe,EAAE;gBACvD,OAAM;aACP;YAED,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACvB,CAAC,CAAA;QAED,oBAAoB,CAAC,qBAAqB,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;IAC9E,CAAC,CAAC,CAAA;IAEF,+BAA+B,CAAC,cAAc,CAAC,CAAA;IAE/C,OAAO,kBAAkB,CAAA;AAC3B,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,SAAqD,EACrD,kBAA0B;IAE1B,MAAM,iBAAiB,GAAG,6BAA6B,CACrD,SAAS,EACT,kBAAkB,CACnB,CAAA;IACD,OAAO,iBAAiB,CAAA;AAC1B,CAAC;AAED,eAAe,sBAAsB,CAAA"}
1
+ {"version":3,"file":"thresholdVolumeByRange.js","sourceRoot":"","sources":["../../../../src/utilities/segmentation/thresholdVolumeByRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAG3C,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,iBAAiB,CAAA;AACxB,OAAO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