RTSTRUCT does not apply to the specific image series, the button and the panel should not be shown
This commit is contained in:
parent
efde6ed20e
commit
77c7463c53
@ -5,6 +5,9 @@ import id from './id.js';
|
|||||||
import RTPanel from './components/RTPanel/RTPanel';
|
import RTPanel from './components/RTPanel/RTPanel';
|
||||||
import { version } from '../package.json';
|
import { version } from '../package.json';
|
||||||
|
|
||||||
|
import { utils } from '@ohif/core';
|
||||||
|
const { studyMetadataManager } = utils;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
/**
|
/**
|
||||||
* Only required property. Should be a unique value across all extensions.
|
* Only required property. Should be a unique value across all extensions.
|
||||||
@ -45,24 +48,34 @@ export default {
|
|||||||
icon: 'list',
|
icon: 'list',
|
||||||
label: 'RTSTRUCT',
|
label: 'RTSTRUCT',
|
||||||
target: 'rt-panel',
|
target: 'rt-panel',
|
||||||
isDisabled: studies => {
|
isDisabled: (studies, activeViewport) => {
|
||||||
if (!studies) {
|
if (!studies) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < studies.length; i++) {
|
if (activeViewport) {
|
||||||
const study = studies[i];
|
const study = studies.find(
|
||||||
|
s => s.StudyInstanceUID === activeViewport.StudyInstanceUID
|
||||||
if (study && study.series) {
|
);
|
||||||
for (let j = 0; j < study.series.length; j++) {
|
const ds = study.displaySets.find(
|
||||||
const series = study.series[j];
|
ds =>
|
||||||
if (
|
ds.displaySetInstanceUID ===
|
||||||
/* Could be expanded to contain RTPLAN and RTDOSE information in the future */
|
activeViewport.displaySetInstanceUID
|
||||||
['RTSTRUCT'].includes(series.Modality)
|
);
|
||||||
) {
|
const studyMetadata = studyMetadataManager.get(
|
||||||
return false;
|
activeViewport.StudyInstanceUID
|
||||||
}
|
);
|
||||||
}
|
const referencedDisplaySets = studyMetadata.getDerivedDatasets({
|
||||||
|
referencedSeriesInstanceUID: activeViewport.SeriesInstanceUID,
|
||||||
|
Modality: 'RTSTRUCT',
|
||||||
|
});
|
||||||
|
if (
|
||||||
|
referencedDisplaySets &&
|
||||||
|
referencedDisplaySets.some(ds =>
|
||||||
|
['RTSTRUCT'].includes(ds.Modality)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -86,7 +86,7 @@ class ToolbarRow extends Component {
|
|||||||
// Note: This does not cleanly handle `studies` prop updating with panel open
|
// Note: This does not cleanly handle `studies` prop updating with panel open
|
||||||
const isDisabled =
|
const isDisabled =
|
||||||
typeof menuOption.isDisabled === 'function' &&
|
typeof menuOption.isDisabled === 'function' &&
|
||||||
menuOption.isDisabled(this.props.studies);
|
menuOption.isDisabled(this.props.studies, this.props.activeViewport);
|
||||||
|
|
||||||
if (hasActiveContext && !isDisabled) {
|
if (hasActiveContext && !isDisabled) {
|
||||||
const menuOptionEntry = {
|
const menuOptionEntry = {
|
||||||
@ -114,25 +114,30 @@ class ToolbarRow extends Component {
|
|||||||
prevProps.activeContexts !== this.props.activeContexts;
|
prevProps.activeContexts !== this.props.activeContexts;
|
||||||
|
|
||||||
const prevStudies = prevProps.studies;
|
const prevStudies = prevProps.studies;
|
||||||
|
const prevActiveViewport = prevProps.activeViewport;
|
||||||
|
const activeViewport = this.props.activeViewport;
|
||||||
const studies = this.props.studies;
|
const studies = this.props.studies;
|
||||||
const seriesPerStudyCount = this.seriesPerStudyCount;
|
const seriesPerStudyCount = this.seriesPerStudyCount;
|
||||||
|
|
||||||
let studiesUpdated = false;
|
let shouldUpdate = false;
|
||||||
|
|
||||||
if (prevStudies.length !== studies.length) {
|
if (
|
||||||
studiesUpdated = true;
|
prevStudies.length !== studies.length ||
|
||||||
|
prevActiveViewport !== activeViewport
|
||||||
|
) {
|
||||||
|
shouldUpdate = true;
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < studies.length; i++) {
|
for (let i = 0; i < studies.length; i++) {
|
||||||
if (studies[i].series.length !== seriesPerStudyCount[i]) {
|
if (studies[i].series.length !== seriesPerStudyCount[i]) {
|
||||||
seriesPerStudyCount[i] = studies[i].series.length;
|
seriesPerStudyCount[i] = studies[i].series.length;
|
||||||
|
|
||||||
studiesUpdated = true;
|
shouldUpdate = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (studiesUpdated) {
|
if (shouldUpdate) {
|
||||||
this.updateButtonGroups();
|
this.updateButtonGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -268,6 +268,9 @@ class Viewer extends Component {
|
|||||||
{/* TOOLBAR */}
|
{/* TOOLBAR */}
|
||||||
<ErrorBoundaryDialog context="ToolbarRow">
|
<ErrorBoundaryDialog context="ToolbarRow">
|
||||||
<ToolbarRow
|
<ToolbarRow
|
||||||
|
activeViewport={
|
||||||
|
this.props.viewports[this.props.activeViewportIndex]
|
||||||
|
}
|
||||||
isLeftSidePanelOpen={this.state.isLeftSidePanelOpen}
|
isLeftSidePanelOpen={this.state.isLeftSidePanelOpen}
|
||||||
isRightSidePanelOpen={this.state.isRightSidePanelOpen}
|
isRightSidePanelOpen={this.state.isRightSidePanelOpen}
|
||||||
selectedLeftSidePanel={
|
selectedLeftSidePanel={
|
||||||
@ -320,11 +323,11 @@ class Viewer extends Component {
|
|||||||
activeIndex={this.props.activeViewportIndex}
|
activeIndex={this.props.activeViewportIndex}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<ConnectedStudyBrowser
|
<ConnectedStudyBrowser
|
||||||
studies={this.state.thumbnails}
|
studies={this.state.thumbnails}
|
||||||
studyMetadata={this.props.studies}
|
studyMetadata={this.props.studies}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</SidePanel>
|
</SidePanel>
|
||||||
</ErrorBoundaryDialog>
|
</ErrorBoundaryDialog>
|
||||||
|
|
||||||
@ -347,7 +350,9 @@ class Viewer extends Component {
|
|||||||
viewports={this.props.viewports}
|
viewports={this.props.viewports}
|
||||||
studies={this.props.studies}
|
studies={this.props.studies}
|
||||||
activeIndex={this.props.activeViewportIndex}
|
activeIndex={this.props.activeViewportIndex}
|
||||||
activeViewport={this.props.viewports[this.props.activeViewportIndex]}
|
activeViewport={
|
||||||
|
this.props.viewports[this.props.activeViewportIndex]
|
||||||
|
}
|
||||||
getActiveViewport={this._getActiveViewport}
|
getActiveViewport={this._getActiveViewport}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@ -371,7 +376,7 @@ export default withDialog(Viewer);
|
|||||||
* @param {Study[]} studies
|
* @param {Study[]} studies
|
||||||
* @param {DisplaySet[]} studies[].displaySets
|
* @param {DisplaySet[]} studies[].displaySets
|
||||||
*/
|
*/
|
||||||
const _mapStudiesToThumbnails = function (studies) {
|
const _mapStudiesToThumbnails = function(studies) {
|
||||||
return studies.map(study => {
|
return studies.map(study => {
|
||||||
const { StudyInstanceUID } = study;
|
const { StudyInstanceUID } = study;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user