From d65ebb217df54ca00fbdc4d818b8af2a1e616542 Mon Sep 17 00:00:00 2001 From: Sofien-Sellami Date: Fri, 28 Apr 2023 17:41:56 +0200 Subject: [PATCH 1/3] Remove filtered displaySets from parameter from study protocolEngine.findMatch() --- .../HangingProtocolService/HangingProtocolService.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts b/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts index a0a16fbc5e5..4846e0c309d 100644 --- a/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts +++ b/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts @@ -1303,15 +1303,13 @@ export default class HangingProtocolService extends PubSubService { this.studies.forEach(study => { // Skip non-active if active only if (matchActiveOnly && this.activeStudy !== study) return; - const studyDisplaySets = this.displaySets.filter( - it => it.StudyInstanceUID === study.StudyInstanceUID - ); + const studyMatchDetails = this.protocolEngine.findMatch( study, studyMatchingRules, { studies: this.studies, - displaySets: studyDisplaySets, + displaySets: this.displaySets, displaySetMatchDetails: this.displaySetMatchDetails, } ); @@ -1321,6 +1319,9 @@ export default class HangingProtocolService extends PubSubService { return; } + const studyDisplaySets = this.displaySets.filter( + it => it.StudyInstanceUID === study.StudyInstanceUID + ); this.debug( 'study', study.StudyInstanceUID, From bb07063030ad16e92c7ea4dab93f8804acaa7a1e Mon Sep 17 00:00:00 2001 From: Sofien-Sellami Date: Fri, 26 May 2023 14:55:36 +0200 Subject: [PATCH 2/3] adding studyDisplaySets --- .../HangingProtocolService.ts | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts b/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts index 327d717c964..a04f99fe782 100644 --- a/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts +++ b/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts @@ -1390,15 +1390,19 @@ export default class HangingProtocolService extends PubSubService { // Skip non-active if active only if (matchActiveOnly && this.activeStudy !== study) return; + const studyDisplaySets = this.displaySets.filter( + it => it.StudyInstanceUID === study.StudyInstanceUID + ); + const studyMatchDetails = this.protocolEngine.findMatch( - study, - studyMatchingRules, + study, + studyMatchingRules, { studies: this.studies, displaySets: this.displaySets, + studyDisplaySets: studyDisplaySets, displaySetMatchDetails: this.displaySetMatchDetails, } - ); // Prevent bestMatch from being updated if the matchDetails' required attribute check has failed @@ -1406,14 +1410,11 @@ export default class HangingProtocolService extends PubSubService { return; } - const studyDisplaySets = this.displaySets.filter( - it => it.StudyInstanceUID === study.StudyInstanceUID - ); this.debug( - 'study', - study.StudyInstanceUID, - 'display sets #', - studyDisplaySets.length + 'study', + study.StudyInstanceUID, + 'display sets #', + studyDisplaySets.length ); studyDisplaySets.forEach(displaySet => { const { @@ -1422,15 +1423,15 @@ export default class HangingProtocolService extends PubSubService { displaySetInstanceUID, } = displaySet; const seriesMatchDetails = this.protocolEngine.findMatch( - displaySet, - seriesMatchingRules, - // Todo: why we have images here since the matching type does not have it - { - studies: this.studies, - instance: displaySet.images?.[0], - displaySetMatchDetails: this.displaySetMatchDetails, - displaySets: studyDisplaySets, - } + displaySet, + seriesMatchingRules, + // Todo: why we have images here since the matching type does not have it + { + studies: this.studies, + instance: displaySet.images?.[0], + displaySetMatchDetails: this.displaySetMatchDetails, + displaySets: studyDisplaySets, + } ); // Prevent bestMatch from being updated if the matchDetails' required attribute check has failed From 53f51cf5213c2ad00fe8be3f3274f494e8dc51cd Mon Sep 17 00:00:00 2001 From: Sofien-Sellami Date: Fri, 2 Jun 2023 15:30:23 +0200 Subject: [PATCH 3/3] Refact --- .../services/HangingProtocolService/HangingProtocolService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts b/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts index a04f99fe782..4f469d46d14 100644 --- a/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts +++ b/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts @@ -1399,8 +1399,8 @@ export default class HangingProtocolService extends PubSubService { studyMatchingRules, { studies: this.studies, - displaySets: this.displaySets, - studyDisplaySets: studyDisplaySets, + displaySets: studyDisplaySets, + allDisplaySets: this.displaySets, displaySetMatchDetails: this.displaySetMatchDetails, } );