@cornerstonejs/tools 1.74.4 → 1.74.5

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 (34) hide show
  1. package/dist/cjs/tools/displayTools/Contour/contourDisplay.d.ts +2 -2
  2. package/dist/cjs/tools/displayTools/Contour/contourDisplay.js.map +1 -1
  3. package/dist/cjs/tools/displayTools/Contour/contourHandler/handleContourSegmentation.d.ts +4 -4
  4. package/dist/cjs/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js +2 -1
  5. package/dist/cjs/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js.map +1 -1
  6. package/dist/cjs/utilities/annotationHydration.d.ts +3 -2
  7. package/dist/cjs/utilities/annotationHydration.js +2 -1
  8. package/dist/cjs/utilities/annotationHydration.js.map +1 -1
  9. package/dist/cjs/utilities/index.d.ts +2 -2
  10. package/dist/cjs/utilities/index.js +2 -1
  11. package/dist/cjs/utilities/index.js.map +1 -1
  12. package/dist/esm/tools/displayTools/Contour/contourDisplay.js +1 -1
  13. package/dist/esm/tools/displayTools/Contour/contourDisplay.js.map +1 -1
  14. package/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js +2 -1
  15. package/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js.map +1 -1
  16. package/dist/esm/utilities/annotationHydration.js +1 -1
  17. package/dist/esm/utilities/annotationHydration.js.map +1 -1
  18. package/dist/esm/utilities/index.js +2 -2
  19. package/dist/esm/utilities/index.js.map +1 -1
  20. package/dist/types/tools/displayTools/Contour/contourDisplay.d.ts +2 -2
  21. package/dist/types/tools/displayTools/Contour/contourDisplay.d.ts.map +1 -1
  22. package/dist/types/tools/displayTools/Contour/contourHandler/handleContourSegmentation.d.ts +4 -4
  23. package/dist/types/tools/displayTools/Contour/contourHandler/handleContourSegmentation.d.ts.map +1 -1
  24. package/dist/types/utilities/annotationHydration.d.ts +3 -2
  25. package/dist/types/utilities/annotationHydration.d.ts.map +1 -1
  26. package/dist/types/utilities/index.d.ts +2 -2
  27. package/dist/types/utilities/index.d.ts.map +1 -1
  28. package/dist/umd/index.js +1 -1
  29. package/dist/umd/index.js.map +1 -1
  30. package/package.json +3 -3
  31. package/src/tools/displayTools/Contour/contourDisplay.ts +6 -2
  32. package/src/tools/displayTools/Contour/contourHandler/handleContourSegmentation.ts +10 -5
  33. package/src/utilities/annotationHydration.ts +1 -1
  34. package/src/utilities/index.ts +5 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "1.74.4",
3
+ "version": "1.74.5",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "main": "src/index.ts",
6
6
  "types": "dist/types/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
30
30
  },
31
31
  "dependencies": {
32
- "@cornerstonejs/core": "^1.74.4",
32
+ "@cornerstonejs/core": "^1.74.5",
33
33
  "@icr/polyseg-wasm": "0.4.0",
34
34
  "@types/offscreencanvas": "2019.7.3",
35
35
  "comlink": "^4.4.1",
@@ -59,5 +59,5 @@
59
59
  "type": "individual",
60
60
  "url": "https://ohif.org/donate"
61
61
  },
62
- "gitHead": "2671f86e3ff632928128f490ca34dee71074f5ee"
62
+ "gitHead": "f8792648a99e3c204beb04743e4fe4e615aac8fc"
63
63
  }
@@ -1,4 +1,8 @@
1
- import { getEnabledElementByIds, Types } from '@cornerstonejs/core';
1
+ import {
2
+ getEnabledElementByIds,
3
+ StackViewport,
4
+ Types,
5
+ } from '@cornerstonejs/core';
2
6
 
3
7
  import Representations from '../../../enums/SegmentationRepresentations';
4
8
  import * as SegmentationState from '../../../stateManagement/segmentation/segmentationState';
