From 3b8faa8a76dde5088815431a947fec07db4a3c7f Mon Sep 17 00:00:00 2001 From: Devu-trenser <91659097+Devu-trenser@users.noreply.github.com> Date: Tue, 22 Apr 2025 18:41:28 +0530 Subject: [PATCH] feat: Improve unsupported displayset messages (#4979) --- .../src/getDisplaySetsFromUnsupportedSeries.js | 14 +++++++++++++- .../DisplaySetService/DisplaySetMessage.ts | 17 ++++++++++++----- platform/i18n/src/locales/en-US/Messages.json | 4 +++- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/extensions/default/src/getDisplaySetsFromUnsupportedSeries.js b/extensions/default/src/getDisplaySetsFromUnsupportedSeries.js index d2da6f5bb..d5329a427 100644 --- a/extensions/default/src/getDisplaySetsFromUnsupportedSeries.js +++ b/extensions/default/src/getDisplaySetsFromUnsupportedSeries.js @@ -6,9 +6,21 @@ import { DisplaySetMessage, DisplaySetMessageList } from '@ohif/core'; export default function getDisplaySetsFromUnsupportedSeries(instances) { const imageSet = new ImageSet(instances); const messages = new DisplaySetMessageList(); - messages.addMessage(DisplaySetMessage.CODES.UNSUPPORTED_DISPLAYSET); const instance = instances[0]; + if (!instances.length) { + messages.addMessage(DisplaySetMessage.CODES.NO_VALID_INSTANCES); + } else { + const sopClassUid = instance.SOPClassUID; + if (sopClassUid) { + messages.addMessage(DisplaySetMessage.CODES.UNSUPPORTED_SOP_CLASS_UID, { + sopClassUid, + }); + } else { + messages.addMessage(DisplaySetMessage.CODES.MISSING_SOP_CLASS_UID); + } + } + imageSet.setAttributes({ displaySetInstanceUID: imageSet.uid, // create a local alias for the imageSet UID SeriesDate: instance.SeriesDate, diff --git a/platform/core/src/services/DisplaySetService/DisplaySetMessage.ts b/platform/core/src/services/DisplaySetService/DisplaySetMessage.ts index 6a139daf6..cbc019ff9 100644 --- a/platform/core/src/services/DisplaySetService/DisplaySetMessage.ts +++ b/platform/core/src/services/DisplaySetService/DisplaySetMessage.ts @@ -1,8 +1,12 @@ /** - * Defines a displaySet message, that could be any pf the potential problems of a displaySet + * Defines a displaySet message, that could be any pf the potential problems of a displaySet. + * + * @property {number} id - message ID. + * @property {Record} args - message arguments, will be passed to the translation function when the message is rendered. */ class DisplaySetMessage { id: number; + args: Record; static CODES = { NO_VALID_INSTANCES: 1, NO_POSITION_INFORMATION: 2, @@ -17,10 +21,13 @@ class DisplaySetMessage { INCONSISTENT_ORIENTATIONS: 11, INCONSISTENT_POSITION_INFORMATION: 12, UNSUPPORTED_DISPLAYSET: 13, + UNSUPPORTED_SOP_CLASS_UID: 14, + MISSING_SOP_CLASS_UID: 15, }; - constructor(id: number) { + constructor(id: number, args: Record = {}) { this.id = id; + this.args = args; } } /** @@ -29,8 +36,8 @@ class DisplaySetMessage { class DisplaySetMessageList { messages = []; - public addMessage(messageId: number): void { - const message = new DisplaySetMessage(messageId); + public addMessage(messageId: number, args: Record = {}): void { + const message = new DisplaySetMessage(messageId, args); this.messages.push(message); } @@ -43,7 +50,7 @@ class DisplaySetMessageList { } public includesAllMessages(messageIdList: number[]): boolean { - return messageIdList.every(messageId => this.include(messageId)); + return messageIdList.every(messageId => this.includesMessage(messageId)); } } diff --git a/platform/i18n/src/locales/en-US/Messages.json b/platform/i18n/src/locales/en-US/Messages.json index 931bd939a..f656dccd9 100644 --- a/platform/i18n/src/locales/en-US/Messages.json +++ b/platform/i18n/src/locales/en-US/Messages.json @@ -12,5 +12,7 @@ "10": "Display set has frames with inconsistent number of components.", "11": "Display set has frames with inconsistent orientations.", "12": "Display set has inconsistent position information.", - "13": "Unsupported display set." + "13": "Unsupported display set.", + "14": "SOP Class UID {{ sopClassUid }} is not supported.", + "15": "Display Set is missing a SOP Class UID. Please check the file." }