From 98c657231efab8f54a8eec1a3257dd7255b22c44 Mon Sep 17 00:00:00 2001 From: James Petts Date: Wed, 5 Aug 2020 10:00:47 +0100 Subject: [PATCH] IDC-1897 (#1940) * show warnings for rt. * Remove unneeded old code --- .../src/components/RTPanel/RTPanel.js | 11 +- .../StructureSetItem/StructureSetItem.css | 17 ++- .../StructureSetItem/StructureSetItem.js | 140 +++++++++++++----- extensions/dicom-rt/src/index.js | 12 -- extensions/dicom-rt/src/loadRTStruct.js | 23 ++- yarn.lock | 28 +--- 6 files changed, 128 insertions(+), 103 deletions(-) diff --git a/extensions/dicom-rt/src/components/RTPanel/RTPanel.js b/extensions/dicom-rt/src/components/RTPanel/RTPanel.js index 5c38af0a7..488041bd3 100644 --- a/extensions/dicom-rt/src/components/RTPanel/RTPanel.js +++ b/extensions/dicom-rt/src/components/RTPanel/RTPanel.js @@ -17,7 +17,6 @@ const { studyMetadataManager } = utils; const refreshViewport = () => { cornerstone.getEnabledElements().forEach(enabledElement => { - debugger; if (enabledElement.image) { cornerstone.updateImage(enabledElement.element); } @@ -40,7 +39,6 @@ const RTPanel = ({ activeIndex, isOpen, onContourItemClick, - noContoursNotification, activeContexts = [], contexts = {}, }) => { @@ -126,7 +124,7 @@ const RTPanel = ({ }, [isOpen]); const toContourItem = ( - { ROINumber, ROIName, RTROIObservations, colorArray, visible }, + { ROINumber, ROIName, RTROIObservations, colorArray, visible, isSupported }, loadedSet ) => { let interpretedType = ''; @@ -139,6 +137,7 @@ const RTPanel = ({ { setSelectedContour(isSameContour ? null : ROINumber); @@ -160,12 +159,6 @@ 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/components/StructureSetItem/StructureSetItem.css b/extensions/dicom-rt/src/components/StructureSetItem/StructureSetItem.css index 53389b631..b2efb3359 100644 --- a/extensions/dicom-rt/src/components/StructureSetItem/StructureSetItem.css +++ b/extensions/dicom-rt/src/components/StructureSetItem/StructureSetItem.css @@ -22,11 +22,6 @@ width: 100%; } -.dcmrt-structure-set-item.selected .item-actions { - height: 35px; - visibility: visible; -} - .dcmrt-structure-set-item .item-actions { margin-left: -1px; background-color: var(--ui-gray-darker); @@ -47,7 +42,8 @@ transition: all 0.3s ease; } -.dcmrt-structure-set-item .item-actions .btnAction:hover, .dcmrt-structure-set-item .item-actions .btnAction:active { +.dcmrt-structure-set-item .item-actions .btnAction:hover, +.dcmrt-structure-set-item .item-actions .btnAction:active { color: var(--text-primary-color); } @@ -86,3 +82,12 @@ .dcmrt-structure-set-item .item-label .eye-icon.--visible { color: var(--default-color); } + +.dcmrt-structure-set-item.isDisabled .item-color-section { + background-color: #e29e4a; + color: #fff; +} + +.dcmrt-structure-set-item.isDisabled .item-label { + color: var(--text-disabled-color); +} diff --git a/extensions/dicom-rt/src/components/StructureSetItem/StructureSetItem.js b/extensions/dicom-rt/src/components/StructureSetItem/StructureSetItem.js index ba3066462..b1b3c1be9 100644 --- a/extensions/dicom-rt/src/components/StructureSetItem/StructureSetItem.js +++ b/extensions/dicom-rt/src/components/StructureSetItem/StructureSetItem.js @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import PropTypes from 'prop-types'; -import { TableListItem, Icon } from '@ohif/ui'; +import { TableListItem, Icon, Tooltip, OverlayTrigger } from '@ohif/ui'; import './StructureSetItem.css'; @@ -20,6 +20,7 @@ ColoredCircle.propTypes = { const StructureSetItem = ({ index, label, + isDisabled, onClick, itemClass, color, @@ -31,22 +32,44 @@ const StructureSetItem = ({ useEffect(() => { setIsVisible(visible); - }, [visible]) + }, [visible]); - return ( -
- } - itemMetaClass="item-color-section" - onItemClick={onClick} - > -
-
- {label} + let dcmrtClassNames = `dcmrt-structure-set-item`; + + if (selected) { + dcmrtClassNames += ' selected'; + } + + if (isDisabled) { + dcmrtClassNames += ' isDisabled'; + } + + const warningIcon = ( + + + + ); + + const tableListItem = ( + } + itemMetaClass="item-color-section" + onItemClick={() => { + if (isDisabled) { + return; + } + + onClick(); + }} + > +
+
+ {label} + {!isDisabled && ( { event.stopPropagation(); + + if (isDisabled) { + return; + } + const newVisibility = !isVisible; setIsVisible(newVisibility); onVisibilityChange(newVisibility); }} /> -
- {false &&
{'...'}
} - {false && ( -
- - -
)}
-
+ + {false &&
{'...'}
} + {false && ( +
+ + +
+ )} +
+ + ); + + return ( +
+ + {isDisabled ? ( + +
Unsupported Region
+
+ Contour type currently unsupported. +
+ + } + > +
{tableListItem}
+
+ ) : ( + {tableListItem} + )} +
); }; @@ -99,7 +157,7 @@ StructureSetItem.propTypes = { StructureSetItem.defaultProps = { itemClass: '', - onClick: () => { }, + onClick: () => {}, }; export default StructureSetItem; diff --git a/extensions/dicom-rt/src/index.js b/extensions/dicom-rt/src/index.js index a38561c0c..9d58e1ac0 100644 --- a/extensions/dicom-rt/src/index.js +++ b/extensions/dicom-rt/src/index.js @@ -21,20 +21,9 @@ export default { init({ servicesManager, configuration }); }, 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); }; @@ -45,7 +34,6 @@ export default { onContourItemClick={contourItemClickHandler} activeContexts={activeContexts} contexts={api.contexts} - noContoursNotification={noContoursNotificationHandler} /> ); }; diff --git a/extensions/dicom-rt/src/loadRTStruct.js b/extensions/dicom-rt/src/loadRTStruct.js index 28dd1fba8..005944de3 100644 --- a/extensions/dicom-rt/src/loadRTStruct.js +++ b/extensions/dicom-rt/src/loadRTStruct.js @@ -74,12 +74,7 @@ export default async function loadRTStruct( continue; } - _setROIContourMetadata( - structureSet, - StructureSetROISequence, - RTROIObservationsSequence, - ROIContour - ); + const isSupported = false; for (let c = 0; c < ContourSequence.length; c++) { const { @@ -91,10 +86,12 @@ export default async function loadRTStruct( if (ContourGeometricType !== 'CLOSED_PLANAR') { // TODO: Do we want to visualise types other than closed planar? - // We could easily do open planar. + // We could easily do open planar and point. continue; } + isSupported = true; + const sopInstanceUID = ContourImageSequence.ReferencedSOPInstanceUID; const imageId = _getImageId(imageIdSopInstanceUidPairs, sopInstanceUID); const imageIdSpecificToolData = _getOrCreateImageIdSpecificToolData( @@ -126,6 +123,14 @@ export default async function loadRTStruct( imageIdSpecificToolData.push(measurementData); } + + _setROIContourMetadata( + structureSet, + StructureSetROISequence, + RTROIObservationsSequence, + ROIContour, + isSupported + ); } _setToolEnabledIfNotEnabled(rtStructDisplayToolName); @@ -155,7 +160,8 @@ function _setROIContourMetadata( structureSet, StructureSetROISequence, RTROIObservationsSequence, - ROIContour + ROIContour, + isSupported ) { const StructureSetROI = StructureSetROISequence.find( structureSetROI => @@ -167,6 +173,7 @@ function _setROIContourMetadata( ROIName: StructureSetROI.ROIName, ROIGenerationAlgorithm: StructureSetROI.ROIGenerationAlgorithm, ROIDescription: StructureSetROI.ROIDescription, + isSupported, visible: true, }; diff --git a/yarn.lock b/yarn.lock index 1d120838c..d093e1280 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1247,34 +1247,13 @@ pirates "^4.0.0" source-map-support "^0.5.9" -"@babel/runtime@7.1.2": - version "7.1.2" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.1.2.tgz#81c89935f4647706fc54541145e6b4ecfef4b8e3" - integrity sha512-Y3SCjmhSupzFB6wcv1KmmFucH6gDVnI30WjOcicV10ju0cZjak3Jcs67YLIXBrmZYw1xCrVeJPbycFwrqNyxpg== - dependencies: - regenerator-runtime "^0.12.0" - -"@babel/runtime@7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.6.0.tgz#4fc1d642a9fd0299754e8b5de62c631cf5568205" - integrity sha512-89eSBLJsxNxOERC0Op4vd+0Bqm6wRMqMbFtV3i0/fbaWw/mJ8Q3eBvgX0G4SyrOOLCtbu98HspF8o09MRT+KzQ== - dependencies: - regenerator-runtime "^0.13.2" - -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.2.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.0", "@babel/runtime@^7.4.2", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.5": +"@babel/runtime@7.1.2", "@babel/runtime@7.5.5", "@babel/runtime@7.6.0", "@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.2.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.0", "@babel/runtime@^7.4.2", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.0", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.6": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132" integrity sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ== dependencies: regenerator-runtime "^0.13.2" -"@babel/runtime@^7.6.0", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.6": - version "7.10.5" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.10.5.tgz#303d8bd440ecd5a491eae6117fd3367698674c5c" - integrity sha512-otddXKhdNn7d0ptoFRHtMLa8LqDxLYwTjB4nYgM1yy5N6gU/MUf8zqyyLltCH3yAVitBzmwK4us+DD0l/MauAg== - dependencies: - regenerator-runtime "^0.13.4" - "@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4", "@babel/template@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.6.0.tgz#7f0159c7f5012230dad64cca42ec9bdb5c9536e6" @@ -16433,11 +16412,6 @@ regenerator-runtime@^0.11.0, regenerator-runtime@^0.11.1: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== -regenerator-runtime@^0.12.0: - version "0.12.1" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz#fa1a71544764c036f8c49b13a08b2594c9f8a0de" - integrity sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg== - regenerator-runtime@^0.13.1, regenerator-runtime@^0.13.2, regenerator-runtime@^0.13.4: version "0.13.5" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz#d878a1d094b4306d10b9096484b33ebd55e26697"