@@ -59,7 +63,7 @@ function removeSegmentationRepresentation(
59
63
  * @param toolGroupConfig - This is the configuration object for the tool group
60
64
  */
61
65
  async function render(
62
- viewport: Types.IVolumeViewport,
66
+ viewport: StackViewport | Types.IVolumeViewport,
63
67
  representationConfig: ToolGroupSpecificRepresentation,
64
68
  toolGroupConfig: SegmentationRepresentationConfig
65
69
  ): Promise<void> {
@@ -2,7 +2,8 @@
2
2
  /* eslint-disable @typescript-eslint/no-empty-function */
3
3
 
4
4
  import { addAnnotation } from '../../../../stateManagement';
5
- import { cache, Types, utilities } from '@cornerstonejs/core';
5
+ import { cache, Types, utilities, StackViewport } from '@cornerstonejs/core';
6
+ import { getClosestImageIdForStackViewport } from '../../../../utilities/annotationHydration';
6
7
 
7
8
  import {
8
9
  SegmentationRepresentationConfig,
@@ -15,7 +16,7 @@ import { addContourSegmentationAnnotation } from '../../../../utilities/contourS
15
16
  import { validateGeometry } from './utils';
16
17
 
17
18
  function handleContourSegmentation(
18
- viewport: Types.IVolumeViewport,
19
+ viewport: StackViewport | Types.IVolumeViewport,
19
20
  geometryIds: string[],
20
21
  annotationUIDsMap: Map<number, Set<string>>,
21
22
  contourRepresentation: ToolGroupSpecificContourRepresentation,
@@ -33,7 +34,7 @@ function handleContourSegmentation(
33
34
  }
34
35
 
35
36
  function updateContourSets(
36
- viewport: Types.IVolumeViewport,
37
+ viewport: Types.IVolumeViewport | StackViewport,
37
38
  geometryIds: string[],
38
39
  contourRepresentation: ToolGroupSpecificContourRepresentation,
39
40
  contourRepresentationConfig: SegmentationRepresentationConfig
@@ -112,7 +113,7 @@ function updateContourSets(
112
113
  }
113
114
 
114
115
  function addContourSetsToElement(
115
- viewport: Types.IVolumeViewport,
116
+ viewport: StackViewport | Types.IVolumeViewport,
116
117
  geometryIds: string[],
117
118
  contourRepresentation: ToolGroupSpecificContourRepresentation,
118
119
  contourRepresentationConfig: SegmentationRepresentationConfig
@@ -166,7 +167,11 @@ function addContourSetsToElement(
166
167
  isLocked: true,
167
168
  isVisible: true,
168
169
  metadata: {
169
- referencedImageId: viewport.getCurrentImageId(),
170
+ referencedImageId: getClosestImageIdForStackViewport(
171
+ viewport as StackViewport,
172
+ points[0],
173
+ viewport.getCamera().viewPlaneNormal
174
+ ),
170
175
  toolName: 'PlanarFreehandContourSegmentationTool',
171
176
  FrameOfReferenceUID: viewport.getFrameOfReferenceUID(),
172
177
  viewPlaneNormal: viewport.getCamera().viewPlaneNormal,
@@ -140,4 +140,4 @@ function calculateDistanceToImage(
140
140
 
141
141
  return Math.abs(dot);
142
142
  }
143
- export { annotationHydration };
143
+ export { annotationHydration, getClosestImageIdForStackViewport };
@@ -28,7 +28,10 @@ import { pointToString } from './pointToString';
28
28
  import annotationFrameRange from './annotationFrameRange';
29
29
  import pointInSurroundingSphereCallback from './pointInSurroundingSphereCallback';
30
30
  import getViewportForAnnotation from './getViewportForAnnotation';
31
- import { annotationHydration } from './annotationHydration';
31
+ import {
32
+ annotationHydration,
33
+ getClosestImageIdForStackViewport,
34
+ } from './annotationHydration';
32
35
  // name spaces
33
36
  import * as contours from './contours';
34
37
  import * as segmentation from './segmentation';
@@ -98,4 +101,5 @@ export {
98
101
  annotationFrameRange,
99
102
  contourSegmentation,
100
103
  annotationHydration,
104
+ getClosestImageIdForStackViewport,
101
105
  };