@cornerstonejs/core 1.56.1 → 1.57.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.js +15 -5
- package/dist/cjs/RenderingEngine/BaseVolumeViewport.js.map +1 -1
- package/dist/cjs/enums/Events.d.ts +1 -0
- package/dist/cjs/enums/Events.js +1 -0
- package/dist/cjs/enums/Events.js.map +1 -1
- package/dist/cjs/utilities/applyPreset.js +13 -11
- package/dist/cjs/utilities/applyPreset.js.map +1 -1
- package/dist/esm/RenderingEngine/BaseVolumeViewport.js +15 -5
- package/dist/esm/RenderingEngine/BaseVolumeViewport.js.map +1 -1
- package/dist/esm/enums/Events.js +1 -0
- package/dist/esm/enums/Events.js.map +1 -1
- package/dist/esm/utilities/applyPreset.js +13 -11
- package/dist/esm/utilities/applyPreset.js.map +1 -1
- package/dist/types/RenderingEngine/BaseVolumeViewport.d.ts.map +1 -1
- package/dist/types/enums/Events.d.ts +1 -0
- package/dist/types/enums/Events.d.ts.map +1 -1
- package/dist/types/utilities/applyPreset.d.ts.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 +16 -5
- package/src/enums/Events.ts +6 -0
- package/src/utilities/applyPreset.ts +15 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.57.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"type": "individual",
|
|
48
48
|
"url": "https://ohif.org/donate"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "1699f915a5e7a5cf9295707fb5b62fe01d7e491b"
|
|
51
51
|
}
|
|
@@ -663,7 +663,7 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
|
|
|
663
663
|
*
|
|
664
664
|
* @returns void
|
|
665
665
|
*/
|
|
666
|
-
private setPreset(
|
|
666
|
+
private setPreset(presetNameOrObj, volumeId, suppressEvents) {
|
|
667
667
|
const applicableVolumeActorInfo = this._getApplicableVolumeActor(volumeId);
|
|
668
668
|
|
|
669
669
|
if (!applicableVolumeActorInfo) {
|
|
@@ -672,9 +672,13 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
|
|
|
672
672
|
|
|
673
673
|
const { volumeActor } = applicableVolumeActorInfo;
|
|
674
674
|
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
675
|
+
let preset = presetNameOrObj;
|
|
676
|
+
|
|
677
|
+
if (typeof preset === 'string') {
|
|
678
|
+
preset = VIEWPORT_PRESETS.find((preset) => {
|
|
679
|
+
return preset.name === presetNameOrObj;
|
|
680
|
+
});
|
|
681
|
+
}
|
|
678
682
|
|
|
679
683
|
if (!preset) {
|
|
680
684
|
return;
|
|
@@ -682,7 +686,14 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
|
|
|
682
686
|
|
|
683
687
|
applyPreset(volumeActor, preset);
|
|
684
688
|
|
|
685
|
-
|
|
689
|
+
if (!suppressEvents) {
|
|
690
|
+
triggerEvent(this.element, Events.PRESET_MODIFIED, {
|
|
691
|
+
viewportId: this.id,
|
|
692
|
+
volumeId: applicableVolumeActorInfo.volumeId,
|
|
693
|
+
actor: volumeActor,
|
|
694
|
+
presetName: preset.name,
|
|
695
|
+
});
|
|
696
|
+
}
|
|
686
697
|
}
|
|
687
698
|
|
|
688
699
|
/**
|
package/src/enums/Events.ts
CHANGED
|
@@ -38,6 +38,12 @@ enum Events {
|
|
|
38
38
|
* and see what event detail is included in {@link EventTypes.VoiModifiedEventDetail | VoiModified Event Detail }
|
|
39
39
|
*/
|
|
40
40
|
VOI_MODIFIED = 'CORNERSTONE_VOI_MODIFIED',
|
|
41
|
+
/**
|
|
42
|
+
* Triggers on the HTML element when viewport modifies its preset (used in volume viewport 3D)
|
|
43
|
+
*
|
|
44
|
+
* Make use of {@link EventTypes.PresetModifiedEvent | PresetModified Event Type } for typing your event listeners for PRESET_MODIFIED event,
|
|
45
|
+
*/
|
|
46
|
+
PRESET_MODIFIED = 'CORNERSTONE_VIEWPORT_RENDERING_PRESET_MODIFIED',
|
|
41
47
|
/**
|
|
42
48
|
* Triggers on the HTML element when viewport modifies its display area
|
|
43
49
|
*
|
|
@@ -57,8 +57,9 @@ export default function applyPreset(
|
|
|
57
57
|
|
|
58
58
|
applyPointsToPiecewiseFunction(normPoints, shiftRange, ofun);
|
|
59
59
|
|
|
60
|
-
actor.getProperty()
|
|
60
|
+
const property = actor.getProperty();
|
|
61
61
|
|
|
62
|
+
property.setScalarOpacity(0, ofun);
|
|
62
63
|
const [
|
|
63
64
|
gradientMinValue,
|
|
64
65
|
gradientMinOpacity,
|
|
@@ -66,26 +67,28 @@ export default function applyPreset(
|
|
|
66
67
|
gradientMaxOpacity,
|
|
67
68
|
] = preset.gradientOpacity.split(' ').splice(1).map(parseFloat);
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
property.setUseGradientOpacity(0, true);
|
|
71
|
+
property.setGradientOpacityMinimumValue(0, gradientMinValue);
|
|
72
|
+
property.setGradientOpacityMinimumOpacity(0, gradientMinOpacity);
|
|
73
|
+
property.setGradientOpacityMaximumValue(0, gradientMaxValue);
|
|
74
|
+
property.setGradientOpacityMaximumOpacity(0, gradientMaxOpacity);
|
|
74
75
|
|
|
75
76
|
if (preset.interpolation === '1') {
|
|
76
|
-
|
|
77
|
-
//
|
|
77
|
+
property.setInterpolationTypeToFastLinear();
|
|
78
|
+
//property.setInterpolationTypeToLinear()
|
|
78
79
|
}
|
|
79
80
|
|
|
81
|
+
property.setShade(preset.shade === '1');
|
|
82
|
+
|
|
80
83
|
const ambient = parseFloat(preset.ambient);
|
|
81
84
|
const diffuse = parseFloat(preset.diffuse);
|
|
82
85
|
const specular = parseFloat(preset.specular);
|
|
83
86
|
const specularPower = parseFloat(preset.specularPower);
|
|
84
87
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
property.setAmbient(ambient);
|
|
89
|
+
property.setDiffuse(diffuse);
|
|
90
|
+
property.setSpecular(specular);
|
|
91
|
+
property.setSpecularPower(specularPower);
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
function getShiftRange(colorTransferArray) {
|