From 07ca72d0df062e3d609d32b5be6a628998abcc4f Mon Sep 17 00:00:00 2001 From: "James A. Petts" Date: Wed, 13 May 2020 13:22:08 +0100 Subject: [PATCH] Added other required definitions. --- extensions/cornerstone/src/toolbarModule.js | 98 +++++++++++-------- .../default/src/getLayoutTemplateModule.js | 1 + extensions/default/src/getToolbarModule.js | 19 ++++ extensions/default/src/index.js | 2 + modes/example/src/index.js | 42 ++++++-- 5 files changed, 112 insertions(+), 50 deletions(-) create mode 100644 extensions/default/src/getToolbarModule.js diff --git a/extensions/cornerstone/src/toolbarModule.js b/extensions/cornerstone/src/toolbarModule.js index a06893ad5..72cd0194d 100644 --- a/extensions/cornerstone/src/toolbarModule.js +++ b/extensions/cornerstone/src/toolbarModule.js @@ -35,15 +35,7 @@ const enums = { }; const definitions = [ - { - id: 'StackScroll', - label: 'Stack Scroll', - icon: 'bars', - // - type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE, - commandName: 'setToolActive', - commandOptions: { toolName: 'StackScroll' }, - }, + // UPDATED { id: 'Zoom', label: 'Zoom', @@ -56,7 +48,7 @@ const definitions = [ { id: 'Wwwc', label: 'Levels', - icon: 'level', + icon: 'tool-window-level', // type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE, commandName: 'setToolActive', @@ -65,30 +57,70 @@ const definitions = [ { id: 'Pan', label: 'Pan', - icon: 'arrows', + icon: 'tool-move', // type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE, commandName: 'setToolActive', commandOptions: { toolName: 'Pan' }, }, { - id: 'Length', - label: 'Length', - icon: 'measure-temp', + id: 'Capture', + label: 'Capture', + icon: 'tool-capture', // - type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE, - commandName: 'setToolActive', - commandOptions: { toolName: 'Length' }, + type: TOOLBAR_BUTTON_TYPES.BUILT_IN, + options: { + behavior: TOOLBAR_BUTTON_BEHAVIORS.DOWNLOAD_SCREEN_SHOT, + togglable: true, + }, }, { - id: 'ArrowAnnotate', + id: 'Annotate', label: 'Annotate', - icon: 'measure-non-target', + icon: 'tool-annotate', // type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE, commandName: 'setToolActive', commandOptions: { toolName: 'ArrowAnnotate' }, }, + { + id: 'Bidirectional', + label: 'Bidirectional', + icon: 'tool-bidirectional', + // + type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE, + commandName: 'setToolActive', + commandOptions: { toolName: 'Bidirectional' }, + }, + { + id: 'Ellipse', + label: 'Ellipse', + icon: 'tool-elipse', + // + type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE, + commandName: 'setToolActive', + commandOptions: { toolName: 'EllipticalRoi' }, + }, + { + id: 'Length', + label: 'Length', + icon: 'tool-length', + // + type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE, + commandName: 'setToolActive', + commandOptions: { toolName: 'Length' }, + }, + // OLD + { + id: 'StackScroll', + label: 'Stack Scroll', + icon: 'bars', + // + type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE, + commandName: 'setToolActive', + commandOptions: { toolName: 'StackScroll' }, + }, + { id: 'Angle', label: 'Angle', @@ -148,15 +180,6 @@ const definitions = [ commandName: 'setToolActive', commandOptions: { toolName: 'DragProbe' }, }, - { - id: 'EllipticalRoi', - label: 'Ellipse', - icon: 'circle-o', - // - type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE, - commandName: 'setToolActive', - commandOptions: { toolName: 'EllipticalRoi' }, - }, { id: 'RectangleRoi', label: 'Rectangle', @@ -207,24 +230,13 @@ const definitions = [ commandName: 'clearAnnotations', }, { - id: 'Bidirectional', - label: 'Bidirectional', - icon: 'measure-target', + id: 'Eraser', + label: 'Eraser', + icon: 'eraser', // type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE, commandName: 'setToolActive', - commandOptions: { toolName: 'Bidirectional' }, - }, - { - id: 'Download', - label: 'Download', - icon: 'create-screen-capture', - // - type: TOOLBAR_BUTTON_TYPES.BUILT_IN, - options: { - behavior: TOOLBAR_BUTTON_BEHAVIORS.DOWNLOAD_SCREEN_SHOT, - togglable: true, - }, + commandOptions: { toolName: 'Eraser' }, }, ], }, diff --git a/extensions/default/src/getLayoutTemplateModule.js b/extensions/default/src/getLayoutTemplateModule.js index a2c0d1d61..4a256b2f4 100644 --- a/extensions/default/src/getLayoutTemplateModule.js +++ b/extensions/default/src/getLayoutTemplateModule.js @@ -30,6 +30,7 @@ const Header = ({ tools, moreTools }) => { { name: 'Bone', value: '2500 / 480' }, { name: 'Brain', value: '80 / 40' }, ]; + /* const tools = [ { diff --git a/extensions/default/src/getToolbarModule.js b/extensions/default/src/getToolbarModule.js new file mode 100644 index 000000000..3cf8b00c0 --- /dev/null +++ b/extensions/default/src/getToolbarModule.js @@ -0,0 +1,19 @@ +const TOOLBAR_BUTTON_TYPES = { + COMMAND: 'command', + SET_TOOL_ACTIVE: 'setToolActive', + BUILT_IN: 'builtIn', +}; + +const definitions = [ + { + id: 'Layout', + label: 'Layout', + icon: 'tool-layout', + commandName: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE, + commandOptions: { toolName: 'Layout' }, // TODO + }, +]; + +export default function getToolbarModule() { + return { definitions, defaultContext: 'ACTIVE_VIEWPORT::CORNERSTONE' }; +} diff --git a/extensions/default/src/index.js b/extensions/default/src/index.js index 94267402f..a426be014 100644 --- a/extensions/default/src/index.js +++ b/extensions/default/src/index.js @@ -3,6 +3,7 @@ import getDataSourcesModule from './getDataSourcesModule.js'; import getLayoutTemplateModule from './getLayoutTemplateModule.js'; import getPanelModule from './getPanelModule.js'; import getSopClassHandlerModule from './getSopClassHandlerModule.js'; +import getToolbarModule from './getToolbarModule.js'; import id from './id'; export default { @@ -15,4 +16,5 @@ export default { getLayoutTemplateModule, getPanelModule, getSopClassHandlerModule, + getToolbarModule, }; diff --git a/modes/example/src/index.js b/modes/example/src/index.js index b6e91f746..0de0b3f02 100644 --- a/modes/example/src/index.js +++ b/modes/example/src/index.js @@ -14,14 +14,42 @@ export default function mode({ modeConfiguration }) { path: 'viewer', init: ({ toolBarManager }) => { toolBarManager.addButtons([ - { - id: 'StackScroll', // If id not given will use default in button definition. - namespace: 'org.ohif.cornerstone.toolbarModule.StackScroll', - }, { id: 'Zoom', namespace: 'org.ohif.cornerstone.toolbarModule.Zoom', }, + { + id: 'Levels', + namespace: 'org.ohif.cornerstone.toolbarModule.Wwwc', + }, + { + id: 'Pan', + namespace: 'org.ohif.cornerstone.toolbarModule.Pan', + }, + { + id: 'Capture', + namespace: 'org.ohif.cornerstone.toolbarModule.Capture', + }, + { + id: 'Layout', + namespace: 'org.ohif.default.toolbarModule.Layout', + }, + { + id: 'Annotate', + namespace: 'org.ohif.cornerstone.toolbarModule.Annotate', + }, + { + id: 'Bidirectional', + namespace: 'org.ohif.cornerstone.toolbarModule.Bidirectional', + }, + { + id: 'Ellipse', + namespace: 'org.ohif.cornerstone.toolbarModule.Ellipse', + }, + { + id: 'Length', + namespace: 'org.ohif.cornerstone.toolbarModule.Length', + }, ]); debugger; @@ -30,12 +58,12 @@ export default function mode({ modeConfiguration }) { toolBarManager.setToolBarLayout([ // Primary { - tools: ['Zoom'], - moreTools: ['Zoom'], + tools: ['Zoom', 'Levels', 'Pan', 'Capture', 'Layout'], + moreTools: ['Zoom', 'Levels', 'Pan', 'Capture', 'Layout'], }, // Secondary { - tools: ['Zoom'], + tools: ['Annotate', 'Bidirectional', 'Ellipse', 'Length'], }, ]); },