@cornerstonejs/tools 3.0.3 → 3.0.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.
@@ -1,6 +1,7 @@
1
1
  import type { Types } from '@cornerstonejs/core';
2
2
  import type { ThresholdInformation } from './utilities';
3
3
  export type ThresholdOptions = {
4
+ segmentationId: string;
4
5
  numSlicesToProject?: number;
5
6
  overwrite: boolean;
6
7
  overlapType?: number;
@@ -16,7 +16,7 @@ function rectangleROIThresholdVolumeByRange(annotationUIDs, segmentationVolume,
16
16
  boundsIJK = getBoundsIJKFromRectangleAnnotations(annotations, thresholdVolumeInformation[i].volume, options);
17
17
  }
18
18
  }
19
- const outputSegmentationVolume = thresholdVolumeByRange(segmentationVolume, thresholdVolumeInformation, { ...options, boundsIJK });
19
+ const outputSegmentationVolume = thresholdVolumeByRange(segmentationVolume, thresholdVolumeInformation, { ...options, boundsIJK, segmentationId: options.segmentationId });
20
20
  outputSegmentationVolume.modified();
21
21
  return outputSegmentationVolume;
22
22
  }
@@ -1,4 +1,4 @@
1
1
  import type { Types } from '@cornerstonejs/core';
2
2
  import type { ThresholdInformation } from './utilities';
3
- declare function thresholdSegmentationByRange(segmentationVolume: Types.IImageVolume, segmentationIndex: number, thresholdVolumeInformation: ThresholdInformation[], overlapType: number): Types.IImageVolume;
3
+ declare function thresholdSegmentationByRange(segmentationVolume: Types.IImageVolume, segmentationIndex: number, thresholdVolumeInformation: ThresholdInformation[], overlapType: number, segmentationId: string): Types.IImageVolume;
4
4
  export default thresholdSegmentationByRange;
@@ -1,6 +1,9 @@
1
1
  import { triggerSegmentationDataModified } from '../../stateManagement/segmentation/triggerSegmentationEvents';
2
2
  import { getVoxelOverlap, processVolumes } from './utilities';
3
- function thresholdSegmentationByRange(segmentationVolume, segmentationIndex, thresholdVolumeInformation, overlapType) {
3
+ function thresholdSegmentationByRange(segmentationVolume, segmentationIndex, thresholdVolumeInformation, overlapType, segmentationId) {
4
+ if (!segmentationId) {
5
+ throw new Error('Segmentation ID is required to be passed inside thresholdSegmentationByRange');
6
+ }
4
7
  const { baseVolumeIdx, volumeInfoList } = processVolumes(segmentationVolume, thresholdVolumeInformation);
5
8
  const { voxelManager } = volumeInfoList[baseVolumeIdx];
6
9
  const refVoxelManager = voxelManager;
@@ -15,7 +18,7 @@ function thresholdSegmentationByRange(segmentationVolume, segmentationIndex, thr
15
18
  _handleDifferentSizeVolume(segVoxelManager, refVoxelManager, segmentationIndex, volumeInfo, volumeInfoList, baseVolumeIdx, overlapType);
16
19
  }
17
20
  });
18
- triggerSegmentationDataModified(segmentationVolume.volumeId);
21
+ triggerSegmentationDataModified(segmentationId);
19
22
  return segmentationVolume;
20
23
  }
21
24
  function _handleDifferentSizeVolume(segVoxelManager, refVoxelManager, segmentationIndex, volumeInfo, volumeInfoList, baseVolumeIdx, overlapType) {
@@ -3,6 +3,7 @@ import type { BoundsIJK } from '../../types';
3
3
  import type { ThresholdInformation } from './utilities';
4
4
  export type ThresholdRangeOptions = {
5
5
  overwrite: boolean;
6
+ segmentationId: string;
6
7
  boundsIJK: BoundsIJK;
7
8
  overlapType?: number;
8
9
  segmentIndex?: number;
@@ -2,7 +2,10 @@ import { triggerSegmentationDataModified } from '../../stateManagement/segmentat
2
2
  import { getVoxelOverlap, processVolumes } from './utilities';
3
3
  function thresholdVolumeByRange(segmentationVolume, thresholdVolumeInformation, options) {
4
4
  const { imageData: segmentationImageData } = segmentationVolume;
5
- const { overwrite, boundsIJK } = options;
5
+ const { overwrite, boundsIJK, segmentationId } = options;
6
+ if (!segmentationId) {
7
+ throw new Error('Segmentation ID is required to be passed inside thresholdVolumeByRange as options');
8
+ }
6
9
  const overlapType = options?.overlapType || 0;
7
10
  const segVoxelManager = segmentationVolume.voxelManager;
8
11
  const scalarDataLength = segmentationVolume.voxelManager.getScalarDataLength();
@@ -73,7 +76,7 @@ function thresholdVolumeByRange(segmentationVolume, thresholdVolumeInformation,
73
76
  imageData: segmentationImageData,
74
77
  boundsIJK,
75
78
  });
76
- triggerSegmentationDataModified(segmentationVolume.volumeId);
79
+ triggerSegmentationDataModified(options.segmentationId);
77
80
  return segmentationVolume;
78
81
  }
79
82
  export default thresholdVolumeByRange;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "3.0.3",
3
+ "version": "3.0.5",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -103,7 +103,7 @@
103
103
  "canvas": "^2.11.2"
104
104
  },
105
105
  "peerDependencies": {
106
- "@cornerstonejs/core": "^3.0.3",
106
+ "@cornerstonejs/core": "^3.0.5",
107
107
  "@kitware/vtk.js": "32.9.0",
108
108
  "@types/d3-array": "^3.0.4",
109
109
  "@types/d3-interpolate": "^3.0.1",
@@ -122,5 +122,5 @@
122
122
  "type": "individual",
123
123
  "url": "https://ohif.org/donate"
124
124
  },
125
- "gitHead": "7f2909c1410e2a63ce7393fd5eb80afa3b40fc8e"
125
+ "gitHead": "0b67f91a41eb069e0ef212d4be7acdcb4c68c542"
126
126
  }