From 2f7866c58d27f95b88028a70a462c8c211c086ab Mon Sep 17 00:00:00 2001 From: Alireza Date: Mon, 2 Oct 2023 10:37:58 -0400 Subject: [PATCH] fix(config): support more values for the useSharedArrayBuffer --- .../src/getSopClassHandlerModule.js | 3 ++- extensions/cornerstone/src/init.tsx | 18 +++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/extensions/cornerstone-dicom-seg/src/getSopClassHandlerModule.js b/extensions/cornerstone-dicom-seg/src/getSopClassHandlerModule.js index 6f7f06e4bd..7548d492ea 100644 --- a/extensions/cornerstone-dicom-seg/src/getSopClassHandlerModule.js +++ b/extensions/cornerstone-dicom-seg/src/getSopClassHandlerModule.js @@ -57,7 +57,8 @@ function _getDisplaySetsFromSeries(instances, servicesManager, extensionManager) const referencedSeriesSequence = instance.ReferencedSeriesSequence; if (!referencedSeriesSequence) { - throw new Error('ReferencedSeriesSequence is missing for the SEG'); + console.error('ReferencedSeriesSequence is missing for the SEG'); + return; } const referencedSeries = referencedSeriesSequence[0] || referencedSeriesSequence; diff --git a/extensions/cornerstone/src/init.tsx b/extensions/cornerstone/src/init.tsx index fdd184fa7a..3482d3cf51 100644 --- a/extensions/cornerstone/src/init.tsx +++ b/extensions/cornerstone/src/init.tsx @@ -43,15 +43,15 @@ export default async function init({ appConfig, }: Types.Extensions.ExtensionParams): Promise { // Note: this should run first before initializing the cornerstone - switch (appConfig.useSharedArrayBuffer) { - case 'AUTO': - cornerstone.setUseSharedArrayBuffer(csEnums.SharedArrayBufferModes.AUTO); - break; - case 'FALSE': - cornerstone.setUseSharedArrayBuffer(csEnums.SharedArrayBufferModes.FALSE); - break; - default: - cornerstone.setUseSharedArrayBuffer(csEnums.SharedArrayBufferModes.TRUE); + // DO NOT CHANGE THE ORDER + const value = appConfig.useSharedArrayBuffer; + + if (value === 'AUTO') { + cornerstone.setUseSharedArrayBuffer(csEnums.SharedArrayBufferModes.AUTO); + } else if (value === 'FALSE' || value === false) { + cornerstone.setUseSharedArrayBuffer(csEnums.SharedArrayBufferModes.FALSE); + } else { + cornerstone.setUseSharedArrayBuffer(csEnums.SharedArrayBufferModes.TRUE); } await cs3DInit({