fix: null save voi range properties (#5268)

This commit is contained in:
Salim Kanoun authored and GitHub committed 2025-07-28 09:37:24 -04:00
1 parent 47e231f061
commit 04dcacd3a5
1 file changed
+2 -2
@@ -262,13 +262,13 @@ export function useViewportRendering(
if (volumeId) { if (volumeId) {
properties = viewport.getProperties(volumeId); properties = viewport.getProperties(volumeId);
if (properties.voiRange) { if (properties?.voiRange) {
setVoiRange(properties.voiRange); setVoiRange(properties.voiRange);
voiRangeRef.current = properties.voiRange; voiRangeRef.current = properties.voiRange;
} }
// Get opacity from colormap if available // 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 isArray = Array.isArray(properties.colormap.opacity);
const opacity = isArray const opacity = isArray
? properties.colormap.opacity.reduce((max, current) => Math.max(max, current), 0) ? properties.colormap.opacity.reduce((max, current) => Math.max(max, current), 0)