2022-11-17 04:16:12 +01:00
|
|
|
import DicomTagBrowser from './DicomTagBrowser/DicomTagBrowser';
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
2020-08-19 21:24:07 +02:00
|
|
|
const commandsModule = ({ servicesManager, commandsManager }) => {
|
2021-05-28 20:32:48 +02:00
|
|
|
const {
|
2023-02-10 22:46:09 +01:00
|
|
|
measurementService,
|
|
|
|
|
hangingProtocolService,
|
|
|
|
|
uiNotificationService,
|
|
|
|
|
viewportGridService,
|
|
|
|
|
displaySetService,
|
2021-05-28 20:32:48 +02:00
|
|
|
} = servicesManager.services;
|
2020-07-03 18:39:41 +02:00
|
|
|
|
|
|
|
|
const actions = {
|
2022-07-27 18:39:04 +02:00
|
|
|
displayNotification: ({ text, title, type }) => {
|
2023-02-10 22:46:09 +01:00
|
|
|
uiNotificationService.show({
|
2022-07-27 18:39:04 +02:00
|
|
|
title: title,
|
|
|
|
|
message: text,
|
|
|
|
|
type: type,
|
|
|
|
|
});
|
|
|
|
|
},
|
2020-07-03 18:39:41 +02:00
|
|
|
clearMeasurements: () => {
|
2023-02-10 22:46:09 +01:00
|
|
|
measurementService.clear();
|
2020-07-03 18:39:41 +02:00
|
|
|
},
|
2021-05-28 20:32:48 +02:00
|
|
|
nextStage: () => {
|
|
|
|
|
// next stage in hanging protocols
|
2023-02-10 22:46:09 +01:00
|
|
|
hangingProtocolService.nextProtocolStage();
|
2021-05-28 20:32:48 +02:00
|
|
|
},
|
|
|
|
|
previousStage: () => {
|
2023-02-10 22:46:09 +01:00
|
|
|
hangingProtocolService.previousProtocolStage();
|
2020-08-19 21:24:07 +02:00
|
|
|
},
|
2022-11-17 04:16:12 +01:00
|
|
|
openDICOMTagViewer() {
|
2023-02-10 22:46:09 +01:00
|
|
|
const { activeViewportIndex, viewports } = viewportGridService.getState();
|
2022-11-21 16:44:19 +01:00
|
|
|
const activeViewportSpecificData = viewports[activeViewportIndex];
|
|
|
|
|
const { displaySetInstanceUIDs } = activeViewportSpecificData;
|
2022-11-17 04:16:12 +01:00
|
|
|
|
2023-02-10 22:46:09 +01:00
|
|
|
const displaySets = displaySetService.activeDisplaySets;
|
2022-11-17 04:16:12 +01:00
|
|
|
const { UIModalService } = servicesManager.services;
|
|
|
|
|
|
2022-11-21 16:44:19 +01:00
|
|
|
const displaySetInstanceUID = displaySetInstanceUIDs[0];
|
2022-11-17 04:16:12 +01:00
|
|
|
UIModalService.show({
|
|
|
|
|
content: DicomTagBrowser,
|
|
|
|
|
contentProps: {
|
|
|
|
|
displaySets,
|
|
|
|
|
displaySetInstanceUID,
|
|
|
|
|
onClose: UIModalService.hide,
|
|
|
|
|
},
|
2022-11-21 16:44:19 +01:00
|
|
|
title: 'DICOM Tag Browser',
|
2022-11-17 04:16:12 +01:00
|
|
|
});
|
2022-11-21 16:44:19 +01:00
|
|
|
},
|
2020-07-03 18:39:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const definitions = {
|
|
|
|
|
clearMeasurements: {
|
|
|
|
|
commandFn: actions.clearMeasurements,
|
|
|
|
|
storeContexts: [],
|
|
|
|
|
options: {},
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
displayNotification: {
|
|
|
|
|
commandFn: actions.displayNotification,
|
2020-08-19 21:24:07 +02:00
|
|
|
storeContexts: [],
|
|
|
|
|
options: {},
|
|
|
|
|
},
|
2021-05-28 20:32:48 +02:00
|
|
|
nextStage: {
|
|
|
|
|
commandFn: actions.nextStage,
|
|
|
|
|
storeContexts: [],
|
|
|
|
|
options: {},
|
|
|
|
|
},
|
|
|
|
|
previousStage: {
|
|
|
|
|
commandFn: actions.previousStage,
|
|
|
|
|
storeContexts: [],
|
|
|
|
|
options: {},
|
|
|
|
|
},
|
2022-11-17 04:16:12 +01:00
|
|
|
openDICOMTagViewer: {
|
|
|
|
|
commandFn: actions.openDICOMTagViewer,
|
2022-11-21 16:44:19 +01:00
|
|
|
},
|
2020-07-03 18:39:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
actions,
|
|
|
|
|
definitions,
|
|
|
|
|
defaultContext: 'DEFAULT',
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default commandsModule;
|