* 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 = () => {
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 = ({
<StructureSetItem
key={ROINumber}
selected={isSameContour}
isDisabled={!isSupported}
onClick={() => {
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',

View File

@ -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);
}

View File

@ -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 (
<div className={`dcmrt-structure-set-item ${selected && 'selected'}`}>
<TableListItem
key={index}
itemKey={index}
itemIndex={index}
itemClass={itemClass}
itemMeta={<ColoredCircle color={color} />}
itemMetaClass="item-color-section"
onItemClick={onClick}
>
<div>
<div className="item-label" style={{ marginBottom: 4 }}>
<span>{label}</span>
let dcmrtClassNames = `dcmrt-structure-set-item`;
if (selected) {
dcmrtClassNames += ' selected';
}
if (isDisabled) {
dcmrtClassNames += ' isDisabled';
}
const warningIcon = (
<span>
<Icon name="exclamation-triangle" />
</span>
);
const tableListItem = (
<TableListItem
key={index}
itemKey={index}
itemIndex={index}
itemClass={itemClass}
itemMeta={isDisabled ? warningIcon : <ColoredCircle color={color} />}
itemMetaClass="item-color-section"
onItemClick={() => {
if (isDisabled) {
return;
}
onClick();
}}
>
<div>
<div className="item-label" style={{ marginBottom: 4 }}>
<span>{label}</span>
{!isDisabled && (
<Icon
className={`eye-icon ${isVisible && '--visible'}`}
name={isVisible ? 'eye' : 'eye-closed'}
@ -54,37 +77,72 @@ const StructureSetItem = ({
height="20px"
onClick={event => {
event.stopPropagation();
if (isDisabled) {
return;
}
const newVisibility = !isVisible;
setIsVisible(newVisibility);
onVisibilityChange(newVisibility);
}}
/>
</div>
{false && <div className="item-info">{'...'}</div>}
{false && (
<div className="item-actions">
<button
className="btnAction"
onClick={() => console.log('Relabelling...')}
>
<span style={{ marginRight: '4px' }}>
<Icon name="edit" width="14px" height="14px" />
</span>
Relabel
</button>
<button
className="btnAction"
onClick={() => console.log('Editing description...')}
>
<span style={{ marginRight: '4px' }}>
<Icon name="edit" width="14px" height="14px" />
</span>
Description
</button>
</div>
)}
</div>
</TableListItem>
{false && <div className="item-info">{'...'}</div>}
{false && (
<div className="item-actions">
<button
className="btnAction"
onClick={() => console.log('Relabelling...')}
>
<span style={{ marginRight: '4px' }}>
<Icon name="edit" width="14px" height="14px" />
</span>
Relabel
</button>
<button
className="btnAction"
onClick={() => console.log('Editing description...')}
>
<span style={{ marginRight: '4px' }}>
<Icon name="edit" width="14px" height="14px" />
</span>
Description
</button>
</div>
)}
</div>
</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>
);
};
@ -99,7 +157,7 @@ StructureSetItem.propTypes = {
StructureSetItem.defaultProps = {
itemClass: '',
onClick: () => { },
onClick: () => {},
};
export default StructureSetItem;

View File

@ -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}
/>
);
};

View File

@ -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,
};

View File

@ -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"