Skip to content

Commit

Permalink
Add @ohif/seg example
Browse files Browse the repository at this point in the history
  • Loading branch information
wayfarer3130 committed Apr 3, 2023
1 parent 6d98a7a commit 3c002ff
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 11 deletions.
78 changes: 78 additions & 0 deletions extensions/cornerstone-dicom-seg/src/getHangingProtocolModule.ts
Original file line number Diff line number Diff line change
@@ -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 };
14 changes: 3 additions & 11 deletions extensions/cornerstone-dicom-seg/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down Expand Up @@ -90,6 +80,8 @@ const extension = {
* Examples include the default sop class handler provided by the default extension
*/
getSopClassHandlerModule,

getHangingProtocolModule,
};

export default extension;

0 comments on commit 3c002ff

Please sign in to comment.