@cornerstonejs/core 1.26.0 → 1.27.0
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/cjs/RenderingEngine/BaseVolumeViewport.d.ts +1 -1
- package/dist/cjs/RenderingEngine/BaseVolumeViewport.js.map +1 -1
- package/dist/cjs/RenderingEngine/VolumeViewport.js +6 -0
- package/dist/cjs/RenderingEngine/VolumeViewport.js.map +1 -1
- package/dist/cjs/utilities/getTargetVolumeAndSpacingInNormalDir.js +10 -2
- package/dist/cjs/utilities/getTargetVolumeAndSpacingInNormalDir.js.map +1 -1
- package/dist/esm/RenderingEngine/BaseVolumeViewport.d.ts +1 -1
- package/dist/esm/RenderingEngine/BaseVolumeViewport.js.map +1 -1
- package/dist/esm/RenderingEngine/VolumeViewport.js +6 -0
- package/dist/esm/RenderingEngine/VolumeViewport.js.map +1 -1
- package/dist/esm/utilities/getTargetVolumeAndSpacingInNormalDir.js +10 -2
- package/dist/esm/utilities/getTargetVolumeAndSpacingInNormalDir.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
- package/src/RenderingEngine/BaseVolumeViewport.ts +2 -5
- package/src/RenderingEngine/VolumeViewport.ts +8 -0
- package/src/utilities/getTargetVolumeAndSpacingInNormalDir.ts +25 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"type": "individual",
|
|
47
47
|
"url": "https://ohif.org/donate"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "545dab67a657488ffe90b7490b31976d953005fc"
|
|
50
50
|
}
|
|
@@ -31,7 +31,6 @@ import type {
|
|
|
31
31
|
Point2,
|
|
32
32
|
Point3,
|
|
33
33
|
VOIRange,
|
|
34
|
-
ViewportProperties,
|
|
35
34
|
VolumeViewportProperties,
|
|
36
35
|
} from '../types';
|
|
37
36
|
import { VoiModifiedEventDetail } from '../types/EventTypes';
|
|
@@ -79,7 +78,7 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
|
|
|
79
78
|
VolumeViewportProperties
|
|
80
79
|
>();
|
|
81
80
|
|
|
82
|
-
|
|
81
|
+
protected viewportProperties: VolumeViewportProperties = {};
|
|
83
82
|
|
|
84
83
|
constructor(props: ViewportInput) {
|
|
85
84
|
super(props);
|
|
@@ -606,9 +605,7 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
|
|
|
606
605
|
|
|
607
606
|
if (properties.slabThickness !== undefined) {
|
|
608
607
|
this.setSlabThickness(properties.slabThickness);
|
|
609
|
-
//We need to set the current
|
|
610
|
-
// this.currentViewportProperties.get(volumeId).slabThickness =
|
|
611
|
-
// properties.slabThickness;
|
|
608
|
+
//We need to set the current slabThickness here since setSlabThickness is define in VolumeViewport
|
|
612
609
|
this.viewportProperties.slabThickness = properties.slabThickness;
|
|
613
610
|
}
|
|
614
611
|
|
|
@@ -302,6 +302,7 @@ class VolumeViewport extends BaseVolumeViewport {
|
|
|
302
302
|
const currentCamera = this.getCamera();
|
|
303
303
|
this.updateClippingPlanesForActors(currentCamera);
|
|
304
304
|
this.triggerCameraModifiedEventIfNecessary(currentCamera, currentCamera);
|
|
305
|
+
this.viewportProperties.slabThickness = slabThickness;
|
|
305
306
|
}
|
|
306
307
|
|
|
307
308
|
/**
|
|
@@ -387,6 +388,13 @@ class VolumeViewport extends BaseVolumeViewport {
|
|
|
387
388
|
throw new Error(`No actor found for the given volumeId: ${volumeId}`);
|
|
388
389
|
}
|
|
389
390
|
|
|
391
|
+
// if a custom slabThickness was set, we need to reset it
|
|
392
|
+
if (volumeActor.slabThickness) {
|
|
393
|
+
volumeActor.slabThickness = RENDERING_DEFAULTS.MINIMUM_SLAB_THICKNESS;
|
|
394
|
+
this.viewportProperties.slabThickness = undefined;
|
|
395
|
+
this.updateClippingPlanesForActors(this.getCamera());
|
|
396
|
+
}
|
|
397
|
+
|
|
390
398
|
const imageVolume = cache.getVolume(volumeActor.uid);
|
|
391
399
|
if (!imageVolume) {
|
|
392
400
|
throw new Error(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cache from '../cache/cache';
|
|
2
2
|
import { EPSILON } from '../constants';
|
|
3
3
|
// import type { VolumeViewport } from '../RenderingEngine'
|
|
4
|
-
import { ICamera, IImageVolume, IVolumeViewport } from '../types';
|
|
4
|
+
import { ICamera, IImageVolume, IVolumeViewport, Point3 } from '../types';
|
|
5
5
|
import getSpacingInNormalDirection from './getSpacingInNormalDirection';
|
|
6
6
|
import { getVolumeLoaderSchemes } from '../loaders/volumeLoader';
|
|
7
7
|
|
|
@@ -71,9 +71,11 @@ export default function getTargetVolumeAndSpacingInNormalDir(
|
|
|
71
71
|
|
|
72
72
|
const imageVolume = imageVolumes[imageVolumeIndex];
|
|
73
73
|
const { uid: actorUID } = volumeActors[imageVolumeIndex];
|
|
74
|
-
|
|
74
|
+
|
|
75
|
+
const spacingInNormalDirection = getSpacingInNormal(
|
|
75
76
|
imageVolume,
|
|
76
|
-
viewPlaneNormal
|
|
77
|
+
viewPlaneNormal,
|
|
78
|
+
viewport
|
|
77
79
|
);
|
|
78
80
|
|
|
79
81
|
return { imageVolume, spacingInNormalDirection, actorUID };
|
|
@@ -104,9 +106,10 @@ export default function getTargetVolumeAndSpacingInNormalDir(
|
|
|
104
106
|
continue;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
const spacingInNormalDirection =
|
|
109
|
+
const spacingInNormalDirection = getSpacingInNormal(
|
|
108
110
|
imageVolume,
|
|
109
|
-
viewPlaneNormal
|
|
111
|
+
viewPlaneNormal,
|
|
112
|
+
viewport
|
|
110
113
|
);
|
|
111
114
|
|
|
112
115
|
// Allow for EPSILON part larger requirement to prefer earlier volumes
|
|
@@ -124,3 +127,20 @@ export default function getTargetVolumeAndSpacingInNormalDir(
|
|
|
124
127
|
|
|
125
128
|
return smallest;
|
|
126
129
|
}
|
|
130
|
+
|
|
131
|
+
function getSpacingInNormal(
|
|
132
|
+
imageVolume: IImageVolume,
|
|
133
|
+
viewPlaneNormal: Point3,
|
|
134
|
+
viewport: IVolumeViewport
|
|
135
|
+
): number {
|
|
136
|
+
const { slabThickness } = viewport.getProperties();
|
|
137
|
+
let spacingInNormalDirection = slabThickness;
|
|
138
|
+
if (!slabThickness) {
|
|
139
|
+
spacingInNormalDirection = getSpacingInNormalDirection(
|
|
140
|
+
imageVolume,
|
|
141
|
+
viewPlaneNormal
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return spacingInNormalDirection;
|
|
146
|
+
}
|