@cornerstonejs/core 5.6.2 → 5.6.4
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/dist/esm/RenderingEngine/GenericViewport/Planar/VtkVolumeSliceRenderPath.js +31 -10
- package/dist/esm/RenderingEngine/GenericViewport/Planar/planarRuntimeTypes.d.ts +1 -0
- package/dist/esm/RenderingEngine/vtkClasses/canUseFloatOpacityTexture.d.ts +1 -0
- package/dist/esm/RenderingEngine/vtkClasses/canUseFloatOpacityTexture.js +6 -0
- package/dist/esm/RenderingEngine/vtkClasses/vtkStreamingOpenGLVolumeMapper.js +2 -3
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +6 -6
|
@@ -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
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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.
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function canUseFloatOpacityTexture(openGLRenderWindow: any, context: any): boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export default function canUseFloatOpacityTexture(openGLRenderWindow, context) {
|
|
2
|
+
const supportsFloatTextures = openGLRenderWindow.getWebgl2() ||
|
|
3
|
+
Boolean(context.getExtension('OES_texture_float'));
|
|
4
|
+
const supportsFloatLinearFiltering = Boolean(context.getExtension('OES_texture_float_linear'));
|
|
5
|
+
return supportsFloatTextures && supportsFloatLinearFiltering;
|
|
6
|
+
}
|
|
@@ -8,6 +8,7 @@ import { getTransferFunctionsHash } from '@kitware/vtk.js/Rendering/OpenGL/Rende
|
|
|
8
8
|
import { Representation } from '@kitware/vtk.js/Rendering/Core/Property/Constants.js';
|
|
9
9
|
import { BlendMode } from '@kitware/vtk.js/Rendering/Core/VolumeMapper/Constants.js';
|
|
10
10
|
import { getCanUseNorm16Texture } from '../../init.js';
|
|
11
|
+
import canUseFloatOpacityTexture from './canUseFloatOpacityTexture.js';
|
|
11
12
|
function vtkStreamingOpenGLVolumeMapper(publicAPI, model) {
|
|
12
13
|
model.classHierarchy.push('vtkStreamingOpenGLVolumeMapper');
|
|
13
14
|
const graphicsResourceReferenceCount = new Map();
|
|
@@ -149,9 +150,7 @@ function vtkStreamingOpenGLVolumeMapper(publicAPI, model) {
|
|
|
149
150
|
newOpacityTexture.resetFormatAndType();
|
|
150
151
|
newOpacityTexture.setMinificationFilter(Filter.LINEAR);
|
|
151
152
|
newOpacityTexture.setMagnificationFilter(Filter.LINEAR);
|
|
152
|
-
if (model._openGLRenderWindow.
|
|
153
|
-
(model.context.getExtension('OES_texture_float') &&
|
|
154
|
-
model.context.getExtension('OES_texture_float_linear'))) {
|
|
153
|
+
if (canUseFloatOpacityTexture(model._openGLRenderWindow, model.context)) {
|
|
155
154
|
newOpacityTexture.create2DFromRaw({
|
|
156
155
|
width: oWidth,
|
|
157
156
|
height: 2 * numIComps,
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.6.
|
|
1
|
+
export declare const version = "5.6.4";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.6.
|
|
1
|
+
export const version = '5.6.4';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.4",
|
|
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.
|
|
88
|
+
"@cornerstonejs/utils": "5.6.4",
|
|
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.
|
|
95
|
+
"@cornerstonejs/metadata": "5.6.4"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
|
-
"@cornerstonejs/metadata": "5.6.
|
|
99
|
-
"@cornerstonejs/utils": "5.6.
|
|
98
|
+
"@cornerstonejs/metadata": "5.6.4",
|
|
99
|
+
"@cornerstonejs/utils": "5.6.4"
|
|
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": "
|
|
112
|
+
"gitHead": "aaf6d3bf68d7e435e5af4b942f05ef0f9418e549"
|
|
113
113
|
}
|