feat(handler): Add handler for unsupported sopclassUIDs (#3601)
This commit is contained in:
1 parent
de6976df3b
commit
f845f87716
16 files changed
+180
-64
No files matched your search
@@ -131,7 +131,7 @@ function PanelStudyBrowser({
|
||||
const imageId = imageIds[Math.floor(imageIds.length / 2)];
|
||||
|
||||
// TODO: Is it okay that imageIds are not returned here for SR displaySets?
|
||||
if (imageId) {
|
||||
if (imageId && !displaySet?.unsupported) {
|
||||
// When the image arrives, render it and store the result in the thumbnailImgSrcMap
|
||||
newImageSrcEntry[dSet.displaySetInstanceUID] = await getImageSrc(
|
||||
imageId
|
||||
@@ -175,20 +175,22 @@ function PanelStudyBrowser({
|
||||
const displaySet = displaySetService.getDisplaySetByUID(
|
||||
dSet.displaySetInstanceUID
|
||||
);
|
||||
const imageIds = dataSource.getImageIdsForDisplaySet(displaySet);
|
||||
const imageId = imageIds[Math.floor(imageIds.length / 2)];
|
||||
if (!displaySet?.unsupported) {
|
||||
const imageIds = dataSource.getImageIdsForDisplaySet(displaySet);
|
||||
const imageId = imageIds[Math.floor(imageIds.length / 2)];
|
||||
|
||||
// TODO: Is it okay that imageIds are not returned here for SR displaysets?
|
||||
if (imageId) {
|
||||
// When the image arrives, render it and store the result in the thumbnailImgSrcMap
|
||||
newImageSrcEntry[dSet.displaySetInstanceUID] = await getImageSrc(
|
||||
imageId,
|
||||
dSet.initialViewport
|
||||
);
|
||||
if (isMounted.current) {
|
||||
setThumbnailImageSrcMap(prevState => {
|
||||
return { ...prevState, ...newImageSrcEntry };
|
||||
});
|
||||
// TODO: Is it okay that imageIds are not returned here for SR displaysets?
|
||||
if (imageId) {
|
||||
// When the image arrives, render it and store the result in the thumbnailImgSrcMap
|
||||
newImageSrcEntry[dSet.displaySetInstanceUID] = await getImageSrc(
|
||||
imageId,
|
||||
dSet.initialViewport
|
||||
);
|
||||
if (isMounted.current) {
|
||||
setThumbnailImageSrcMap(prevState => {
|
||||
return { ...prevState, ...newImageSrcEntry };
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -308,7 +310,7 @@ function _mapDisplaySets(displaySets, thumbnailImageSrcMap) {
|
||||
.filter(ds => !ds.excludeFromThumbnailBrowser)
|
||||
.forEach(ds => {
|
||||
const imageSrc = thumbnailImageSrcMap[ds.displaySetInstanceUID];
|
||||
const componentType = _getComponentType(ds.Modality);
|
||||
const componentType = _getComponentType(ds);
|
||||
|
||||
const array =
|
||||
componentType === 'thumbnail'
|
||||
@@ -348,8 +350,8 @@ const thumbnailNoImageModalities = [
|
||||
'RTDOSE',
|
||||
];
|
||||
|
||||
function _getComponentType(Modality) {
|
||||
if (thumbnailNoImageModalities.includes(Modality)) {
|
||||
function _getComponentType(ds) {
|
||||
if (thumbnailNoImageModalities.includes(ds.Modality) || ds?.unsupported) {
|
||||
// TODO probably others.
|
||||
return 'thumbnailNoImage';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import ImageSet from '@ohif/core/src/classes/ImageSet';
|
||||
import { DisplaySetMessage, DisplaySetMessageList } from '@ohif/core';
|
||||
/**
|
||||
* Default handler for a instance list with an unsupported sopClassUID
|
||||
*/
|
||||
export default function getDisplaySetsFromUnsupportedSeries(instances) {
|
||||
const imageSet = new ImageSet(instances);
|
||||
const messages = new DisplaySetMessageList();
|
||||
messages.addMessage(DisplaySetMessage.CODES.UNSUPPORTED_DISPLAYSET);
|
||||
const instance = instances[0];
|
||||
|
||||
imageSet.setAttributes({
|
||||
displaySetInstanceUID: imageSet.uid, // create a local alias for the imageSet UID
|
||||
SeriesDate: instance.SeriesDate,
|
||||
SeriesTime: instance.SeriesTime,
|
||||
SeriesInstanceUID: instance.SeriesInstanceUID,
|
||||
StudyInstanceUID: instance.StudyInstanceUID,
|
||||
SeriesNumber: instance.SeriesNumber || 0,
|
||||
FrameRate: instance.FrameTime,
|
||||
SOPClassUID: instance.SOPClassUID,
|
||||
SeriesDescription: instance.SeriesDescription || '',
|
||||
Modality: instance.Modality,
|
||||
numImageFrames: instances.length,
|
||||
unsupported: true,
|
||||
SOPClassHandlerId: 'unsupported',
|
||||
isReconstructable: false,
|
||||
messages,
|
||||
});
|
||||
return [imageSet];
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import ImageSet from '@ohif/core/src/classes/ImageSet';
|
||||
import isDisplaySetReconstructable from '@ohif/core/src/utils/isDisplaySetReconstructable';
|
||||
import { id } from './id';
|
||||
import getDisplaySetMessages from './getDisplaySetMessages';
|
||||
import getDisplaySetsFromUnsupportedSeries from './getDisplaySetsFromUnsupportedSeries';
|
||||
|
||||
const sopClassHandlerName = 'stack';
|
||||
|
||||
@@ -213,6 +214,11 @@ function getSopClassHandlerModule() {
|
||||
sopClassUids,
|
||||
getDisplaySetsFromSeries,
|
||||
},
|
||||
{
|
||||
name: 'not-supported-display-sets-handler',
|
||||
sopClassUids: [],
|
||||
getDisplaySetsFromSeries: getDisplaySetsFromUnsupportedSeries,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user