fix: null save voi range properties (#5268)

This commit is contained in:
Salim Kanoun 2025-07-28 15:37:24 +02:00 committed by GitHub
parent 47e231f061
commit 04dcacd3a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -262,13 +262,13 @@ export function useViewportRendering(
if (volumeId) {
properties = viewport.getProperties(volumeId);
if (properties.voiRange) {
if (properties?.voiRange) {
setVoiRange(properties.voiRange);
voiRangeRef.current = properties.voiRange;
}
// Get opacity from colormap if available
if (properties.colormap && properties.colormap.opacity !== undefined) {
if (properties?.colormap?.opacity !== undefined) {
const isArray = Array.isArray(properties.colormap.opacity);
const opacity = isArray
? properties.colormap.opacity.reduce((max, current) => Math.max(max, current), 0)