2022-07-27 18:39:04 +02:00
|
|
|
import {
|
|
|
|
|
getEnabledElement,
|
|
|
|
|
StackViewport,
|
|
|
|
|
volumeLoader,
|
|
|
|
|
cache,
|
|
|
|
|
utilities as csUtils,
|
|
|
|
|
} from '@cornerstonejs/core';
|
|
|
|
|
import {
|
|
|
|
|
ToolGroupManager,
|
|
|
|
|
Enums,
|
|
|
|
|
segmentation,
|
|
|
|
|
utilities as csToolsUtils,
|
|
|
|
|
} from '@cornerstonejs/tools';
|
|
|
|
|
import CornerstoneViewportDownloadForm from './utils/CornerstoneViewportDownloadForm';
|
|
|
|
|
|
|
|
|
|
import { getEnabledElement as OHIFgetEnabledElement } from './state';
|
|
|
|
|
import callInputDialog from './utils/callInputDialog';
|
|
|
|
|
import { setColormap } from './utils/colormap/transferFunctionHelpers';
|
|
|
|
|
|
|
|
|
|
const commandsModule = ({ servicesManager }) => {
|
|
|
|
|
const {
|
|
|
|
|
ViewportGridService,
|
|
|
|
|
ToolGroupService,
|
|
|
|
|
CineService,
|
|
|
|
|
ToolBarService,
|
|
|
|
|
UIDialogService,
|
|
|
|
|
CornerstoneViewportService,
|
|
|
|
|
SegmentationService,
|
|
|
|
|
} = servicesManager.services;
|
|
|
|
|
|
|
|
|
|
function _getActiveViewportEnabledElement() {
|
|
|
|
|
const { activeViewportIndex } = ViewportGridService.getState();
|
|
|
|
|
const { element } = OHIFgetEnabledElement(activeViewportIndex) || {};
|
|
|
|
|
const enabledElement = getEnabledElement(element);
|
|
|
|
|
return enabledElement;
|
|
|
|
|
}
|
2019-12-02 20:02:35 +01:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
function _getToolGroup(toolGroupId) {
|
|
|
|
|
let toolGroupIdToUse = toolGroupId;
|
2019-06-05 21:57:00 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
if (!toolGroupIdToUse) {
|
|
|
|
|
// Use the active viewport's tool group if no tool group id is provided
|
|
|
|
|
const enabledElement = _getActiveViewportEnabledElement();
|
2020-04-09 12:21:43 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
if (!enabledElement) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-05-28 20:32:48 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
const { renderingEngineId, viewportId } = enabledElement;
|
|
|
|
|
const toolGroup = ToolGroupManager.getToolGroupForViewport(
|
|
|
|
|
viewportId,
|
|
|
|
|
renderingEngineId
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (!toolGroup) {
|
|
|
|
|
console.warn(
|
|
|
|
|
'No tool group found for viewportId:',
|
|
|
|
|
viewportId,
|
|
|
|
|
'and renderingEngineId:',
|
|
|
|
|
renderingEngineId
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-05-28 20:32:48 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
toolGroupIdToUse = toolGroup.id;
|
|
|
|
|
}
|
2021-05-28 20:32:48 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
const toolGroup = ToolGroupService.getToolGroup(toolGroupIdToUse);
|
|
|
|
|
return toolGroup;
|
|
|
|
|
}
|
2021-05-28 20:32:48 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
const actions = {
|
|
|
|
|
getActiveViewportEnabledElement: () => {
|
|
|
|
|
return _getActiveViewportEnabledElement();
|
|
|
|
|
},
|
|
|
|
|
setViewportActive: ({ viewportId }) => {
|
|
|
|
|
const viewportInfo = CornerstoneViewportService.getViewportInfo(
|
|
|
|
|
viewportId
|
|
|
|
|
);
|
|
|
|
|
if (!viewportInfo) {
|
|
|
|
|
console.warn('No viewport found for viewportId:', viewportId);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-05-28 20:32:48 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
const viewportIndex = viewportInfo.getViewportIndex();
|
|
|
|
|
ViewportGridService.setActiveViewportIndex(viewportIndex);
|
|
|
|
|
},
|
|
|
|
|
arrowTextCallback: ({ callback, data }) => {
|
|
|
|
|
callInputDialog(UIDialogService, data, callback);
|
|
|
|
|
},
|
|
|
|
|
toggleCine: () => {
|
|
|
|
|
const { viewports } = ViewportGridService.getState();
|
|
|
|
|
const { isCineEnabled } = CineService.getState();
|
|
|
|
|
CineService.setIsCineEnabled(!isCineEnabled);
|
|
|
|
|
ToolBarService.setButton('Cine', { props: { isActive: !isCineEnabled } });
|
|
|
|
|
viewports.forEach((_, index) =>
|
|
|
|
|
CineService.setCine({ id: index, isPlaying: false })
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
setWindowLevel({ window, level, toolGroupId }) {
|
|
|
|
|
// convert to numbers
|
|
|
|
|
const windowWidthNum = Number(window);
|
|
|
|
|
const windowCenterNum = Number(level);
|
2021-05-28 20:32:48 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
const { viewportId } = _getActiveViewportEnabledElement();
|
|
|
|
|
const viewportToolGroupId = ToolGroupService.getToolGroupForViewport(
|
|
|
|
|
viewportId
|
|
|
|
|
);
|
2020-06-26 19:51:27 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
if (toolGroupId && toolGroupId !== viewportToolGroupId) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2020-06-26 20:22:45 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
// get actor from the viewport
|
|
|
|
|
const renderingEngine = CornerstoneViewportService.getRenderingEngine();
|
|
|
|
|
const viewport = renderingEngine.getViewport(viewportId);
|
|
|
|
|
|
2022-08-17 21:13:59 +02:00
|
|
|
const { lower, upper } = csUtils.windowLevel.toLowHighRange(
|
|
|
|
|
windowWidthNum,
|
|
|
|
|
windowCenterNum
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
viewport.setProperties({
|
|
|
|
|
voiRange: {
|
|
|
|
|
upper,
|
|
|
|
|
lower,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
viewport.render();
|
2019-12-02 20:02:35 +01:00
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
toggleCrosshairs({ toolGroupId, toggledState }) {
|
|
|
|
|
const toolName = 'Crosshairs';
|
|
|
|
|
// If it is Enabled
|
|
|
|
|
if (toggledState) {
|
|
|
|
|
actions.setToolActive({ toolName, toolGroupId });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const toolGroup = _getToolGroup(toolGroupId);
|
2019-12-02 20:02:35 +01:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
if (!toolGroup) {
|
|
|
|
|
return;
|
2019-12-02 20:02:35 +01:00
|
|
|
}
|
|
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
toolGroup.setToolDisabled(toolName);
|
|
|
|
|
|
|
|
|
|
// Get the primary toolId from the ToolBarService and set it to active
|
|
|
|
|
// Since it was set to passive if not already active
|
|
|
|
|
const primaryActiveTool = ToolBarService.state.primaryToolId;
|
|
|
|
|
if (
|
|
|
|
|
toolGroup?.toolOptions[primaryActiveTool]?.mode ===
|
|
|
|
|
Enums.ToolModes.Passive
|
|
|
|
|
) {
|
|
|
|
|
toolGroup.setToolActive(primaryActiveTool, {
|
|
|
|
|
bindings: [{ mouseButton: Enums.MouseBindings.Primary }],
|
|
|
|
|
});
|
2019-12-02 20:02:35 +01:00
|
|
|
}
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
setToolActive: ({ toolName, toolGroupId = null }) => {
|
|
|
|
|
const toolGroup = _getToolGroup(toolGroupId);
|
|
|
|
|
|
|
|
|
|
if (!toolGroup) {
|
|
|
|
|
console.warn('No tool group found for toolGroupId:', toolGroupId);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// Todo: we need to check if the viewports of the toolGroup is actually
|
|
|
|
|
// parts of the ViewportGrid's viewports, if not we return
|
|
|
|
|
|
|
|
|
|
const { viewports } = ViewportGridService.getState() || {
|
|
|
|
|
viewports: [],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// iterate over all viewports and set the tool active for the
|
|
|
|
|
// viewports that belong to the toolGroup
|
|
|
|
|
for (let index = 0; index < viewports.length; index++) {
|
|
|
|
|
const ohifEnabledElement = OHIFgetEnabledElement(index);
|
|
|
|
|
|
|
|
|
|
if (!ohifEnabledElement) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const viewport = getEnabledElement(ohifEnabledElement.element);
|
|
|
|
|
|
|
|
|
|
if (!viewport) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Find the current active tool and set it to be passive
|
|
|
|
|
const activeTool = toolGroup.getActivePrimaryMouseButtonTool();
|
|
|
|
|
|
|
|
|
|
if (activeTool) {
|
|
|
|
|
toolGroup.setToolPassive(activeTool);
|
2019-06-25 00:04:26 +02:00
|
|
|
}
|
2022-07-27 18:39:04 +02:00
|
|
|
|
|
|
|
|
// Set the new toolName to be active
|
|
|
|
|
toolGroup.setToolActive(toolName, {
|
|
|
|
|
bindings: [{ mouseButton: Enums.MouseBindings.Primary }],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return;
|
2019-12-02 20:02:35 +01:00
|
|
|
}
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
showDownloadViewportModal: () => {
|
|
|
|
|
const { activeViewportIndex } = ViewportGridService.getState();
|
|
|
|
|
const { UIModalService } = servicesManager.services;
|
2019-12-02 20:02:35 +01:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
if (UIModalService) {
|
|
|
|
|
UIModalService.show({
|
|
|
|
|
content: CornerstoneViewportDownloadForm,
|
|
|
|
|
title: 'Download High Quality Image',
|
|
|
|
|
contentProps: {
|
|
|
|
|
activeViewportIndex,
|
|
|
|
|
onClose: UIModalService.hide,
|
|
|
|
|
CornerstoneViewportService,
|
|
|
|
|
},
|
|
|
|
|
});
|
2019-12-02 20:02:35 +01:00
|
|
|
}
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
rotateViewport: ({ rotation }) => {
|
|
|
|
|
const enabledElement = _getActiveViewportEnabledElement();
|
|
|
|
|
if (!enabledElement) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-05-28 20:32:48 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
const { viewport } = enabledElement;
|
2021-05-28 20:32:48 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
if (viewport instanceof StackViewport) {
|
|
|
|
|
const { rotation: currentRotation } = viewport.getProperties();
|
|
|
|
|
const newRotation = (currentRotation + rotation) % 360;
|
|
|
|
|
viewport.setProperties({ rotation: newRotation });
|
|
|
|
|
viewport.render();
|
2021-05-28 20:32:48 +02:00
|
|
|
}
|
2022-07-27 18:39:04 +02:00
|
|
|
},
|
|
|
|
|
flipViewportHorizontal: () => {
|
|
|
|
|
const enabledElement = _getActiveViewportEnabledElement();
|
2021-05-28 20:32:48 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
if (!enabledElement) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const { viewport } = enabledElement;
|
|
|
|
|
|
|
|
|
|
if (viewport instanceof StackViewport) {
|
|
|
|
|
const { flipHorizontal } = viewport.getCamera();
|
|
|
|
|
viewport.setCamera({ flipHorizontal: !flipHorizontal });
|
|
|
|
|
viewport.render();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
flipViewportVertical: () => {
|
|
|
|
|
const enabledElement = _getActiveViewportEnabledElement();
|
|
|
|
|
|
|
|
|
|
if (!enabledElement) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const { viewport } = enabledElement;
|
|
|
|
|
|
|
|
|
|
if (viewport instanceof StackViewport) {
|
|
|
|
|
const { flipVertical } = viewport.getCamera();
|
|
|
|
|
viewport.setCamera({ flipVertical: !flipVertical });
|
|
|
|
|
viewport.render();
|
|
|
|
|
}
|
2021-05-28 20:32:48 +02:00
|
|
|
},
|
|
|
|
|
invertViewport: ({ element }) => {
|
|
|
|
|
let enabledElement;
|
|
|
|
|
|
|
|
|
|
if (element === undefined) {
|
2022-07-27 18:39:04 +02:00
|
|
|
enabledElement = _getActiveViewportEnabledElement();
|
2021-05-28 20:32:48 +02:00
|
|
|
} else {
|
|
|
|
|
enabledElement = element;
|
|
|
|
|
}
|
2019-06-25 00:04:26 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
if (!enabledElement) {
|
|
|
|
|
return;
|
2019-12-02 20:02:35 +01:00
|
|
|
}
|
2020-07-10 21:00:10 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
const { viewport } = enabledElement;
|
2020-07-10 21:00:10 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
if (viewport instanceof StackViewport) {
|
|
|
|
|
const { invert } = viewport.getProperties();
|
|
|
|
|
viewport.setProperties({ invert: !invert });
|
|
|
|
|
viewport.render();
|
2020-07-10 21:00:10 +02:00
|
|
|
}
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
resetViewport: () => {
|
|
|
|
|
const enabledElement = _getActiveViewportEnabledElement();
|
|
|
|
|
|
|
|
|
|
if (!enabledElement) {
|
|
|
|
|
return;
|
2019-12-02 20:02:35 +01:00
|
|
|
}
|
2020-09-15 03:18:46 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
const { viewport } = enabledElement;
|
2020-09-15 03:18:46 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
if (viewport instanceof StackViewport) {
|
|
|
|
|
viewport.resetProperties();
|
|
|
|
|
viewport.resetCamera();
|
|
|
|
|
viewport.render();
|
2020-09-15 03:18:46 +02:00
|
|
|
}
|
2019-12-02 20:02:35 +01:00
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
scaleViewport: ({ direction }) => {
|
|
|
|
|
const enabledElement = _getActiveViewportEnabledElement();
|
|
|
|
|
const scaleFactor = direction > 0 ? 0.9 : 1.1;
|
|
|
|
|
|
|
|
|
|
if (!enabledElement) {
|
2019-12-02 20:02:35 +01:00
|
|
|
return;
|
|
|
|
|
}
|
2022-07-27 18:39:04 +02:00
|
|
|
const { viewport } = enabledElement;
|
2019-12-02 20:02:35 +01:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
if (viewport instanceof StackViewport) {
|
|
|
|
|
if (direction) {
|
|
|
|
|
const { parallelScale } = viewport.getCamera();
|
|
|
|
|
viewport.setCamera({ parallelScale: parallelScale * scaleFactor });
|
|
|
|
|
viewport.render();
|
|
|
|
|
} else {
|
|
|
|
|
viewport.resetCamera();
|
|
|
|
|
viewport.render();
|
|
|
|
|
}
|
2019-12-02 20:02:35 +01:00
|
|
|
}
|
2022-07-27 18:39:04 +02:00
|
|
|
},
|
|
|
|
|
scroll: ({ direction }) => {
|
|
|
|
|
const enabledElement = _getActiveViewportEnabledElement();
|
2019-12-02 20:02:35 +01:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
if (!enabledElement) {
|
2019-12-02 20:02:35 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
const { viewport } = enabledElement;
|
|
|
|
|
const options = { delta: direction };
|
2019-12-02 20:02:35 +01:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
csToolsUtils.scroll(viewport, options);
|
|
|
|
|
},
|
|
|
|
|
async createSegmentationForDisplaySet({ displaySetInstanceUID }) {
|
|
|
|
|
const volumeId = displaySetInstanceUID;
|
2020-07-03 18:39:41 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
const segmentationUID = csUtils.uuidv4();
|
|
|
|
|
const segmentationId = `${volumeId}::${segmentationUID}`;
|
2019-12-02 20:02:35 +01:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
await volumeLoader.createAndCacheDerivedVolume(volumeId, {
|
|
|
|
|
volumeId: segmentationId,
|
2019-06-25 00:04:26 +02:00
|
|
|
});
|
|
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
// Add the segmentations to state
|
|
|
|
|
segmentation.addSegmentations([
|
|
|
|
|
{
|
|
|
|
|
segmentationId,
|
|
|
|
|
representation: {
|
|
|
|
|
// The type of segmentation
|
|
|
|
|
type: Enums.SegmentationRepresentations.Labelmap,
|
|
|
|
|
// The actual segmentation data, in the case of labelmap this is a
|
|
|
|
|
// reference to the source volume of the segmentation.
|
|
|
|
|
data: {
|
|
|
|
|
volumeId: segmentationId,
|
|
|
|
|
},
|
2019-12-09 18:47:23 +01:00
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
return segmentationId;
|
|
|
|
|
},
|
|
|
|
|
async addSegmentationRepresentationToToolGroup({
|
|
|
|
|
segmentationId,
|
|
|
|
|
toolGroupId,
|
|
|
|
|
representationType,
|
|
|
|
|
}) {
|
|
|
|
|
// // Add the segmentation representation to the toolgroup
|
|
|
|
|
await segmentation.addSegmentationRepresentations(toolGroupId, [
|
|
|
|
|
{
|
|
|
|
|
segmentationId,
|
|
|
|
|
type: representationType,
|
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
},
|
|
|
|
|
getLabelmapVolumes: ({ segmentations }) => {
|
|
|
|
|
if (!segmentations || !segmentations.length) {
|
|
|
|
|
segmentations = SegmentationService.getSegmentations();
|
2019-12-09 18:47:23 +01:00
|
|
|
}
|
|
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
const labelmapVolumes = segmentations.map(segmentation => {
|
|
|
|
|
return cache.getVolume(segmentation.id);
|
|
|
|
|
});
|
2019-12-09 18:47:23 +01:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
return labelmapVolumes;
|
|
|
|
|
},
|
|
|
|
|
setViewportColormap: ({
|
|
|
|
|
viewportIndex,
|
|
|
|
|
displaySetInstanceUID,
|
|
|
|
|
colormap,
|
|
|
|
|
immediate = false,
|
|
|
|
|
}) => {
|
|
|
|
|
const viewport = CornerstoneViewportService.getCornerstoneViewportByIndex(
|
|
|
|
|
viewportIndex
|
|
|
|
|
);
|
2019-12-09 18:47:23 +01:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
const actorEntries = viewport.getActors();
|
2019-12-09 18:47:23 +01:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
const actorEntry = actorEntries.find(actorEntry => {
|
|
|
|
|
return actorEntry.uid === displaySetInstanceUID;
|
2019-06-25 00:04:26 +02:00
|
|
|
});
|
2019-12-09 18:47:23 +01:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
const { actor: volumeActor } = actorEntry;
|
2020-02-20 22:25:26 +01:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
setColormap(volumeActor, colormap);
|
2020-03-09 20:03:23 +01:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
if (immediate) {
|
|
|
|
|
viewport.render();
|
2020-02-20 22:25:26 +01:00
|
|
|
}
|
|
|
|
|
},
|
2022-09-09 04:02:20 +02:00
|
|
|
incrementActiveViewport: () => {
|
|
|
|
|
const { activeViewportIndex, viewports } = ViewportGridService.getState();
|
|
|
|
|
const nextViewportIndex = (activeViewportIndex + 1) % viewports.length;
|
|
|
|
|
ViewportGridService.setActiveViewportIndex(nextViewportIndex);
|
|
|
|
|
},
|
|
|
|
|
decrementActiveViewport: () => {
|
|
|
|
|
const { activeViewportIndex, viewports } = ViewportGridService.getState();
|
|
|
|
|
const nextViewportIndex =
|
|
|
|
|
(activeViewportIndex - 1 + viewports.length) % viewports.length;
|
|
|
|
|
ViewportGridService.setActiveViewportIndex(nextViewportIndex);
|
|
|
|
|
},
|
2019-12-02 20:02:35 +01:00
|
|
|
};
|
2019-05-31 22:25:10 +02:00
|
|
|
|
2019-12-02 20:02:35 +01:00
|
|
|
const definitions = {
|
2022-07-27 18:39:04 +02:00
|
|
|
setWindowLevel: {
|
|
|
|
|
commandFn: actions.setWindowLevel,
|
2019-12-09 18:47:23 +01:00
|
|
|
storeContexts: [],
|
|
|
|
|
options: {},
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
setToolActive: {
|
|
|
|
|
commandFn: actions.setToolActive,
|
2020-06-15 05:43:31 +02:00
|
|
|
storeContexts: [],
|
2019-12-02 20:02:35 +01:00
|
|
|
options: {},
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
toggleCrosshairs: {
|
|
|
|
|
commandFn: actions.toggleCrosshairs,
|
2020-06-26 20:22:45 +02:00
|
|
|
storeContexts: [],
|
2019-12-02 20:02:35 +01:00
|
|
|
options: {},
|
|
|
|
|
},
|
|
|
|
|
rotateViewportCW: {
|
|
|
|
|
commandFn: actions.rotateViewport,
|
2020-06-17 14:50:11 +02:00
|
|
|
storeContexts: [],
|
2019-12-02 20:02:35 +01:00
|
|
|
options: { rotation: 90 },
|
|
|
|
|
},
|
|
|
|
|
rotateViewportCCW: {
|
|
|
|
|
commandFn: actions.rotateViewport,
|
2020-06-26 20:22:45 +02:00
|
|
|
storeContexts: [],
|
2019-12-02 20:02:35 +01:00
|
|
|
options: { rotation: -90 },
|
|
|
|
|
},
|
2022-09-09 04:02:20 +02:00
|
|
|
incrementActiveViewport: {
|
|
|
|
|
commandFn: actions.incrementActiveViewport,
|
|
|
|
|
storeContexts: [],
|
|
|
|
|
},
|
|
|
|
|
decrementActiveViewport: {
|
|
|
|
|
commandFn: actions.decrementActiveViewport,
|
|
|
|
|
storeContexts: [],
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
flipViewportHorizontal: {
|
|
|
|
|
commandFn: actions.flipViewportHorizontal,
|
2020-06-17 14:50:11 +02:00
|
|
|
storeContexts: [],
|
2019-12-02 20:02:35 +01:00
|
|
|
options: {},
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
flipViewportVertical: {
|
|
|
|
|
commandFn: actions.flipViewportVertical,
|
2020-07-10 21:00:10 +02:00
|
|
|
storeContexts: [],
|
|
|
|
|
options: {},
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
invertViewport: {
|
|
|
|
|
commandFn: actions.invertViewport,
|
2020-06-26 20:22:45 +02:00
|
|
|
storeContexts: [],
|
2019-12-02 20:02:35 +01:00
|
|
|
options: {},
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
resetViewport: {
|
|
|
|
|
commandFn: actions.resetViewport,
|
2020-06-17 14:50:11 +02:00
|
|
|
storeContexts: [],
|
2019-12-02 20:02:35 +01:00
|
|
|
options: {},
|
|
|
|
|
},
|
|
|
|
|
scaleUpViewport: {
|
|
|
|
|
commandFn: actions.scaleViewport,
|
2020-06-26 20:22:45 +02:00
|
|
|
storeContexts: [],
|
2019-12-02 20:02:35 +01:00
|
|
|
options: { direction: 1 },
|
|
|
|
|
},
|
|
|
|
|
scaleDownViewport: {
|
|
|
|
|
commandFn: actions.scaleViewport,
|
2020-06-26 20:22:45 +02:00
|
|
|
storeContexts: [],
|
2019-12-02 20:02:35 +01:00
|
|
|
options: { direction: -1 },
|
|
|
|
|
},
|
|
|
|
|
fitViewportToWindow: {
|
|
|
|
|
commandFn: actions.scaleViewport,
|
2020-06-26 20:22:45 +02:00
|
|
|
storeContexts: [],
|
2019-12-02 20:02:35 +01:00
|
|
|
options: { direction: 0 },
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
nextImage: {
|
|
|
|
|
commandFn: actions.scroll,
|
|
|
|
|
storeContexts: [],
|
|
|
|
|
options: { direction: 1 },
|
|
|
|
|
},
|
|
|
|
|
previousImage: {
|
|
|
|
|
commandFn: actions.scroll,
|
|
|
|
|
storeContexts: [],
|
|
|
|
|
options: { direction: -1 },
|
|
|
|
|
},
|
|
|
|
|
showDownloadViewportModal: {
|
|
|
|
|
commandFn: actions.showDownloadViewportModal,
|
2020-06-17 14:50:11 +02:00
|
|
|
storeContexts: [],
|
2019-12-02 20:02:35 +01:00
|
|
|
options: {},
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
toggleCine: {
|
|
|
|
|
commandFn: actions.toggleCine,
|
2020-06-26 20:22:45 +02:00
|
|
|
storeContexts: [],
|
2019-12-02 20:02:35 +01:00
|
|
|
options: {},
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
arrowTextCallback: {
|
|
|
|
|
commandFn: actions.arrowTextCallback,
|
2020-06-26 20:22:45 +02:00
|
|
|
storeContexts: [],
|
2019-12-02 20:02:35 +01:00
|
|
|
options: {},
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
setViewportActive: {
|
|
|
|
|
commandFn: actions.setViewportActive,
|
2020-06-26 20:22:45 +02:00
|
|
|
storeContexts: [],
|
2019-12-02 20:02:35 +01:00
|
|
|
options: {},
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
createSegmentationForDisplaySet: {
|
|
|
|
|
commandFn: actions.createSegmentationForDisplaySet,
|
2019-12-02 20:02:35 +01:00
|
|
|
storeContexts: [],
|
|
|
|
|
options: {},
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
addSegmentationRepresentationToToolGroup: {
|
|
|
|
|
commandFn: actions.addSegmentationRepresentationToToolGroup,
|
2020-02-14 21:54:08 +01:00
|
|
|
storeContexts: [],
|
2022-07-27 18:39:04 +02:00
|
|
|
options: {},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getLabelmapVolumes: {
|
|
|
|
|
commandFn: actions.getLabelmapVolumes,
|
|
|
|
|
storeContexts: [],
|
|
|
|
|
options: {},
|
|
|
|
|
},
|
|
|
|
|
setViewportColormap: {
|
|
|
|
|
commandFn: actions.setViewportColormap,
|
2020-06-26 20:22:45 +02:00
|
|
|
storeContexts: [],
|
2020-02-20 22:25:26 +01:00
|
|
|
options: {},
|
|
|
|
|
},
|
2019-12-02 20:02:35 +01:00
|
|
|
};
|
2019-06-03 04:43:04 +02:00
|
|
|
|
2019-12-02 20:02:35 +01:00
|
|
|
return {
|
|
|
|
|
actions,
|
|
|
|
|
definitions,
|
2022-07-27 18:39:04 +02:00
|
|
|
defaultContext: 'CORNERSTONE',
|
2019-12-02 20:02:35 +01:00
|
|
|
};
|
2019-06-13 15:50:07 +02:00
|
|
|
};
|
2019-12-02 20:02:35 +01:00
|
|
|
|
|
|
|
|
export default commandsModule;
|