@cornerstonejs/tools 1.54.0 → 1.54.2

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.54.0",
3
+ "version": "1.54.2",
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.54.0",
32
+ "@cornerstonejs/core": "^1.54.2",
33
33
  "@icr/polyseg-wasm": "0.4.0",
34
34
  "comlink": "^4.4.1",
35
35
  "lodash.clonedeep": "4.5.0",
@@ -55,5 +55,5 @@
55
55
  "type": "individual",
56
56
  "url": "https://ohif.org/donate"
57
57
  },
58
- "gitHead": "71b0b6f0035decbe7101f09fb45f6b1ff9bd6eac"
58
+ "gitHead": "6e3d8ea3d2aa05751ca8dcba38716d65324cc5f4"
59
59
  }
@@ -5,7 +5,7 @@ import {
5
5
  addAnnotation,
6
6
  getAnnotations,
7
7
  } from '../stateManagement/annotation/annotationState';
8
- import { drawPolyline } from '../drawingSvg';
8
+ import { drawPath } from '../drawingSvg';
9
9
  import { getToolGroup } from '../store/ToolGroupManager';
10
10
  import triggerAnnotationRenderForViewportIds from '../utilities/triggerAnnotationRenderForViewportIds';
11
11
  import { PublicToolProps, ToolProps, SVGDrawingHelper } from '../types';
@@ -147,10 +147,11 @@ class SegmentationIntersectionTool extends AnnotationDisplayTool {
147
147
  fillColor: color,
148
148
  fillOpacity: this.configuration.opacity,
149
149
  closePath: true,
150
+ lineWidth: 2,
150
151
  };
151
152
 
152
153
  const polyLineUID = actorEntry.uid + '#' + polyLineIdx;
153
- drawPolyline(
154
+ drawPath(
154
155
  svgDrawingHelper,
155
156
  annotationUID,
156
157
  polyLineUID,
@@ -105,6 +105,9 @@ function addOrUpdateSurfaceToElement(
105
105
  const filteredData = clippingFilter.getOutputData();
106
106
  mapper.setInputData(filteredData);
107
107
 
108
+ // @ts-ignore
109
+ const viewportPlanes = viewport.getClippingPlanesForActor?.();
110
+
108
111
  const evt = {
109
112
  detail: {
110
113
  actorEntry: {
@@ -114,9 +117,7 @@ function addOrUpdateSurfaceToElement(
114
117
  clippingFilter,
115
118
  uid: actorUID,
116
119
  },
117
- // @ts-ignore
118
- vtkPlanes: viewport.getClippingPlanesForActor?.(),
119
- viewport,
120
+ vtkPlanes: viewportPlanes,
120
121
  },
121
122
  };
122
123
 
@@ -147,6 +148,7 @@ function addOrUpdateSurfaceToElement(
147
148
  });
148
149
 
149
150
  viewport.resetCamera();
151
+ viewport.render();
150
152
 
151
153
  setTimeout(() => {
152
154
  viewport.getRenderer().resetCameraClippingRange();
@@ -158,7 +160,7 @@ function addOrUpdateSurfaceToElement(
158
160
  */
159
161
  function updateSurfacePlanes(evt) {
160
162
  const { actorEntry, vtkPlanes, viewport } = evt.detail;
161
- if (!actorEntry?.clippingFilter) {
163
+ if (!actorEntry?.clippingFilter || vtkPlanes.length === 0) {
162
164
  return;
163
165
  }
164
166
  const sliceIndex = viewport.getSliceIndex();
@@ -5,11 +5,11 @@ import {
5
5
  getEnabledElementByIds,
6
6
  Types,
7
7
  Enums,
8
- VolumeViewport,
9
8
  getWebWorkerManager,
10
9
  eventTarget,
11
10
  triggerEvent,
12
11
  utilities,
12
+ VolumeViewport3D,
13
13
  } from '@cornerstonejs/core';
14
14
 
15
15
  import * as SegmentationState from '../../../stateManagement/segmentation/segmentationState';
@@ -166,7 +166,7 @@ async function render(
166
166
  surfaces.push(surface);
167
167
  });
168
168
 
169
- if (viewport instanceof VolumeViewport) {
169
+ if (!(viewport instanceof VolumeViewport3D)) {
170
170
  // const { viewPlaneNormal } = viewport.getCamera();
171
171
  // currentViewportNormal.set(surface.id, structuredClone(viewPlaneNormal));
172
172
  // if the viewport is not 3D means we should calculate
@@ -208,7 +208,7 @@ function _removeSurfaceFromToolGroupViewports(
208
208
 
209
209
  async function generateAndCacheClippedSurfaces(
210
210
  surfaces: Types.ISurface[],
211
- viewport: Types.IVolumeViewport,
211
+ viewport: Types.IVolumeViewport | Types.IStackViewport,
212
212
  segmentationRepresentationUID: string
213
213
  ) {
214
214
  registerDisplayToolsWorker();
@@ -220,6 +220,13 @@ async function generateAndCacheClippedSurfaces(
220
220
  // @ts-ignore
221
221
  const planesInfo = viewport.getSlicesClippingPlanes?.();
222
222
 
223
+ if (!planesInfo) {
224
+ // this means it is probably the stack viewport not being ready
225
+ // in terms of planes which we should wait for the first render to
226
+ // get the planes
227
+ return;
228
+ }
229
+
223
230
  // @ts-ignore
224
231
  const currentSliceIndex = viewport.getSliceIndex();
225
232