@cornerstonejs/adapters 1.56.2 → 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/adapters.es.js +29 -16
- package/dist/adapters.es.js.map +1 -1
- package/package.json +5 -5
package/dist/adapters.es.js
CHANGED
|
@@ -5072,6 +5072,7 @@ var Events$2;
|
|
|
5072
5072
|
Events["CAMERA_MODIFIED"] = "CORNERSTONE_CAMERA_MODIFIED";
|
|
5073
5073
|
Events["CAMERA_RESET"] = "CORNERSTONE_CAMERA_RESET";
|
|
5074
5074
|
Events["VOI_MODIFIED"] = "CORNERSTONE_VOI_MODIFIED";
|
|
5075
|
+
Events["PRESET_MODIFIED"] = "CORNERSTONE_VIEWPORT_RENDERING_PRESET_MODIFIED";
|
|
5075
5076
|
Events["DISPLAY_AREA_MODIFIED"] = "CORNERSTONE_DISPLAY_AREA_MODIFIED";
|
|
5076
5077
|
Events["ELEMENT_DISABLED"] = "CORNERSTONE_ELEMENT_DISABLED";
|
|
5077
5078
|
Events["ELEMENT_ENABLED"] = "CORNERSTONE_ELEMENT_ENABLED";
|
|
@@ -38139,24 +38140,26 @@ function applyPreset(actor, preset) {
|
|
|
38139
38140
|
normPoints.push([value, opacity]);
|
|
38140
38141
|
}
|
|
38141
38142
|
applyPointsToPiecewiseFunction(normPoints, shiftRange, ofun);
|
|
38142
|
-
actor.getProperty()
|
|
38143
|
+
const property = actor.getProperty();
|
|
38144
|
+
property.setScalarOpacity(0, ofun);
|
|
38143
38145
|
const [gradientMinValue, gradientMinOpacity, gradientMaxValue, gradientMaxOpacity] = preset.gradientOpacity.split(' ').splice(1).map(parseFloat);
|
|
38144
|
-
|
|
38145
|
-
|
|
38146
|
-
|
|
38147
|
-
|
|
38148
|
-
|
|
38146
|
+
property.setUseGradientOpacity(0, true);
|
|
38147
|
+
property.setGradientOpacityMinimumValue(0, gradientMinValue);
|
|
38148
|
+
property.setGradientOpacityMinimumOpacity(0, gradientMinOpacity);
|
|
38149
|
+
property.setGradientOpacityMaximumValue(0, gradientMaxValue);
|
|
38150
|
+
property.setGradientOpacityMaximumOpacity(0, gradientMaxOpacity);
|
|
38149
38151
|
if (preset.interpolation === '1') {
|
|
38150
|
-
|
|
38152
|
+
property.setInterpolationTypeToFastLinear();
|
|
38151
38153
|
}
|
|
38154
|
+
property.setShade(preset.shade === '1');
|
|
38152
38155
|
const ambient = parseFloat(preset.ambient);
|
|
38153
38156
|
const diffuse = parseFloat(preset.diffuse);
|
|
38154
38157
|
const specular = parseFloat(preset.specular);
|
|
38155
38158
|
const specularPower = parseFloat(preset.specularPower);
|
|
38156
|
-
|
|
38157
|
-
|
|
38158
|
-
|
|
38159
|
-
|
|
38159
|
+
property.setAmbient(ambient);
|
|
38160
|
+
property.setDiffuse(diffuse);
|
|
38161
|
+
property.setSpecular(specular);
|
|
38162
|
+
property.setSpecularPower(specularPower);
|
|
38160
38163
|
}
|
|
38161
38164
|
function getShiftRange(colorTransferArray) {
|
|
38162
38165
|
let min = Infinity;
|
|
@@ -41786,7 +41789,7 @@ class BaseVolumeViewport extends Viewport$1 {
|
|
|
41786
41789
|
}
|
|
41787
41790
|
this.render();
|
|
41788
41791
|
}
|
|
41789
|
-
setPreset(
|
|
41792
|
+
setPreset(presetNameOrObj, volumeId, suppressEvents) {
|
|
41790
41793
|
const applicableVolumeActorInfo = this._getApplicableVolumeActor(volumeId);
|
|
41791
41794
|
if (!applicableVolumeActorInfo) {
|
|
41792
41795
|
return;
|
|
@@ -41794,14 +41797,24 @@ class BaseVolumeViewport extends Viewport$1 {
|
|
|
41794
41797
|
const {
|
|
41795
41798
|
volumeActor
|
|
41796
41799
|
} = applicableVolumeActorInfo;
|
|
41797
|
-
|
|
41798
|
-
|
|
41799
|
-
|
|
41800
|
+
let preset = presetNameOrObj;
|
|
41801
|
+
if (typeof preset === 'string') {
|
|
41802
|
+
preset = VIEWPORT_PRESETS.find(preset => {
|
|
41803
|
+
return preset.name === presetNameOrObj;
|
|
41804
|
+
});
|
|
41805
|
+
}
|
|
41800
41806
|
if (!preset) {
|
|
41801
41807
|
return;
|
|
41802
41808
|
}
|
|
41803
41809
|
applyPreset(volumeActor, preset);
|
|
41804
|
-
|
|
41810
|
+
if (!suppressEvents) {
|
|
41811
|
+
triggerEvent(this.element, EVENTS.PRESET_MODIFIED, {
|
|
41812
|
+
viewportId: this.id,
|
|
41813
|
+
volumeId: applicableVolumeActorInfo.volumeId,
|
|
41814
|
+
actor: volumeActor,
|
|
41815
|
+
presetName: preset.name
|
|
41816
|
+
});
|
|
41817
|
+
}
|
|
41805
41818
|
}
|
|
41806
41819
|
async setVolumes(volumeInputArray, immediate = false, suppressEvents = false) {
|
|
41807
41820
|
const firstImageVolume = cache$1.getVolume(volumeInputArray[0].volumeId);
|