feat(hp priors): Study comparison hanging protocol (#3579)

This commit is contained in:
Bill Wallace authored and GitHub committed 2023-08-16 10:15:12 -04:00
1 parent ecbe7c56e0
commit 53c16b928f
13 files changed
+337 -45

No files matched your search

@@ -2,7 +2,6 @@ import HangingProtocolService from './HangingProtocolService';
const testProtocol = {
id: 'test',
hasUpdatedPriorsInformation: false,
name: 'Default',
protocolMatchingRules: [
{
@@ -161,6 +161,9 @@ export default class HangingProtocolService extends PubSubService {
this.studies = [];
this.viewportMatchDetails = new Map();
this.displaySetMatchDetails = new Map();
this.protocol = undefined;
this.stageIndex = undefined;
this.protocolEngine = undefined;
}
/** Leave the hanging protocol in the initialized state */
@@ -908,7 +911,7 @@ export default class HangingProtocolService extends PubSubService {
const stage = stages[i];
if (stage.id === stageId && stage.status !== 'disabled') {
return i;
}
}
}
return;
}
@@ -1221,7 +1224,7 @@ export default class HangingProtocolService extends PubSubService {
for (const subMatch of match.matchingScores) {
if (subMatch.displaySetInstanceUID === displaySetUID) {
return;
}
}
}
throw new Error(
`Reused viewport details ${id} with ds ${displaySetUID} not valid`
@@ -1421,25 +1424,26 @@ export default class HangingProtocolService extends PubSubService {
seriesMatchingRules
);
const matchActiveOnly = this.protocol.numberOfPriorsReferenced === -1;
this.studies.forEach(study => {
this.studies.forEach((study, studyInstanceUIDsIndex) => {
// Skip non-active if active only
if (matchActiveOnly && this.activeStudy !== study) {
return;
}
const studyDisplaySets = this.displaySets.filter(
it => it.StudyInstanceUID === study.StudyInstanceUID
it => it.StudyInstanceUID === study.StudyInstanceUID
);
const studyMatchDetails = this.protocolEngine.findMatch(
study,
studyMatchingRules,
{
studies: this.studies,
displaySets: studyDisplaySets,
allDisplaySets: this.displaySets,
displaySetMatchDetails: this.displaySetMatchDetails,
}
study,
studyMatchingRules,
{
studies: this.studies,
displaySets: studyDisplaySets,
allDisplaySets: this.displaySets,
displaySetMatchDetails: this.displaySetMatchDetails,
studyInstanceUIDsIndex,
}
);
// Prevent bestMatch from being updated if the matchDetails' required attribute check has failed
@@ -1448,10 +1452,10 @@ export default class HangingProtocolService extends PubSubService {
}
this.debug(
'study',
study.StudyInstanceUID,
'display sets #',
studyDisplaySets.length
'study',
study.StudyInstanceUID,
'display sets #',
studyDisplaySets.length
);
studyDisplaySets.forEach(displaySet => {
const {
@@ -1460,15 +1464,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
+3 -2
View File
@@ -270,7 +270,6 @@ export type Protocol = {
stages: ProtocolStage[];
// Optional
locked?: boolean;
hasUpdatedPriorsInformation?: boolean;
name?: string;
createdDate?: string;
modifiedDate?: string;
@@ -284,7 +283,9 @@ export type Protocol = {
/* The number of priors required for this hanging protocol.
* -1 means that NO priors are referenced, and thus this HP matches
* only the active study, whereas 0 means that an unknown number of
* priors is matched.
* priors is matched. Positive values mean at least that many priors are
* required.
* Replaces hasUpdatedPriors
*/
numberOfPriorsReferenced?: number;
syncDataForViewports?: boolean;