diff --git a/extensions/cornerstone-dicom-seg/src/getHangingProtocolModule.ts b/extensions/cornerstone-dicom-seg/src/getHangingProtocolModule.ts new file mode 100644 index 0000000000..0a2f888e4f --- /dev/null +++ b/extensions/cornerstone-dicom-seg/src/getHangingProtocolModule.ts @@ -0,0 +1,78 @@ +import { Types } from '@ohif/core'; + +const segProtocol: Types.HangingProtocol.Protocol = { + id: '@ohif/seg', + // Don't store this hanging protocol as it applies to the currently active + // display set by default + // cacheId: null, + hasUpdatedPriorsInformation: false, + name: 'Segmentations', + // Just apply this one when specifically listed + protocolMatchingRules: [], + toolGroupIds: ['default'], + // -1 would be used to indicate active only, whereas other values are + // the number of required priors referenced - so 0 means active with + // 0 or more priors. + numberOfPriorsReferenced: 0, + // Default viewport is used to define the viewport when + // additional viewports are added using the layout tool + defaultViewport: { + viewportOptions: { + viewportType: 'stack', + toolGroupId: 'default', + allowUnmatchedView: true, + }, + displaySets: [ + { + id: 'segDisplaySetId', + matchedDisplaySetsIndex: -1, + }, + ], + }, + displaySetSelectors: { + segDisplaySetId: { + seriesMatchingRules: [ + { + attribute: 'Modality', + constraint: { + equals: 'SEG', + }, + }, + ], + }, + }, + stages: [ + { + name: 'Segmentations', + viewportStructure: { + layoutType: 'grid', + properties: { + rows: 1, + columns: 1, + }, + }, + viewports: [ + { + viewportOptions: { allowUnmatchedView: true }, + displaySets: [ + { + id: 'segDisplaySetId', + }, + ], + }, + ], + }, + ], +}; + +function getHangingProtocolModule() { + return [ + { + name: segProtocol.id, + protocol: segProtocol, + }, + ]; +} + +export default getHangingProtocolModule; +export { segProtocol }; diff --git a/extensions/cornerstone-dicom-seg/src/index.tsx b/extensions/cornerstone-dicom-seg/src/index.tsx index e4ea1944c0..b77fb66776 100644 --- a/extensions/cornerstone-dicom-seg/src/index.tsx +++ b/extensions/cornerstone-dicom-seg/src/index.tsx @@ -5,6 +5,7 @@ import { Types } from '@ohif/core'; import getSopClassHandlerModule from './getSopClassHandlerModule'; import PanelSegmentation from './panels/PanelSegmentation'; +import getHangingProtocolModule from './getHangingProtocolModule'; const Component = React.lazy(() => { return import( @@ -30,17 +31,6 @@ const extension = { */ id, - /** - * Perform any pre-registration tasks here. This is called before the extension - * is registered. Usually we run tasks such as: configuring the libraries - * (e.g. cornerstone, cornerstoneTools, ...) or registering any services that - * this extension is providing. - */ - preRegistration: ({ - servicesManager, - commandsManager, - configuration = {}, - }) => {}, /** * PanelModule should provide a list of panels that will be available in OHIF * for Modes to consume and render. Each panel is defined by a {name, @@ -90,6 +80,8 @@ const extension = { * Examples include the default sop class handler provided by the default extension */ getSopClassHandlerModule, + + getHangingProtocolModule, }; export default extension;