* feat: Add state sync and use it to remember viewport grid info fix: Version updates Fixes for toggling MPR mode Fix the display when the interleaved load module fails Fix the memory of the state to restore correctly PR fixes for the state sync service PR fixes PR fixes PR fixes Added a hack warning to remove volumeDeactivate Fixes for TMTV colormap setting Fix the casing Missed renames fix: tests not running due to variance in ordering Reverting some fixes to change case PR changes - mostly comments and minor improvements fix: All display sets were being updated on drag and drop PR fixes - mostly renames PR fixes Test support for OHIF, for HP branch test: Add at least a minimal set of automated tests for hanging protocols Docs PR fixes Merge fixes DOCS updates Add an example of the mn hanging protocol PR fixes PR fixes PR fixes * Fix the drag and drop PR fixes * PR changes - update default keys for next/previous stage * fix: Was storing the custom viewport grid too aggressively Caused by a PR change misspelling a variable
206 lines
5.9 KiB
JavaScript
206 lines
5.9 KiB
JavaScript
import toolbarButtons from './toolbarButtons.js';
|
|
import { hotkeys, ServicesManager } from '@ohif/core';
|
|
import { id } from './id';
|
|
|
|
const configs = {
|
|
Length: {},
|
|
//
|
|
};
|
|
|
|
const ohif = {
|
|
layout: '@ohif/extension-default.layoutTemplateModule.viewerLayout',
|
|
sopClassHandler: '@ohif/extension-default.sopClassHandlerModule.stack',
|
|
hangingProtocol: '@ohif/extension-default.hangingProtocolModule.default',
|
|
measurements: '@ohif/extension-default.panelModule.measure',
|
|
thumbnailList: '@ohif/extension-default.panelModule.seriesList',
|
|
};
|
|
|
|
const cs3d = {
|
|
viewport: '@ohif/extension-cornerstone.viewportModule.cornerstone',
|
|
};
|
|
|
|
const dicomsr = {
|
|
sopClassHandler:
|
|
'@ohif/extension-cornerstone-dicom-sr.sopClassHandlerModule.dicom-sr',
|
|
viewport: '@ohif/extension-cornerstone-dicom-sr.viewportModule.dicom-sr',
|
|
};
|
|
|
|
const dicomvideo = {
|
|
sopClassHandler:
|
|
'@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
|
|
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
|
|
};
|
|
|
|
const dicompdf = {
|
|
sopClassHandler: '@ohif/extension-dicom-pdf.sopClassHandlerModule.dicom-pdf',
|
|
viewport: '@ohif/extension-dicom-pdf.viewportModule.dicom-pdf',
|
|
};
|
|
|
|
const extensionDependencies = {
|
|
'@ohif/extension-default': '^3.0.0',
|
|
'@ohif/extension-cornerstone': '^3.0.0',
|
|
'@ohif/extension-cornerstone-dicom-sr': '^3.0.0',
|
|
'@ohif/extension-dicom-pdf': '^3.0.1',
|
|
'@ohif/extension-dicom-video': '^3.0.1',
|
|
};
|
|
|
|
function modeFactory({ modeConfiguration }) {
|
|
return {
|
|
id,
|
|
routeName: 'viewer',
|
|
displayName: 'Basic Viewer CS3D',
|
|
/**
|
|
* Lifecycle hooks
|
|
*/
|
|
onModeEnter: ({ servicesManager, extensionManager }) => {
|
|
const { toolbarService, toolGroupService } = servicesManager.services;
|
|
const utilityModule = extensionManager.getModuleEntry(
|
|
'@ohif/extension-cornerstone.utilityModule.tools'
|
|
);
|
|
|
|
const { toolNames, Enums } = utilityModule.exports;
|
|
|
|
const tools = {
|
|
active: [
|
|
{
|
|
toolName: toolNames.WindowLevel,
|
|
bindings: [{ mouseButton: Enums.MouseBindings.Primary }],
|
|
},
|
|
{
|
|
toolName: toolNames.Pan,
|
|
bindings: [{ mouseButton: Enums.MouseBindings.Auxiliary }],
|
|
},
|
|
{
|
|
toolName: toolNames.Zoom,
|
|
bindings: [{ mouseButton: Enums.MouseBindings.Secondary }],
|
|
},
|
|
{ toolName: toolNames.StackScrollMouseWheel, bindings: [] },
|
|
],
|
|
passive: [
|
|
{ toolName: toolNames.Length },
|
|
{ toolName: toolNames.Bidirectional },
|
|
{ toolName: toolNames.Probe },
|
|
{ toolName: toolNames.EllipticalROI },
|
|
{ toolName: toolNames.RectangleROI },
|
|
{ toolName: toolNames.StackScroll },
|
|
{ toolName: toolNames.CalibrationLine },
|
|
],
|
|
// enabled
|
|
// disabled
|
|
};
|
|
|
|
const toolGroupId = 'default';
|
|
toolGroupService.createToolGroupAndAddTools(toolGroupId, tools, configs);
|
|
|
|
let unsubscribe;
|
|
|
|
const activateTool = () => {
|
|
toolbarService.recordInteraction({
|
|
groupId: 'WindowLevel',
|
|
itemId: 'WindowLevel',
|
|
interactionType: 'tool',
|
|
commands: [
|
|
{
|
|
commandName: 'setToolActive',
|
|
commandOptions: {
|
|
toolName: 'WindowLevel',
|
|
},
|
|
context: 'CORNERSTONE',
|
|
},
|
|
],
|
|
});
|
|
|
|
// We don't need to reset the active tool whenever a viewport is getting
|
|
// added to the toolGroup.
|
|
unsubscribe();
|
|
};
|
|
|
|
// Since we only have one viewport for the basic cs3d mode and it has
|
|
// only one hanging protocol, we can just use the first viewport
|
|
({ unsubscribe } = toolGroupService.subscribe(
|
|
toolGroupService.EVENTS.VIEWPORT_ADDED,
|
|
activateTool
|
|
));
|
|
|
|
toolbarService.init(extensionManager);
|
|
toolbarService.addButtons(toolbarButtons);
|
|
toolbarService.createButtonSection('primary', [
|
|
'MeasurementTools',
|
|
'Zoom',
|
|
'WindowLevel',
|
|
'Pan',
|
|
'Layout',
|
|
'MoreTools',
|
|
]);
|
|
},
|
|
onModeExit: ({ servicesManager }) => {
|
|
const {
|
|
toolGroupService,
|
|
measurementService,
|
|
toolbarService,
|
|
} = servicesManager.services;
|
|
|
|
toolGroupService.destroy();
|
|
},
|
|
validationTags: {
|
|
study: [],
|
|
series: [],
|
|
},
|
|
isValidMode: ({ modalities }) => {
|
|
const modalities_list = modalities.split('\\');
|
|
|
|
// Slide Microscopy modality not supported by basic mode yet
|
|
return !modalities_list.includes('SM');
|
|
},
|
|
routes: [
|
|
{
|
|
path: 'viewer-cs3d',
|
|
/*init: ({ servicesManager, extensionManager }) => {
|
|
//defaultViewerRouteInit
|
|
},*/
|
|
layoutTemplate: ({ location, servicesManager }) => {
|
|
return {
|
|
id: ohif.layout,
|
|
props: {
|
|
// TODO: Should be optional, or required to pass empty array for slots?
|
|
leftPanels: [ohif.thumbnailList],
|
|
rightPanels: [ohif.measurements],
|
|
viewports: [
|
|
{
|
|
namespace: cs3d.viewport,
|
|
displaySetsToDisplay: [ohif.sopClassHandler],
|
|
},
|
|
{
|
|
namespace: dicomvideo.viewport,
|
|
displaySetsToDisplay: [dicomvideo.sopClassHandler],
|
|
},
|
|
{
|
|
namespace: dicompdf.viewport,
|
|
displaySetsToDisplay: [dicompdf.sopClassHandler],
|
|
},
|
|
],
|
|
},
|
|
};
|
|
},
|
|
},
|
|
],
|
|
extensions: extensionDependencies,
|
|
hangingProtocol: [ohif.hangingProtocol],
|
|
sopClassHandlers: [
|
|
dicomvideo.sopClassHandler,
|
|
ohif.sopClassHandler,
|
|
dicompdf.sopClassHandler,
|
|
dicomsr.sopClassHandler,
|
|
],
|
|
hotkeys: [...hotkeys.defaults.hotkeyBindings],
|
|
};
|
|
}
|
|
|
|
const mode = {
|
|
id,
|
|
modeFactory,
|
|
extensionDependencies,
|
|
};
|
|
|
|
export default mode;
|