@cornerstonejs/tools 4.15.17 → 4.15.19

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,4 +1,4 @@
1
- import { utilities as csUtils } from '@cornerstonejs/core';
1
+ import { utilities as csUtils, getEnabledElement } from '@cornerstonejs/core';
2
2
  import { triggerAnnotationAddedForElement, triggerAnnotationAddedForFOR, triggerAnnotationRemoved, } from './helpers/state';
3
3
  let defaultManager;
4
4
  function getAnnotationManager() {
@@ -56,7 +56,8 @@ function addAnnotation(annotation, annotationGroupSelector) {
56
56
  annotation.annotationUID = csUtils.uuidv4();
57
57
  }
58
58
  const manager = getAnnotationManager();
59
- if (annotationGroupSelector instanceof HTMLDivElement) {
59
+ if (annotationGroupSelector instanceof HTMLDivElement &&
60
+ getEnabledElement(annotationGroupSelector)) {
60
61
  const groupKey = manager.getGroupKey(annotationGroupSelector);
61
62
  manager.addAnnotation(annotation, groupKey);
62
63
  triggerAnnotationAddedForElement(annotation, annotationGroupSelector);
@@ -33,7 +33,12 @@ async function render(viewport, contourRepresentation) {
33
33
  getPolySeg()?.canComputeRequestedRepresentation(segmentationId, Representations.Contour) &&
34
34
  !polySegConversionInProgressForViewportId.get(viewport.id)) {
35
35
  polySegConversionInProgressForViewportId.set(viewport.id, true);
36
- contourData = await computeAndAddRepresentation(segmentationId, Representations.Contour, () => polySeg.computeContourData(segmentationId, { viewport }));
36
+ try {
37
+ contourData = await computeAndAddRepresentation(segmentationId, Representations.Contour, () => polySeg.computeContourData(segmentationId, { viewport }));
38
+ }
39
+ catch (error) {
40
+ console.warn('Unable to compute contour data for segmentationId', segmentationId, error);
41
+ }
37
42
  polySegConversionInProgressForViewportId.set(viewport.id, false);
38
43
  }
39
44
  else if (!contourData && !getPolySeg()) {
@@ -113,6 +113,9 @@ export default class LabelmapBaseTool extends BaseTool {
113
113
  return;
114
114
  }
115
115
  const { volumeId } = representationData[SegmentationRepresentations.Labelmap];
116
+ if (!volumeId) {
117
+ return;
118
+ }
116
119
  const actors = viewport.getActors();
117
120
  const isStackViewport = viewport instanceof StackViewport;
118
121
  if (isStackViewport) {
@@ -126,7 +129,9 @@ export default class LabelmapBaseTool extends BaseTool {
126
129
  eventTarget.dispatchEvent(event);
127
130
  return null;
128
131
  }
129
- const volumes = actors.map((actorEntry) => cache.getVolume(actorEntry.referencedId));
132
+ const volumes = actors
133
+ .filter((actorEntry) => actorEntry.referencedId)
134
+ .map((actorEntry) => cache.getVolume(actorEntry.referencedId));
130
135
  const segmentationVolume = cache.getVolume(volumeId);
131
136
  const referencedVolumeIdToThreshold = volumes.find((volume) => csUtils.isEqual(volume.dimensions, segmentationVolume.dimensions))?.volumeId || volumes[0]?.volumeId;
132
137
  return {
@@ -1 +1 @@
1
- export declare const version = "4.15.17";
1
+ export declare const version = "4.15.19";
@@ -1 +1 @@
1
- export const version = '4.15.17';
1
+ export const version = '4.15.19';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "4.15.17",
3
+ "version": "4.15.19",
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.17",
111
+ "@cornerstonejs/core": "4.15.19",
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": "3c522ab3ce79d2564a7dcdfd995a67ca7d0561e7"
130
+ "gitHead": "dd0f433bee1e2b63177b21a52cb1b2cc39f0a88f"
131
131
  }