@cornerstonejs/tools 1.47.5 → 1.48.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "1.47.5",
3
+ "version": "1.48.1",
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.47.5",
32
+ "@cornerstonejs/core": "^1.48.1",
33
33
  "comlink": "^4.4.1",
34
34
  "lodash.clonedeep": "4.5.0",
35
35
  "lodash.get": "^4.4.2"
@@ -53,5 +53,5 @@
53
53
  "type": "individual",
54
54
  "url": "https://ohif.org/donate"
55
55
  },
56
- "gitHead": "ca6a1674238c19acca3a96f604a1a15cf929f13f"
56
+ "gitHead": "b48d4bc61f007018f5695c209a858d3ebd2f7ce0"
57
57
  }
@@ -4,21 +4,41 @@ import { getSegmentationRepresentations } from '../../../stateManagement/segment
4
4
  import { ToolGroupSpecificRepresentation } from '../../../types/SegmentationStateTypes';
5
5
  import { triggerSegmentationRepresentationModified } from '../triggerSegmentationEvents';
6
6
  import SegmentationRepresentations from '../../../enums/SegmentationRepresentations';
7
+ import { isVolumeSegmentation } from '../../../tools/segmentation/strategies/utils/stackVolumeCheck';
7
8
 
8
9
  function getUniqueSegmentIndices(segmentationId) {
9
10
  const segmentation = SegmentationState.getSegmentation(segmentationId);
10
11
 
11
12
  if (segmentation.type === SegmentationRepresentations.Labelmap) {
12
- const volume = cache.getVolume(segmentationId);
13
- const scalarData = volume.getScalarData();
13
+ const labelmapData =
14
+ segmentation.representationData[SegmentationRepresentations.Labelmap];
14
15
 
15
16
  const keySet = {};
16
- for (let i = 0; i < scalarData.length; i++) {
17
- const segmentIndex = scalarData[i];
18
- if (segmentIndex !== 0 && !keySet[segmentIndex]) {
19
- keySet[segmentIndex] = true;
17
+
18
+ if (isVolumeSegmentation(labelmapData)) {
19
+ const volume = cache.getVolume(segmentationId);
20
+ const scalarData = volume.getScalarData();
21
+
22
+ for (let i = 0; i < scalarData.length; i++) {
23
+ const segmentIndex = scalarData[i];
24
+ if (segmentIndex !== 0 && !keySet[segmentIndex]) {
25
+ keySet[segmentIndex] = true;
26
+ }
20
27
  }
28
+ } else {
29
+ labelmapData.imageIdReferenceMap.forEach((segmentationImageId) => {
30
+ const image = cache.getImage(segmentationImageId);
31
+ const scalarData = image.getPixelData();
32
+
33
+ for (let i = 0; i < scalarData.length; i++) {
34
+ const segmentIndex = scalarData[i];
35
+ if (segmentIndex !== 0 && !keySet[segmentIndex]) {
36
+ keySet[segmentIndex] = true;
37
+ }
38
+ }
39
+ });
21
40
  }
41
+
22
42
  return Object.keys(keySet).map((it) => parseInt(it, 10));
23
43
  } else if (segmentation.type === SegmentationRepresentations.Contour) {
24
44
  const annotationUIDsMap =