feat(hangingProtocols): added selection of the HangingProtocol stage from the url (#4310)
This commit is contained in:
parent
e8f9345b93
commit
fa2435d5e9
@ -20,6 +20,7 @@ import {
|
|||||||
*/
|
*/
|
||||||
const stage1 = {
|
const stage1 = {
|
||||||
name: 'default',
|
name: 'default',
|
||||||
|
id: 'default',
|
||||||
viewportStructure: {
|
viewportStructure: {
|
||||||
layoutType: 'grid',
|
layoutType: 'grid',
|
||||||
properties: {
|
properties: {
|
||||||
@ -112,6 +113,7 @@ const stage1 = {
|
|||||||
*/
|
*/
|
||||||
const stage2 = {
|
const stage2 = {
|
||||||
name: 'Fusion 2x2',
|
name: 'Fusion 2x2',
|
||||||
|
id: 'Fusion-2x2',
|
||||||
viewportStructure: {
|
viewportStructure: {
|
||||||
layoutType: 'grid',
|
layoutType: 'grid',
|
||||||
properties: {
|
properties: {
|
||||||
@ -131,6 +133,7 @@ const stage2 = {
|
|||||||
*/
|
*/
|
||||||
const stage3 = {
|
const stage3 = {
|
||||||
name: '2x3-layout',
|
name: '2x3-layout',
|
||||||
|
id: '2x3-layout',
|
||||||
viewportStructure: {
|
viewportStructure: {
|
||||||
layoutType: 'grid',
|
layoutType: 'grid',
|
||||||
properties: {
|
properties: {
|
||||||
@ -152,6 +155,7 @@ const stage3 = {
|
|||||||
*/
|
*/
|
||||||
const stage4 = {
|
const stage4 = {
|
||||||
name: '2x4-layout',
|
name: '2x4-layout',
|
||||||
|
id: '2x4-layout',
|
||||||
viewportStructure: {
|
viewportStructure: {
|
||||||
layoutType: 'grid',
|
layoutType: 'grid',
|
||||||
properties: {
|
properties: {
|
||||||
|
|||||||
@ -66,6 +66,7 @@ export default function ModeRoute({
|
|||||||
const { extensions, sopClassHandlers, hotkeys: hotkeyObj, hangingProtocol } = mode;
|
const { extensions, sopClassHandlers, hotkeys: hotkeyObj, hangingProtocol } = mode;
|
||||||
|
|
||||||
const runTimeHangingProtocolId = lowerCaseSearchParams.get('hangingprotocolid');
|
const runTimeHangingProtocolId = lowerCaseSearchParams.get('hangingprotocolid');
|
||||||
|
const runTimeStageId = lowerCaseSearchParams.get('stageid');
|
||||||
const token = lowerCaseSearchParams.get('token');
|
const token = lowerCaseSearchParams.get('token');
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
@ -216,6 +217,16 @@ export default function ModeRoute({
|
|||||||
? runTimeHangingProtocolId
|
? runTimeHangingProtocolId
|
||||||
: hangingProtocol;
|
: hangingProtocol;
|
||||||
|
|
||||||
|
// Determine the index of the stageId if the hangingProtocolIdToUse is defined
|
||||||
|
const stageIndex = hangingProtocolIdToUse
|
||||||
|
? hangingProtocolService.getStageIndex(hangingProtocolIdToUse, {
|
||||||
|
stageId: runTimeStageId || undefined,
|
||||||
|
})
|
||||||
|
: -1;
|
||||||
|
// Ensure that the stage index is never negative
|
||||||
|
// If stageIndex is negative (e.g., if stage wasn't found), use 0 as the default
|
||||||
|
const stageIndexToUse = Math.max(0, stageIndex);
|
||||||
|
|
||||||
// Sets the active hanging protocols - if hangingProtocol is undefined,
|
// Sets the active hanging protocols - if hangingProtocol is undefined,
|
||||||
// resets to default. Done before the onModeEnter to allow the onModeEnter
|
// resets to default. Done before the onModeEnter to allow the onModeEnter
|
||||||
// to perform custom hanging protocol actions
|
// to perform custom hanging protocol actions
|
||||||
@ -265,7 +276,8 @@ export default function ModeRoute({
|
|||||||
dataSource,
|
dataSource,
|
||||||
filters,
|
filters,
|
||||||
},
|
},
|
||||||
hangingProtocolIdToUse
|
hangingProtocolIdToUse,
|
||||||
|
stageIndexToUse
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +289,8 @@ export default function ModeRoute({
|
|||||||
filters,
|
filters,
|
||||||
appConfig,
|
appConfig,
|
||||||
},
|
},
|
||||||
hangingProtocolIdToUse
|
hangingProtocolIdToUse,
|
||||||
|
stageIndexToUse
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,8 @@ const { sortingCriteria, getSplitParam } = utils;
|
|||||||
*/
|
*/
|
||||||
export async function defaultRouteInit(
|
export async function defaultRouteInit(
|
||||||
{ servicesManager, studyInstanceUIDs, dataSource, filters, appConfig }: withAppTypes,
|
{ servicesManager, studyInstanceUIDs, dataSource, filters, appConfig }: withAppTypes,
|
||||||
hangingProtocolId
|
hangingProtocolId,
|
||||||
|
stageIndex
|
||||||
) {
|
) {
|
||||||
const { displaySetService, hangingProtocolService, uiNotificationService, customizationService } =
|
const { displaySetService, hangingProtocolService, uiNotificationService, customizationService } =
|
||||||
servicesManager.services;
|
servicesManager.services;
|
||||||
@ -41,7 +42,9 @@ export async function defaultRouteInit(
|
|||||||
|
|
||||||
// run the hanging protocol matching on the displaySets with the predefined
|
// run the hanging protocol matching on the displaySets with the predefined
|
||||||
// hanging protocol in the mode configuration
|
// hanging protocol in the mode configuration
|
||||||
hangingProtocolService.run({ studies, activeStudy, displaySets }, hangingProtocolId);
|
hangingProtocolService.run({ studies, activeStudy, displaySets }, hangingProtocolId, {
|
||||||
|
stageIndex,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsubscriptions = [];
|
const unsubscriptions = [];
|
||||||
|
|||||||
@ -394,7 +394,7 @@ export default class HangingProtocolService extends PubSubService {
|
|||||||
* the studies to display in viewports.
|
* the studies to display in viewports.
|
||||||
* @param protocol is a specific protocol to apply.
|
* @param protocol is a specific protocol to apply.
|
||||||
*/
|
*/
|
||||||
public run({ studies, displaySets, activeStudy }, protocolId) {
|
public run({ studies, displaySets, activeStudy }, protocolId, options = {}) {
|
||||||
this.studies = [...(studies || this.studies)];
|
this.studies = [...(studies || this.studies)];
|
||||||
this.displaySets = displaySets;
|
this.displaySets = displaySets;
|
||||||
this.setActiveStudyUID((activeStudy || studies[0])?.StudyInstanceUID);
|
this.setActiveStudyUID((activeStudy || studies[0])?.StudyInstanceUID);
|
||||||
@ -406,7 +406,7 @@ export default class HangingProtocolService extends PubSubService {
|
|||||||
|
|
||||||
if (protocolId && typeof protocolId === 'string') {
|
if (protocolId && typeof protocolId === 'string') {
|
||||||
const protocol = this.getProtocolById(protocolId);
|
const protocol = this.getProtocolById(protocolId);
|
||||||
this._setProtocol(protocol);
|
this._setProtocol(protocol, options);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user