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 {
|
|
|
|
|
MeasurementService,
|
|
|
|
|
HangingProtocolService,
|
2022-07-27 18:39:04 +02:00
|
|
|
UINotificationService,
|
2022-11-17 04:16:12 +01:00
|
|
|
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 }) => {
|
|
|
|
|
UINotificationService.show({
|
|
|
|
|
title: title,
|
|
|
|
|
message: text,
|
|
|
|
|
type: type,
|
|
|
|
|
});
|
|
|
|
|
},
|
2020-07-03 18:39:41 +02:00
|
|
|
clearMeasurements: () => {
|
|
|
|
|
MeasurementService.clear();
|
|
|
|
|
},
|
2021-05-28 20:32:48 +02:00
|
|
|
nextStage: () => {
|
|
|
|
|
// next stage in hanging protocols
|
|
|
|
|
HangingProtocolService.nextProtocolStage();
|
|
|
|
|
},
|
|
|
|
|
previousStage: () => {
|
|
|
|
|
HangingProtocolService.previousProtocolStage();
|
2020-08-19 21:24:07 +02:00
|
|
|
},
|
2022-11-17 04:16:12 +01:00
|
|
|
openDICOMTagViewer() {
|
|
|
|
|
const { activeViewportIndex, viewports } = ViewportGridService.getState();
|
|
|
|
|
const activeViewportSpecificData =
|
|
|
|
|
viewports[activeViewportIndex];
|
|
|
|
|
const {
|
|
|
|
|
displaySetInstanceUIDs,
|
|
|
|
|
} = activeViewportSpecificData;
|
|
|
|
|
|
|
|
|
|
const displaySets = DisplaySetService.activeDisplaySets;
|
|
|
|
|
const { UIModalService } = servicesManager.services;
|
|
|
|
|
|
|
|
|
|
const displaySetInstanceUID = displaySetInstanceUIDs[0]
|
|
|
|
|
UIModalService.show({
|
|
|
|
|
content: DicomTagBrowser,
|
|
|
|
|
contentProps: {
|
|
|
|
|
displaySets,
|
|
|
|
|
displaySetInstanceUID,
|
|
|
|
|
onClose: UIModalService.hide,
|
|
|
|
|
},
|
|
|
|
|
title: 'DICOM Tag Browser'
|
|
|
|
|
});
|
|
|
|
|
}
|
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,
|
|
|
|
|
}
|
2020-07-03 18:39:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
actions,
|
|
|
|
|
definitions,
|
|
|
|
|
defaultContext: 'DEFAULT',
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default commandsModule;
|