@cornerstonejs/tools 4.15.5 → 4.15.7

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.
@@ -42,6 +42,9 @@ function setActiveSegmentIndex(segmentationId, segmentIndex) {
42
42
  });
43
43
  viewportIds.forEach((viewportId) => {
44
44
  const toolGroup = getToolGroupForViewport(viewportId);
45
+ if (!toolGroup) {
46
+ return;
47
+ }
45
48
  invalidateBrushCursor(toolGroup.id);
46
49
  });
47
50
  }
@@ -92,10 +92,12 @@ class ContourSegmentationBaseTool extends ContourBaseTool {
92
92
  const { segmentationId } = (annotation).data.segmentation;
93
93
  triggerSegmentationDataModified(segmentationId);
94
94
  const viewportIds = getViewportIdsWithSegmentation(segmentationId);
95
- const toolGroupIds = viewportIds.map((viewportId) => {
95
+ const toolGroupIds = viewportIds
96
+ .map((viewportId) => {
96
97
  const toolGroup = getToolGroupForViewport(viewportId);
97
- return toolGroup.id;
98
- });
98
+ return toolGroup?.id;
99
+ })
100
+ .filter((toolGroupId) => toolGroupId != null);
99
101
  triggerAnnotationRenderForToolGroupIds(toolGroupIds);
100
102
  }
101
103
  return renderResult;
@@ -109,6 +109,9 @@ export default class LabelmapBaseTool extends BaseTool {
109
109
  }
110
110
  getEditData({ viewport, representationData, segmentsLocked, segmentationId, }) {
111
111
  if (viewport instanceof BaseVolumeViewport) {
112
+ if (!representationData[SegmentationRepresentations.Labelmap]) {
113
+ return;
114
+ }
112
115
  const { volumeId } = representationData[SegmentationRepresentations.Labelmap];
113
116
  const actors = viewport.getActors();
114
117
  const isStackViewport = viewport instanceof StackViewport;
@@ -54,16 +54,16 @@ export default class BrushStrategy {
54
54
  return initializedData;
55
55
  };
56
56
  this.configurationName = name;
57
- const cursorGeometryInitializer = initializers.find(init => init.hasOwnProperty(StrategyCallbacks.CalculateCursorGeometry));
58
- const renderCursorInitializer = initializers.find(init => init.hasOwnProperty(StrategyCallbacks.RenderCursor));
57
+ const cursorGeometryInitializer = initializers.find((init) => init.hasOwnProperty(StrategyCallbacks.CalculateCursorGeometry));
58
+ const renderCursorInitializer = initializers.find((init) => init.hasOwnProperty(StrategyCallbacks.RenderCursor));
59
59
  if (!cursorGeometryInitializer) {
60
60
  initializers.push({
61
- [StrategyCallbacks.CalculateCursorGeometry]: compositions.circularCursor.calculateCursorGeometry
61
+ [StrategyCallbacks.CalculateCursorGeometry]: compositions.circularCursor.calculateCursorGeometry,
62
62
  });
63
63
  }
64
64
  if (!renderCursorInitializer) {
65
65
  initializers.push({
66
- [StrategyCallbacks.RenderCursor]: compositions.circularCursor.renderCursor
66
+ [StrategyCallbacks.RenderCursor]: compositions.circularCursor.renderCursor,
67
67
  });
68
68
  }
69
69
  this.compositions = initializers;
@@ -89,7 +89,10 @@ export default class BrushStrategy {
89
89
  initialize(enabledElement, operationData, operationName) {
90
90
  const { viewport } = enabledElement;
91
91
  const data = getStrategyData({ operationData, viewport, strategy: this });
92
- if (!data) {
92
+ if (!data ||
93
+ !data.imageVoxelManager ||
94
+ !data.segmentationVoxelManager ||
95
+ !data.segmentationImageData) {
93
96
  return null;
94
97
  }
95
98
  const { imageVoxelManager, segmentationVoxelManager, segmentationImageData, } = data;
@@ -2,6 +2,9 @@ import { cache, volumeLoader, utilities, ImageVolume, } from '@cornerstonejs/cor
2
2
  import { getSegmentation } from '../../stateManagement/segmentation/getSegmentation';
3
3
  function getOrCreateSegmentationVolume(segmentationId) {
4
4
  const { representationData } = getSegmentation(segmentationId);
5
+ if (!representationData.Labelmap) {
6
+ return;
7
+ }
5
8
  let { volumeId } = representationData.Labelmap;
6
9
  let segVolume;
7
10
  if (volumeId) {
@@ -1 +1 @@
1
- export declare const version = "4.15.5";
1
+ export declare const version = "4.15.7";
@@ -1 +1 @@
1
- export const version = '4.15.5';
1
+ export const version = '4.15.7';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "4.15.5",
3
+ "version": "4.15.7",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -108,7 +108,7 @@
108
108
  "canvas": "3.2.0"
109
109
  },
110
110
  "peerDependencies": {
111
- "@cornerstonejs/core": "4.15.5",
111
+ "@cornerstonejs/core": "4.15.7",
112
112
  "@kitware/vtk.js": "34.15.1",
113
113
  "@types/d3-array": "3.2.1",
114
114
  "@types/d3-interpolate": "3.0.4",
@@ -127,5 +127,5 @@
127
127
  "type": "individual",
128
128
  "url": "https://ohif.org/donate"
129
129
  },
130
- "gitHead": "744949c4e30429f83c53b130766116d9a29de027"
130
+ "gitHead": "9a0597c6cd50f2421482fc20721c900e7fe17a5e"
131
131
  }