From 4a2922dda0f105b8a4ae09c8d173fe1f769cc564 Mon Sep 17 00:00:00 2001 From: James Petts Date: Mon, 13 Jul 2020 15:29:29 +0100 Subject: [PATCH] Idc 1892 (#1896) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 🐛 Fix RT Panel hide/show * Prevent infinite loop by persisting load errors on displaySet. * fix: 🐛 Fix infinite error messages * Fix unit tests. * WIP * fix: 🐛 If no contours for structure, cleanly exit and notify ✅ Closes: #1892 --- .../dicom-rt/src/components/RTPanel/RTPanel.js | 7 +++++++ extensions/dicom-rt/src/index.js | 14 +++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/extensions/dicom-rt/src/components/RTPanel/RTPanel.js b/extensions/dicom-rt/src/components/RTPanel/RTPanel.js index 879c45e7b..e7c03df01 100644 --- a/extensions/dicom-rt/src/components/RTPanel/RTPanel.js +++ b/extensions/dicom-rt/src/components/RTPanel/RTPanel.js @@ -37,6 +37,7 @@ const RTPanel = ({ activeIndex, isOpen, onContourItemClick, + noContoursNotification, activeContexts = [], contexts = {}, }) => { @@ -156,6 +157,12 @@ const RTPanel = ({ imageIds ); + if (!imageId) { + noContoursNotification(); + + return; + } + const frameIndex = imageIds.indexOf(imageId); const SOPInstanceUID = cornerstone.metaData.get( 'SOPInstanceUID', diff --git a/extensions/dicom-rt/src/index.js b/extensions/dicom-rt/src/index.js index fae258a11..a38561c0c 100644 --- a/extensions/dicom-rt/src/index.js +++ b/extensions/dicom-rt/src/index.js @@ -20,10 +20,21 @@ export default { preRegistration({ servicesManager, configuration = {} }) { init({ servicesManager, configuration }); }, - getPanelModule({ commandsManager, api }) { + getPanelModule({ commandsManager, servicesManager, api }) { + const { UINotificationService } = servicesManager.services; + const ExtendedRTPanel = props => { const { activeContexts } = api.hooks.useAppContext(); + const noContoursNotificationHandler = () => { + UINotificationService.show({ + title: 'ROI Contour empty', + message: 'The ROI contour has no structure set data.', + type: 'error', + autoClose: false, + }); + }; + const contourItemClickHandler = contourData => { commandsManager.runCommand('jumpToImage', contourData); }; @@ -34,6 +45,7 @@ export default { onContourItemClick={contourItemClickHandler} activeContexts={activeContexts} contexts={api.contexts} + noContoursNotification={noContoursNotificationHandler} /> ); };