fix: 🐛 Load default display set when no time metadata (#1684)
* fix: 🐛 Load default display set when no time metadata Load default displayset (first item in the array) when no series date or series time availalbe ✅ Closes: #1683 * Add batch update * Fix tests. Co-authored-by: James Petts <jamesapetts@gmail.com>
This commit is contained in:
parent
79fe442293
commit
f7b8b6a41c
@ -190,7 +190,7 @@ const RTPanel = ({ studies, viewports, activeIndex, isOpen, onContourItemClick }
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{!state.referencedDisplaysets.length && <LoadingIndicator expand height="70px" width="70px" />}
|
{!state.referencedDisplaysets.length && <LoadingIndicator expand height="70px" width="70px" />}
|
||||||
{state.referencedDisplaysets.map(displaySet => {
|
{state.sets && state.referencedDisplaysets.map(displaySet => {
|
||||||
const { SeriesInstanceUID, metadata, isLoaded } = displaySet;
|
const { SeriesInstanceUID, metadata, isLoaded } = displaySet;
|
||||||
|
|
||||||
const module = cornerstoneTools.getModule('rtstruct');
|
const module = cornerstoneTools.getModule('rtstruct');
|
||||||
@ -205,9 +205,14 @@ const RTPanel = ({ studies, viewports, activeIndex, isOpen, onContourItemClick }
|
|||||||
visible={isLoaded && loadedSet.visible}
|
visible={isLoaded && loadedSet.visible}
|
||||||
hideVisibleButton={!isLoaded}
|
hideVisibleButton={!isLoaded}
|
||||||
expanded={isLoaded && loadedSet.SeriesInstanceUID === state.selectedSet.SeriesInstanceUID}
|
expanded={isLoaded && loadedSet.SeriesInstanceUID === state.selectedSet.SeriesInstanceUID}
|
||||||
onVisibilityChange={() => {
|
onVisibilityChange={newVisibility => {
|
||||||
const module = cornerstoneTools.getModule('rtstruct');
|
const module = cornerstoneTools.getModule('rtstruct');
|
||||||
module.setters.toggleStructureSet(SeriesInstanceUID);
|
loadedSet.ROIContours.forEach(({ ROINumber }) => {
|
||||||
|
module.setters.toggleROIContour(loadedSet.SeriesInstanceUID, ROINumber);
|
||||||
|
});
|
||||||
|
const sets = module.getters.structuresSetsWhichReferenceSeriesInstanceUid(viewports[activeIndex].SeriesInstanceUID);
|
||||||
|
setState(state => ({ ...state, sets }));
|
||||||
|
refreshViewport();
|
||||||
}}
|
}}
|
||||||
onExpandChange={async () => {
|
onExpandChange={async () => {
|
||||||
if (!isLoaded) {
|
if (!isLoaded) {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React, { useState } 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 } from '@ohif/ui';
|
||||||
|
|
||||||
@ -28,6 +28,11 @@ const StructureSetItem = ({
|
|||||||
selected = false,
|
selected = false,
|
||||||
}) => {
|
}) => {
|
||||||
const [isVisible, setIsVisible] = useState(visible);
|
const [isVisible, setIsVisible] = useState(visible);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setIsVisible(visible);
|
||||||
|
}, [visible])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`dcmrt-structure-set-item ${selected && 'selected'}`}>
|
<div className={`dcmrt-structure-set-item ${selected && 'selected'}`}>
|
||||||
<TableListItem
|
<TableListItem
|
||||||
|
|||||||
@ -90,7 +90,7 @@ const loadAndCacheDerivedDisplaySets = (referencedDisplaySet, studies) => {
|
|||||||
|
|
||||||
// find most recent and load it.
|
// find most recent and load it.
|
||||||
let recentDateTime = 0;
|
let recentDateTime = 0;
|
||||||
let recentDisplaySet;
|
let recentDisplaySet = displaySets[0];
|
||||||
|
|
||||||
displaySets.forEach(displaySet => {
|
displaySets.forEach(displaySet => {
|
||||||
const dateTime = Number(
|
const dateTime = Number(
|
||||||
|
|||||||
@ -22,7 +22,7 @@ describe('OHIF Study List', function() {
|
|||||||
//Wait result list to be displayed
|
//Wait result list to be displayed
|
||||||
cy.waitStudyList();
|
cy.waitStudyList();
|
||||||
cy.get('@searchResult').should($list => {
|
cy.get('@searchResult').should($list => {
|
||||||
expect($list.length).to.be.eq(2);
|
expect($list.length).to.be.eq(3);
|
||||||
expect($list).to.contain('Juno');
|
expect($list).to.contain('Juno');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -127,7 +127,7 @@ describe('OHIF Study List', function() {
|
|||||||
//Wait result list to be displayed
|
//Wait result list to be displayed
|
||||||
cy.waitStudyList();
|
cy.waitStudyList();
|
||||||
cy.get('@searchResult').should($list => {
|
cy.get('@searchResult').should($list => {
|
||||||
expect($list.length).to.be.eq(2);
|
expect($list.length).to.be.eq(3);
|
||||||
expect($list).to.contain('Juno');
|
expect($list).to.contain('Juno');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -137,7 +137,7 @@ describe('OHIF Study List', function() {
|
|||||||
//Wait result list to be displayed
|
//Wait result list to be displayed
|
||||||
cy.waitStudyList();
|
cy.waitStudyList();
|
||||||
cy.get('@searchResult').should($list => {
|
cy.get('@searchResult').should($list => {
|
||||||
expect($list.length).to.be.eq(2);
|
expect($list.length).to.be.eq(6);
|
||||||
expect($list).to.contain('ProstateX-0000');
|
expect($list).to.contain('ProstateX-0000');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user