feat(hp): enable OHIF to run with partial metadata for large studies at the cost of less effective hanging protocol (#3804)

Co-authored-by: rodrigobasilio2022 <rodrigo.basilio@radicalimaging.com>
Co-authored-by: rodrigobasilio2022 <114958722+rodrigobasilio2022@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2024-01-09 14:22:00 -05:00
1 parent b5cdf88a57
commit 0049f4c030
9 files changed
+240 -74

No files matched your search

@@ -214,6 +214,32 @@ export default class HangingProtocolService extends PubSubService {
};
}
/**
* Filters the series required for running a hanging protocol.
*
* This can be extended in the future with more complex selection rules e.g.
* N series of a given type, and M of a different type, such as all CT series,
* and all SR, and then everything else.
*
* @param protocolId - The ID of the hanging protocol.
* @param seriesPromises - An array of promises representing the series.
* @returns An object containing the required series and the remaining series.
*/
public filterSeriesRequiredForRun(protocolId, seriesPromises) {
if (Array.isArray(protocolId)) {
protocolId = protocolId[0];
}
const minSeriesLoadedToRunHP =
this.getProtocolById(protocolId)?.hpInitiationCriteria?.minSeriesLoaded ||
seriesPromises.length;
const requiredSeries = seriesPromises.slice(0, minSeriesLoadedToRunHP);
const remaining = seriesPromises.slice(minSeriesLoadedToRunHP);
return {
requiredSeries,
remaining,
};
}
/** Gets the protocol with id 'default' */
public getDefaultProtocol(): HangingProtocol.Protocol {
return this.getProtocolById('default');
@@ -543,8 +569,8 @@ export default class HangingProtocolService extends PubSubService {
viewportId: existingViewportId
? existingViewportId
: index === 0
? 'default'
: uuidv4(),
? 'default'
: uuidv4(),
},
displaySets: viewport.displaySets || [],
};
@@ -293,6 +293,17 @@ export type Protocol = {
*/
numberOfPriorsReferenced?: number;
syncDataForViewports?: boolean;
/**
* Set of minimal conditions necessary to run the hanging protocol.
*/
hpInitiationCriteria?: {
/* If configured, sets the minimum number of series needed to run the hanging
* protocol and start displaying images. Used when OHIF needs to handle studies
* with several series and it is required that the first image should be loaded
* faster.
*/
minSeriesLoaded: number;
};
};
/** Used to dynamically generate protocols.