Re #2571: thumbnail footer remove instance number and add link icon if any derived display set is present (#2582)
* Re #2571, thumbnail footer layout modifications: remove instance number and add link icon if any derived display set is present.
This commit is contained in:
parent
9481e2a99e
commit
8903adaea7
@ -25,11 +25,12 @@ function StudyBrowser(props) {
|
|||||||
altImageText,
|
altImageText,
|
||||||
displaySetInstanceUID,
|
displaySetInstanceUID,
|
||||||
imageId,
|
imageId,
|
||||||
InstanceNumber,
|
derivedDisplaySetsNumber,
|
||||||
numImageFrames,
|
numImageFrames,
|
||||||
SeriesDescription,
|
SeriesDescription,
|
||||||
SeriesNumber,
|
SeriesNumber,
|
||||||
hasWarnings,
|
hasWarnings,
|
||||||
|
hasDerivedDisplaySets,
|
||||||
} = thumb;
|
} = thumb;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -48,12 +49,13 @@ function StudyBrowser(props) {
|
|||||||
// Thumb
|
// Thumb
|
||||||
altImageText={altImageText}
|
altImageText={altImageText}
|
||||||
imageId={imageId}
|
imageId={imageId}
|
||||||
InstanceNumber={InstanceNumber}
|
derivedDisplaySetsNumber={derivedDisplaySetsNumber}
|
||||||
displaySetInstanceUID={displaySetInstanceUID} // used by drop
|
displaySetInstanceUID={displaySetInstanceUID} // used by drop
|
||||||
numImageFrames={numImageFrames}
|
numImageFrames={numImageFrames}
|
||||||
SeriesDescription={SeriesDescription}
|
SeriesDescription={SeriesDescription}
|
||||||
SeriesNumber={SeriesNumber}
|
SeriesNumber={SeriesNumber}
|
||||||
hasWarnings={hasWarnings}
|
hasWarnings={hasWarnings}
|
||||||
|
hasDerivedDisplaySets={hasDerivedDisplaySets}
|
||||||
// Events
|
// Events
|
||||||
onClick={onThumbnailClick.bind(
|
onClick={onThumbnailClick.bind(
|
||||||
undefined,
|
undefined,
|
||||||
@ -83,7 +85,7 @@ StudyBrowser.propTypes = {
|
|||||||
altImageText: PropTypes.string,
|
altImageText: PropTypes.string,
|
||||||
displaySetInstanceUID: PropTypes.string.isRequired,
|
displaySetInstanceUID: PropTypes.string.isRequired,
|
||||||
imageId: PropTypes.string,
|
imageId: PropTypes.string,
|
||||||
InstanceNumber: PropTypes.number,
|
derivedDisplaySetsNumber: PropTypes.number,
|
||||||
numImageFrames: PropTypes.number,
|
numImageFrames: PropTypes.number,
|
||||||
SeriesDescription: PropTypes.string,
|
SeriesDescription: PropTypes.string,
|
||||||
SeriesNumber: PropTypes.number,
|
SeriesNumber: PropTypes.number,
|
||||||
|
|||||||
@ -15,11 +15,12 @@ const StudyLoadingListener = classes.StudyLoadingListener;
|
|||||||
function ThumbnailFooter({
|
function ThumbnailFooter({
|
||||||
SeriesDescription,
|
SeriesDescription,
|
||||||
SeriesNumber,
|
SeriesNumber,
|
||||||
InstanceNumber,
|
|
||||||
numImageFrames,
|
numImageFrames,
|
||||||
hasWarnings,
|
hasWarnings,
|
||||||
|
hasDerivedDisplaySets,
|
||||||
}) {
|
}) {
|
||||||
const [inconsistencyWarnings, inconsistencyWarningsSet] = useState([]);
|
const [inconsistencyWarnings, inconsistencyWarningsSet] = useState([]);
|
||||||
|
const [derivedDisplaySetsActive, derivedDisplaySetsActiveSet] = useState([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let unmounted = false;
|
let unmounted = false;
|
||||||
@ -28,10 +29,15 @@ function ThumbnailFooter({
|
|||||||
inconsistencyWarningsSet(response);
|
inconsistencyWarningsSet(response);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
hasDerivedDisplaySets.then(response => {
|
||||||
|
if (!unmounted) {
|
||||||
|
derivedDisplaySetsActiveSet(response);
|
||||||
|
}
|
||||||
|
});
|
||||||
return () => {
|
return () => {
|
||||||
unmounted = true;
|
unmounted = true;
|
||||||
};
|
};
|
||||||
}, [hasWarnings]);
|
}, [hasWarnings, hasDerivedDisplaySets]);
|
||||||
|
|
||||||
const infoOnly = !SeriesDescription;
|
const infoOnly = !SeriesDescription;
|
||||||
|
|
||||||
@ -88,20 +94,47 @@ function ThumbnailFooter({
|
|||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getDerivedInfo = derivedDisplaySetsActive => {
|
||||||
|
return (
|
||||||
|
<React.Fragment>
|
||||||
|
{derivedDisplaySetsActive ? (
|
||||||
|
<div className="derived">
|
||||||
|
<Icon name="link" />
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<React.Fragment></React.Fragment>
|
||||||
|
)}
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const getSeriesInformation = (
|
const getSeriesInformation = (
|
||||||
SeriesNumber,
|
SeriesNumber,
|
||||||
InstanceNumber,
|
|
||||||
numImageFrames,
|
numImageFrames,
|
||||||
inconsistencyWarnings
|
inconsistencyWarnings,
|
||||||
|
derivedDisplaySetsActive
|
||||||
) => {
|
) => {
|
||||||
if (!SeriesNumber && !InstanceNumber && !numImageFrames) {
|
if (!SeriesNumber && !numImageFrames) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const seriesInformation = (
|
const seriesInformation = (
|
||||||
<div className="series-information">
|
<div className="series-information">
|
||||||
{getInfo(SeriesNumber, 'S:')}
|
<React.Fragment>
|
||||||
{getInfo(InstanceNumber, 'I:')}
|
{SeriesNumber !== undefined ? (
|
||||||
{getInfo(numImageFrames, '', 'image-frames')}
|
getInfo(SeriesNumber, 'S:')
|
||||||
|
) : (
|
||||||
|
<React.Fragment></React.Fragment>
|
||||||
|
)}
|
||||||
|
</React.Fragment>
|
||||||
|
<React.Fragment>
|
||||||
|
{numImageFrames !== undefined ? (
|
||||||
|
getInfo(numImageFrames, '', 'image-frames')
|
||||||
|
) : (
|
||||||
|
<React.Fragment></React.Fragment>
|
||||||
|
)}
|
||||||
|
</React.Fragment>
|
||||||
|
{getDerivedInfo(derivedDisplaySetsActive)}
|
||||||
{getWarningInfo(SeriesNumber, inconsistencyWarnings)}
|
{getWarningInfo(SeriesNumber, inconsistencyWarnings)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -114,9 +147,9 @@ function ThumbnailFooter({
|
|||||||
<div className="series-description">{SeriesDescription}</div>
|
<div className="series-description">{SeriesDescription}</div>
|
||||||
{getSeriesInformation(
|
{getSeriesInformation(
|
||||||
SeriesNumber,
|
SeriesNumber,
|
||||||
InstanceNumber,
|
|
||||||
numImageFrames,
|
numImageFrames,
|
||||||
inconsistencyWarnings
|
inconsistencyWarnings,
|
||||||
|
derivedDisplaySetsActive
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -130,11 +163,11 @@ function Thumbnail(props) {
|
|||||||
displaySetInstanceUID,
|
displaySetInstanceUID,
|
||||||
imageId,
|
imageId,
|
||||||
imageSrc,
|
imageSrc,
|
||||||
InstanceNumber,
|
|
||||||
numImageFrames,
|
numImageFrames,
|
||||||
SeriesDescription,
|
SeriesDescription,
|
||||||
SeriesNumber,
|
SeriesNumber,
|
||||||
hasWarnings,
|
hasWarnings,
|
||||||
|
hasDerivedDisplaySets,
|
||||||
StudyInstanceUID,
|
StudyInstanceUID,
|
||||||
onClick,
|
onClick,
|
||||||
onDoubleClick,
|
onDoubleClick,
|
||||||
@ -232,8 +265,8 @@ Thumbnail.propTypes = {
|
|||||||
altImageText: PropTypes.string,
|
altImageText: PropTypes.string,
|
||||||
SeriesDescription: PropTypes.string,
|
SeriesDescription: PropTypes.string,
|
||||||
SeriesNumber: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
SeriesNumber: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||||
InstanceNumber: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
||||||
hasWarnings: PropTypes.instanceOf(Promise),
|
hasWarnings: PropTypes.instanceOf(Promise),
|
||||||
|
hasDerivedDisplaySets: PropTypes.instanceOf(Promise),
|
||||||
numImageFrames: PropTypes.number,
|
numImageFrames: PropTypes.number,
|
||||||
onDoubleClick: PropTypes.func,
|
onDoubleClick: PropTypes.func,
|
||||||
onClick: PropTypes.func,
|
onClick: PropTypes.func,
|
||||||
|
|||||||
@ -23,6 +23,8 @@ import './Viewer.css';
|
|||||||
import StudyPrefetcher from '../components/StudyPrefetcher.js';
|
import StudyPrefetcher from '../components/StudyPrefetcher.js';
|
||||||
import StudyLoadingMonitor from '../components/StudyLoadingMonitor';
|
import StudyLoadingMonitor from '../components/StudyLoadingMonitor';
|
||||||
|
|
||||||
|
const { studyMetadataManager } = OHIF.utils;
|
||||||
|
|
||||||
class Viewer extends Component {
|
class Viewer extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
studies: PropTypes.arrayOf(
|
studies: PropTypes.arrayOf(
|
||||||
@ -429,6 +431,31 @@ class Viewer extends Component {
|
|||||||
|
|
||||||
export default withDialog(Viewer);
|
export default withDialog(Viewer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Async function to check if the displaySet has any derived one
|
||||||
|
*
|
||||||
|
* @param {*object} displaySet
|
||||||
|
* @param {*object} study
|
||||||
|
* @returns {bool}
|
||||||
|
*/
|
||||||
|
const _checkForDerivedDisplaySets = async function(displaySet, study) {
|
||||||
|
let derivedDisplaySetsNumber = 0;
|
||||||
|
if (
|
||||||
|
displaySet.Modality &&
|
||||||
|
!['SEG', 'SR', 'RTSTRUCT', 'RTDOSE'].includes(displaySet.Modality)
|
||||||
|
) {
|
||||||
|
const studyMetadata = studyMetadataManager.get(study.StudyInstanceUID);
|
||||||
|
|
||||||
|
const derivedDisplaySets = studyMetadata.getDerivedDatasets({
|
||||||
|
referencedSeriesInstanceUID: displaySet.SeriesInstanceUID,
|
||||||
|
});
|
||||||
|
|
||||||
|
derivedDisplaySetsNumber = derivedDisplaySets.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
return derivedDisplaySetsNumber > 0;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Async function to check if there are any inconsistences in the series.
|
* Async function to check if there are any inconsistences in the series.
|
||||||
*
|
*
|
||||||
@ -684,7 +711,6 @@ const _mapStudiesToThumbnails = function(studies, activeDisplaySetInstanceUID) {
|
|||||||
const {
|
const {
|
||||||
displaySetInstanceUID,
|
displaySetInstanceUID,
|
||||||
SeriesDescription,
|
SeriesDescription,
|
||||||
InstanceNumber,
|
|
||||||
numImageFrames,
|
numImageFrames,
|
||||||
SeriesNumber,
|
SeriesNumber,
|
||||||
} = displaySet;
|
} = displaySet;
|
||||||
@ -709,6 +735,11 @@ const _mapStudiesToThumbnails = function(studies, activeDisplaySetInstanceUID) {
|
|||||||
studies
|
studies
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const hasDerivedDisplaySets = _checkForDerivedDisplaySets(
|
||||||
|
displaySet,
|
||||||
|
study
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
active: _isDisplaySetActive(
|
active: _isDisplaySetActive(
|
||||||
displaySet,
|
displaySet,
|
||||||
@ -719,10 +750,10 @@ const _mapStudiesToThumbnails = function(studies, activeDisplaySetInstanceUID) {
|
|||||||
altImageText,
|
altImageText,
|
||||||
displaySetInstanceUID,
|
displaySetInstanceUID,
|
||||||
SeriesDescription,
|
SeriesDescription,
|
||||||
InstanceNumber,
|
|
||||||
numImageFrames,
|
numImageFrames,
|
||||||
SeriesNumber,
|
SeriesNumber,
|
||||||
hasWarnings,
|
hasWarnings,
|
||||||
|
hasDerivedDisplaySets,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user