feat: Improve unsupported displayset messages (#4979)

This commit is contained in:
Devu-trenser authored and GitHub committed 2025-04-22 09:11:28 -04:00
1 parent 59136e5435
commit 3b8faa8a76
3 files changed
+28 -7

No files matched your search

@@ -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<string, any>} args - message arguments, will be passed to the translation function when the message is rendered.
*/
class DisplaySetMessage {
id: number;
args: Record<string, any>;
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<string, any> = {}) {
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<string, any> = {}): 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));
}
}