* show warnings for rt.

* Remove unneeded old code
This commit is contained in:
James Petts 2020-08-05 10:00:47 +01:00 committed by GitHub
parent 14da247318
commit 98c657231e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 128 additions and 103 deletions

View File

@ -17,7 +17,6 @@ const { studyMetadataManager } = utils;
const refreshViewport = () => { const refreshViewport = () => {
cornerstone.getEnabledElements().forEach(enabledElement => { cornerstone.getEnabledElements().forEach(enabledElement => {
debugger;
if (enabledElement.image) { if (enabledElement.image) {
cornerstone.updateImage(enabledElement.element); cornerstone.updateImage(enabledElement.element);
} }
@ -40,7 +39,6 @@ const RTPanel = ({
activeIndex, activeIndex,
isOpen, isOpen,
onContourItemClick, onContourItemClick,
noContoursNotification,
activeContexts = [], activeContexts = [],
contexts = {}, contexts = {},
}) => { }) => {
@ -126,7 +124,7 @@ const RTPanel = ({
}, [isOpen]); }, [isOpen]);
const toContourItem = ( const toContourItem = (
{ ROINumber, ROIName, RTROIObservations, colorArray, visible }, { ROINumber, ROIName, RTROIObservations, colorArray, visible, isSupported },
loadedSet loadedSet
) => { ) => {
let interpretedType = ''; let interpretedType = '';
@ -139,6 +137,7 @@ const RTPanel = ({
<StructureSetItem <StructureSetItem
key={ROINumber} key={ROINumber}
selected={isSameContour} selected={isSameContour}
isDisabled={!isSupported}
onClick={() => { onClick={() => {
setSelectedContour(isSameContour ? null : ROINumber); setSelectedContour(isSameContour ? null : ROINumber);
@ -160,12 +159,6 @@ const RTPanel = ({
imageIds imageIds
); );
if (!imageId) {
noContoursNotification();
return;
}
const frameIndex = imageIds.indexOf(imageId); const frameIndex = imageIds.indexOf(imageId);
const SOPInstanceUID = cornerstone.metaData.get( const SOPInstanceUID = cornerstone.metaData.get(
'SOPInstanceUID', 'SOPInstanceUID',

View File

@ -22,11 +22,6 @@
width: 100%; width: 100%;
} }
.dcmrt-structure-set-item.selected .item-actions {
height: 35px;
visibility: visible;
}
.dcmrt-structure-set-item .item-actions { .dcmrt-structure-set-item .item-actions {
margin-left: -1px; margin-left: -1px;
background-color: var(--ui-gray-darker); background-color: var(--ui-gray-darker);
@ -47,7 +42,8 @@
transition: all 0.3s ease; 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); color: var(--text-primary-color);
} }
@ -86,3 +82,12 @@
.dcmrt-structure-set-item .item-label .eye-icon.--visible { .dcmrt-structure-set-item .item-label .eye-icon.--visible {
color: var(--default-color); 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);
}

View File

@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { TableListItem, Icon } from '@ohif/ui'; import { TableListItem, Icon, Tooltip, OverlayTrigger } from '@ohif/ui';
import './StructureSetItem.css'; import './StructureSetItem.css';
@ -20,6 +20,7 @@ ColoredCircle.propTypes = {
const StructureSetItem = ({ const StructureSetItem = ({
index, index,
label, label,
isDisabled,
onClick, onClick,
itemClass, itemClass,
color, color,
@ -31,22 +32,44 @@ const StructureSetItem = ({
useEffect(() => { useEffect(() => {
setIsVisible(visible); setIsVisible(visible);
}, [visible]) }, [visible]);
return ( let dcmrtClassNames = `dcmrt-structure-set-item`;
<div className={`dcmrt-structure-set-item ${selected && 'selected'}`}>
if (selected) {
dcmrtClassNames += ' selected';
}
if (isDisabled) {
dcmrtClassNames += ' isDisabled';
}
const warningIcon = (
<span>
<Icon name="exclamation-triangle" />
</span>
);
const tableListItem = (
<TableListItem <TableListItem
key={index} key={index}
itemKey={index} itemKey={index}
itemIndex={index} itemIndex={index}
itemClass={itemClass} itemClass={itemClass}
itemMeta={<ColoredCircle color={color} />} itemMeta={isDisabled ? warningIcon : <ColoredCircle color={color} />}
itemMetaClass="item-color-section" itemMetaClass="item-color-section"
onItemClick={onClick} onItemClick={() => {
if (isDisabled) {
return;
}
onClick();
}}
> >
<div> <div>
<div className="item-label" style={{ marginBottom: 4 }}> <div className="item-label" style={{ marginBottom: 4 }}>
<span>{label}</span> <span>{label}</span>
{!isDisabled && (
<Icon <Icon
className={`eye-icon ${isVisible && '--visible'}`} className={`eye-icon ${isVisible && '--visible'}`}
name={isVisible ? 'eye' : 'eye-closed'} name={isVisible ? 'eye' : 'eye-closed'}
@ -54,12 +77,19 @@ const StructureSetItem = ({
height="20px" height="20px"
onClick={event => { onClick={event => {
event.stopPropagation(); event.stopPropagation();
if (isDisabled) {
return;
}
const newVisibility = !isVisible; const newVisibility = !isVisible;
setIsVisible(newVisibility); setIsVisible(newVisibility);
onVisibilityChange(newVisibility); onVisibilityChange(newVisibility);
}} }}
/> />
)}
</div> </div>
{false && <div className="item-info">{'...'}</div>} {false && <div className="item-info">{'...'}</div>}
{false && ( {false && (
<div className="item-actions"> <div className="item-actions">
@ -85,6 +115,34 @@ const StructureSetItem = ({
)} )}
</div> </div>
</TableListItem> </TableListItem>
);
return (
<div className={dcmrtClassNames}>
<React.Fragment>
{isDisabled ? (
<OverlayTrigger
key={index}
placement="left"
overlay={
<Tooltip
placement="left"
className="in tooltip-warning"
id="tooltip-left"
>
<div className="warningTitle">Unsupported Region</div>
<div className="warningContent">
Contour type currently unsupported.
</div>
</Tooltip>
}
>
<div>{tableListItem}</div>
</OverlayTrigger>
) : (
<React.Fragment>{tableListItem} </React.Fragment>
)}
</React.Fragment>
</div> </div>
); );
}; };

View File

@ -21,20 +21,9 @@ export default {
init({ servicesManager, configuration }); init({ servicesManager, configuration });
}, },
getPanelModule({ commandsManager, servicesManager, api }) { getPanelModule({ commandsManager, servicesManager, api }) {
const { UINotificationService } = servicesManager.services;
const ExtendedRTPanel = props => { const ExtendedRTPanel = props => {
const { activeContexts } = api.hooks.useAppContext(); 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 => { const contourItemClickHandler = contourData => {
commandsManager.runCommand('jumpToImage', contourData); commandsManager.runCommand('jumpToImage', contourData);
}; };
@ -45,7 +34,6 @@ export default {
onContourItemClick={contourItemClickHandler} onContourItemClick={contourItemClickHandler}
activeContexts={activeContexts} activeContexts={activeContexts}
contexts={api.contexts} contexts={api.contexts}
noContoursNotification={noContoursNotificationHandler}
/> />
); );
}; };

View File

@ -74,12 +74,7 @@ export default async function loadRTStruct(
continue; continue;
} }
_setROIContourMetadata( const isSupported = false;
structureSet,
StructureSetROISequence,
RTROIObservationsSequence,
ROIContour
);
for (let c = 0; c < ContourSequence.length; c++) { for (let c = 0; c < ContourSequence.length; c++) {
const { const {
@ -91,10 +86,12 @@ export default async function loadRTStruct(
if (ContourGeometricType !== 'CLOSED_PLANAR') { if (ContourGeometricType !== 'CLOSED_PLANAR') {
// TODO: Do we want to visualise types other than 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; continue;
} }
isSupported = true;
const sopInstanceUID = ContourImageSequence.ReferencedSOPInstanceUID; const sopInstanceUID = ContourImageSequence.ReferencedSOPInstanceUID;
const imageId = _getImageId(imageIdSopInstanceUidPairs, sopInstanceUID); const imageId = _getImageId(imageIdSopInstanceUidPairs, sopInstanceUID);
const imageIdSpecificToolData = _getOrCreateImageIdSpecificToolData( const imageIdSpecificToolData = _getOrCreateImageIdSpecificToolData(
@ -126,6 +123,14 @@ export default async function loadRTStruct(
imageIdSpecificToolData.push(measurementData); imageIdSpecificToolData.push(measurementData);
} }
_setROIContourMetadata(
structureSet,
StructureSetROISequence,
RTROIObservationsSequence,
ROIContour,
isSupported
);
} }
_setToolEnabledIfNotEnabled(rtStructDisplayToolName); _setToolEnabledIfNotEnabled(rtStructDisplayToolName);
@ -155,7 +160,8 @@ function _setROIContourMetadata(
structureSet, structureSet,
StructureSetROISequence, StructureSetROISequence,
RTROIObservationsSequence, RTROIObservationsSequence,
ROIContour ROIContour,
isSupported
) { ) {
const StructureSetROI = StructureSetROISequence.find( const StructureSetROI = StructureSetROISequence.find(
structureSetROI => structureSetROI =>
@ -167,6 +173,7 @@ function _setROIContourMetadata(
ROIName: StructureSetROI.ROIName, ROIName: StructureSetROI.ROIName,
ROIGenerationAlgorithm: StructureSetROI.ROIGenerationAlgorithm, ROIGenerationAlgorithm: StructureSetROI.ROIGenerationAlgorithm,
ROIDescription: StructureSetROI.ROIDescription, ROIDescription: StructureSetROI.ROIDescription,
isSupported,
visible: true, visible: true,
}; };

View File

@ -1247,34 +1247,13 @@
pirates "^4.0.0" pirates "^4.0.0"
source-map-support "^0.5.9" source-map-support "^0.5.9"
"@babel/runtime@7.1.2": "@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.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":
version "7.5.5" version "7.5.5"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132"
integrity sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ== integrity sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ==
dependencies: dependencies:
regenerator-runtime "^0.13.2" 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": "@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" version "7.6.0"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.6.0.tgz#7f0159c7f5012230dad64cca42ec9bdb5c9536e6" 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" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== 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: regenerator-runtime@^0.13.1, regenerator-runtime@^0.13.2, regenerator-runtime@^0.13.4:
version "0.13.5" version "0.13.5"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz#d878a1d094b4306d10b9096484b33ebd55e26697" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz#d878a1d094b4306d10b9096484b33ebd55e26697"