@cornerstonejs/tools 1.58.2 → 1.58.4

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 (29) hide show
  1. package/dist/cjs/utilities/contours/generateContourSetsFromLabelmap.js +1 -8
  2. package/dist/cjs/utilities/contours/generateContourSetsFromLabelmap.js.map +1 -1
  3. package/dist/cjs/utilities/contours/interpolation/selectHandles.js +1 -1
  4. package/dist/cjs/utilities/contours/interpolation/selectHandles.js.map +1 -1
  5. package/dist/cjs/utilities/segmentation/createBidirectionalToolData.d.ts +1 -1
  6. package/dist/cjs/utilities/segmentation/createBidirectionalToolData.js +2 -9
  7. package/dist/cjs/utilities/segmentation/createBidirectionalToolData.js.map +1 -1
  8. package/dist/cjs/utilities/segmentation/segmentContourAction.js +2 -3
  9. package/dist/cjs/utilities/segmentation/segmentContourAction.js.map +1 -1
  10. package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js +1 -8
  11. package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js.map +1 -1
  12. package/dist/esm/utilities/contours/interpolation/selectHandles.js +1 -1
  13. package/dist/esm/utilities/contours/interpolation/selectHandles.js.map +1 -1
  14. package/dist/esm/utilities/segmentation/createBidirectionalToolData.js +2 -6
  15. package/dist/esm/utilities/segmentation/createBidirectionalToolData.js.map +1 -1
  16. package/dist/esm/utilities/segmentation/segmentContourAction.js +2 -3
  17. package/dist/esm/utilities/segmentation/segmentContourAction.js.map +1 -1
  18. package/dist/types/utilities/contours/generateContourSetsFromLabelmap.d.ts.map +1 -1
  19. package/dist/types/utilities/contours/interpolation/selectHandles.d.ts.map +1 -1
  20. package/dist/types/utilities/segmentation/createBidirectionalToolData.d.ts +1 -1
  21. package/dist/types/utilities/segmentation/createBidirectionalToolData.d.ts.map +1 -1
  22. package/dist/types/utilities/segmentation/segmentContourAction.d.ts.map +1 -1
  23. package/dist/umd/index.js +1 -1
  24. package/dist/umd/index.js.map +1 -1
  25. package/package.json +3 -3
  26. package/src/utilities/contours/generateContourSetsFromLabelmap.ts +1 -10
  27. package/src/utilities/contours/interpolation/selectHandles.ts +1 -2
  28. package/src/utilities/segmentation/createBidirectionalToolData.ts +5 -13
  29. package/src/utilities/segmentation/segmentContourAction.ts +2 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "1.58.2",
3
+ "version": "1.58.4",
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.58.2",
32
+ "@cornerstonejs/core": "^1.58.4",
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": "808abe92daab401511e2fbad6328281195a8e297"
62
+ "gitHead": "27788d9a480cf3dff59865f721cde0d158439734"
63
63
  }
@@ -22,13 +22,6 @@ function generateContourSetsFromLabelmap({ segmentations }) {
22
22
 
23
23
  const numSlices = vol.dimensions[2];
24
24
 
25
- // Get image volume segmentation references
26
- const imageVol = cornerstoneCache.getVolume(vol.referencedVolumeId);
27
- if (!imageVol) {
28
- console.warn(`No volume found for ${vol.referencedVolumeId}`);
29
- return;
30
- }
31
-
32
25
  // NOTE: Workaround for marching squares not finding closed contours at
33
26
  // boundary of image volume, clear pixels along x-y border of volume
34
27
  const segData = vol.imageData.getPointData().getScalars().getData();
@@ -47,7 +40,7 @@ function generateContourSetsFromLabelmap({ segmentations }) {
47
40
  //
48
41
  const ContourSets = [];
49
42
 
50
- const { FrameOfReferenceUID } = imageVol.metadata;
43
+ const { FrameOfReferenceUID } = vol.metadata;
51
44
  // Iterate through all segments in current segmentation set
52
45
  const numSegments = segments.length;
53
46
  for (let segIndex = 0; segIndex < numSegments; segIndex++) {
@@ -112,7 +105,6 @@ function generateContourSetsFromLabelmap({ segmentations }) {
112
105
  const contours = findContoursFromReducedSet(reducedSet.lines);
113
106
 
114
107
  sliceContours.push({
115
- referencedImageId: imageVol.imageIds[sliceIndex],
116
108
  contours,
117
109
  polyData: reducedSet,
118
110
  FrameNumber: sliceIndex + 1,
@@ -127,7 +119,6 @@ function generateContourSetsFromLabelmap({ segmentations }) {
127
119
  }
128
120
 
129
121
  const metadata = {
130
- referencedImageId: imageVol.imageIds[0], // just use 0 for overall
131
122
  FrameOfReferenceUID,
132
123
  };
133
124
 
@@ -137,8 +137,7 @@ function findMinimumRegions(dotValues, handleCount) {
137
137
  const { length } = dotValues;
138
138
  // Fallback for very uniform ojects.
139
139
  if (deviation < 0.01 || length < handleCount * 3) {
140
- // TODO - create handleCount evenly spaced handles
141
- return [0, Math.floor(length / 3), Math.floor((length * 2) / 3)];
140
+ return [];
142
141
  }
143
142
 
144
143
  const inflection = [];
@@ -10,7 +10,7 @@ export type BidirectionalData = {
10
10
  label?: string;
11
11
  color?: string | number[];
12
12
  referencedImageId: string;
13
- FrameOfReferenceUID: string;
13
+ sliceIndex: number;
14
14
  };
15
15
 
16
16
  /**
@@ -21,27 +21,19 @@ export default function createBidirectionalToolData(
21
21
  bidirectionalData: BidirectionalData,
22
22
  viewport
23
23
  ): Annotation {
24
- const {
25
- majorAxis,
26
- minorAxis,
27
- label = '',
28
- FrameOfReferenceUID,
29
- referencedImageId,
30
- } = bidirectionalData;
24
+ const { majorAxis, minorAxis, label = '', sliceIndex } = bidirectionalData;
31
25
  const [major0, major1] = majorAxis;
32
26
  const [minor0, minor1] = minorAxis;
33
27
 
34
- const { viewUp, viewPlaneNormal } = viewport.getCamera();
35
28
  const points = [major0, major1, minor0, minor1];
36
29
  const bidirectionalToolData = {
37
30
  highlighted: true,
38
31
  invalidated: true,
39
32
  metadata: {
40
33
  toolName: 'Bidirectional',
41
- viewPlaneNormal,
42
- viewUp,
43
- FrameOfReferenceUID,
44
- referencedImageId,
34
+ // Get a view reference for the slice this applies to, not the currently
35
+ // displayed slice. This will fill in the remaining data for that slice
36
+ ...viewport.getViewReference({ sliceIndex }),
45
37
  },
46
38
  data: {
47
39
  handles: {
@@ -125,15 +125,12 @@ export default function segmentContourAction(
125
125
  });
126
126
 
127
127
  if (newBidirectional) {
128
- const { referencedImageId } = newBidirectional;
128
+ const { sliceIndex } = newBidirectional;
129
129
  const imageIds = enabledElement.viewport.getImageIds();
130
- const imageIndex = imageIds.findIndex(
131
- (imageId) => imageId === referencedImageId
132
- );
133
130
 
134
131
  // TODO - figure out why this is reversed
135
132
  jumpToSlice(element, {
136
- imageIndex: imageIds.length - 1 - imageIndex,
133
+ imageIndex: imageIds.length - 1 - sliceIndex,
137
134
  });
138
135
  enabledElement.viewport.render();
139
136
  } else {