@cornerstonejs/core 5.6.1 → 5.6.3

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.
@@ -11,11 +11,12 @@ import { applyPlanarICameraToActor, applyPlanarICameraToRenderer, } from './plan
11
11
  import { getPlanarRenderPathActiveSourceICamera, resolvePlanarRenderPathProjection, } from './planarRenderPathProjection.js';
12
12
  import { applyPlanarVolumePresentation } from './planarVolumePresentation.js';
13
13
  const SLICE_OVERLAY_DEPTH_EPSILON = 1e-4;
14
+ const PROJECTING_OVERLAY_RENDER_DELAY_MS = 240;
14
15
  export class VtkVolumeSliceRenderPath {
15
16
  async addData(ctx, data, options) {
16
17
  const payload = data;
17
18
  const imageVolume = payload.imageVolume;
18
- const shouldInvalidateFullTextureOnVolumeModified = options.role === 'overlay' && payload.reference?.kind === 'segmentation';
19
+ const isSegmentationOverlay = options.role === 'overlay' && payload.reference?.kind === 'segmentation';
19
20
  if (!imageVolume) {
20
21
  throw new Error('[PlanarViewport] Volume rendering requires a prepared image volume');
21
22
  }
@@ -42,15 +43,33 @@ export class VtkVolumeSliceRenderPath {
42
43
  ? { lower: defaultRange[0], upper: defaultRange[1] }
43
44
  : undefined,
44
45
  dataPresentation: undefined,
45
- removeStreamingSubscriptions: subscribeToVolumeEvents(payload.volumeId, (eventType) => {
46
- if (eventType === Events.IMAGE_VOLUME_MODIFIED) {
47
- if (shouldInvalidateFullTextureOnVolumeModified) {
48
- imageVolume.vtkOpenGLTexture?.modified?.();
49
- }
50
- mapper.modified();
51
- }
46
+ isSegmentationOverlay,
47
+ };
48
+ let deferredProjectionRenderTimer = null;
49
+ const removeVolumeSubscriptions = subscribeToVolumeEvents(payload.volumeId, (eventType) => {
50
+ if (eventType === Events.IMAGE_VOLUME_MODIFIED) {
51
+ mapper.modified();
52
+ }
53
+ const isProjectingOverlay = rendering.isSegmentationOverlay &&
54
+ (rendering.dataPresentation?.slabThickness ?? 0) > 0;
55
+ if (!isProjectingOverlay) {
56
+ ctx.display.requestRender();
57
+ return;
58
+ }
59
+ if (deferredProjectionRenderTimer !== null) {
60
+ clearTimeout(deferredProjectionRenderTimer);
61
+ }
62
+ deferredProjectionRenderTimer = setTimeout(() => {
63
+ deferredProjectionRenderTimer = null;
52
64
  ctx.display.requestRender();
53
- }),
65
+ }, PROJECTING_OVERLAY_RENDER_DELAY_MS);
66
+ });
67
+ rendering.removeStreamingSubscriptions = () => {
68
+ if (deferredProjectionRenderTimer !== null) {
69
+ clearTimeout(deferredProjectionRenderTimer);
70
+ deferredProjectionRenderTimer = null;
71
+ }
72
+ removeVolumeSubscriptions();
54
73
  };
55
74
  imageVolume.load(() => {
56
75
  ctx.display.requestRender();
@@ -101,7 +120,9 @@ export class VtkVolumeSliceRenderPath {
101
120
  rendering.dataPresentation = props;
102
121
  applyPlanarVolumePresentation({
103
122
  actor: rendering.actor,
104
- defaultVOIRange: rendering.defaultVOIRange,
123
+ defaultVOIRange: rendering.isSegmentationOverlay
124
+ ? undefined
125
+ : rendering.defaultVOIRange,
105
126
  mapper: rendering.mapper,
106
127
  props: rendering.dataPresentation,
107
128
  });
@@ -81,6 +81,7 @@ export type PlanarVolumeSliceRendering = MountedRendering<{
81
81
  maxImageIdIndex: number;
82
82
  defaultVOIRange?: VOIRange;
83
83
  dataPresentation?: PlanarDataPresentation;
84
+ isSegmentationOverlay?: boolean;
84
85
  removeStreamingSubscriptions?: () => void;
85
86
  }>;
86
87
  export type PlanarRendering = PlanarImageMapperRendering | PlanarCpuImageRendering | PlanarCpuVolumeRendering | PlanarVolumeSliceRendering;
@@ -817,6 +817,9 @@ export default class VoxelManager {
817
817
  voxelManager.getCurrentDimensionGroupScalarData = () => {
818
818
  return voxelGroups[activeDimensionGroup].getCompleteScalarDataArray();
819
819
  };
820
+ voxelManager.getCompleteScalarDataArray = () => {
821
+ return voxelGroups[activeDimensionGroup].getCompleteScalarDataArray();
822
+ };
820
823
  voxelManager.getCurrentTimePoint = () => {
821
824
  console.warn('Warning: getCurrentTimePoint is deprecated. Please use getCurrentDimensionGroupNumber instead. Note that timePoint is zero-based while dimensionGroupNumber starts at 1.');
822
825
  return activeDimensionGroup;
@@ -1 +1 @@
1
- export declare const version = "5.6.1";
1
+ export declare const version = "5.6.3";
@@ -1 +1 @@
1
- export const version = '5.6.1';
1
+ export const version = '5.6.3';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "5.6.1",
3
+ "version": "5.6.3",
4
4
  "description": "Cornerstone3D Core",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -85,18 +85,18 @@
85
85
  "prepublishOnly": "pnpm run build"
86
86
  },
87
87
  "dependencies": {
88
- "@cornerstonejs/utils": "5.6.1",
88
+ "@cornerstonejs/utils": "5.6.3",
89
89
  "@kitware/vtk.js": "36.4.1",
90
90
  "comlink": "4.4.2",
91
91
  "gl-matrix": "3.4.3",
92
92
  "loglevel": "1.9.2"
93
93
  },
94
94
  "devDependencies": {
95
- "@cornerstonejs/metadata": "5.6.1"
95
+ "@cornerstonejs/metadata": "5.6.3"
96
96
  },
97
97
  "peerDependencies": {
98
- "@cornerstonejs/metadata": "5.6.1",
99
- "@cornerstonejs/utils": "5.6.1"
98
+ "@cornerstonejs/metadata": "5.6.3",
99
+ "@cornerstonejs/utils": "5.6.3"
100
100
  },
101
101
  "contributors": [
102
102
  {
@@ -109,5 +109,5 @@
109
109
  "type": "individual",
110
110
  "url": "https://ohif.org/donate"
111
111
  },
112
- "gitHead": "e0d2d3327a7186d083b8f75dfdca2182175f3b5a"
112
+ "gitHead": "c547b4a1eae7ffc47147ab9a6db5aaa0bf5a785f"
113
113
  }