From 14dabaabf69b5f27f39a8fcd75d27a08f50e16e9 Mon Sep 17 00:00:00 2001 From: dannyrb Date: Thu, 7 May 2020 14:00:59 -0400 Subject: [PATCH] layout template and side panel defaults Co-authored-by: James Petts Co-authored-by: Erik Ziegler --- .../default/src/getLayoutTemplatesModule.js | 280 ++++++++++++++++++ extensions/default/src/getSidePanelModule.js | 20 ++ extensions/default/src/index.js | 6 + 3 files changed, 306 insertions(+) create mode 100644 extensions/default/src/getLayoutTemplatesModule.js create mode 100644 extensions/default/src/getSidePanelModule.js diff --git a/extensions/default/src/getLayoutTemplatesModule.js b/extensions/default/src/getLayoutTemplatesModule.js new file mode 100644 index 000000000..cfbc938de --- /dev/null +++ b/extensions/default/src/getLayoutTemplatesModule.js @@ -0,0 +1,280 @@ +import React, { useState } from 'react'; + +import { SidePanel, NavBar, Svg, Icon, IconButton, Toolbar } from '@ohif/ui'; + +export default function() { + return [ + // Layout Template Definition + { + name: 'myLayout', + component: viewerLayout, + }, + ]; +} + +/* { + id: 'org.ohif.defaults.viewerLayout', + props: { + leftPanelIds: ['org.ohif.defaults.seriesList'], + rightPanelIds: ['org.ohif.defaults.measure'], + }, + }, + */ + +const Header = () => { + const [activeTool, setActiveTool] = useState('Zoom'); + const dropdownContent = [ + { + name: 'Soft tissue', + value: '400/40', + }, + { name: 'Lung', value: '1500 / -600' }, + { name: 'Liver', value: '150 / 90' }, + { name: 'Bone', value: '2500 / 480' }, + { name: 'Brain', value: '80 / 40' }, + ]; + const tools = [ + { + id: 'Zoom', + label: 'Zoom', + icon: 'tool-zoom', + commandName: 'setToolActive', + commandOptions: { toolName: 'Zoom' }, + onClick: () => setActiveTool('Zoom'), + }, + { + id: 'Wwwc', + label: 'Levels', + icon: 'tool-window-level', + commandName: 'setToolActive', + commandOptions: { toolName: 'Wwwc' }, + onClick: () => setActiveTool('Wwwc'), + dropdownContent: ( +
+ {dropdownContent.map((row, i) => ( +
+
+ {row.name} + + {row.value} + +
+ {i} +
+ ))} +
+ ), + }, + { + id: 'Pan', + label: 'Pan', + icon: 'tool-move', + commandName: 'setToolActive', + commandOptions: { toolName: 'Pan' }, + onClick: () => setActiveTool('Pan'), + }, + { + id: 'Capture', + label: 'Capture', + icon: 'tool-capture', + commandName: 'setToolActive', + commandOptions: { toolName: 'Capture' }, + onClick: () => setActiveTool('Capture'), + }, + { + id: 'Layout', + label: 'Layout', + icon: 'tool-layout', + commandName: 'setToolActive', + commandOptions: { toolName: 'Layout' }, + onClick: () => setActiveTool('Layout'), + }, + ]; + return ( + +
+
+
+ alert('Navigate to previous page')} + /> + + + +
+
+
+ +
+
+ + FOR INVESTIGATIONAL USE ONLY + + {}} + > + + + + +
+
+
+ ); +}; + +const ViewportToolbar = () => { + const tools = [ + { + id: 'Annotate', + label: 'Annotate', + icon: 'tool-annotate', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Annotate' }, + onClick: () => console.log('Activate Annotate'), + }, + { + id: 'Bidirectional', + label: 'Bidirectional', + icon: 'tool-bidirectional', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Bidirectional' }, + onClick: () => console.log('Activate Bidirectional'), + }, + { + id: 'Elipse', + label: 'Elipse', + icon: 'tool-elipse', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Elipse' }, + onClick: () => console.log('Activate Elipse'), + }, + { + id: 'Length', + label: 'Length', + icon: 'tool-length', + type: null, + commandName: 'setToolActive', + commandOptions: { toolName: 'Length' }, + onClick: () => console.log('Activate Length'), + }, + ]; + return ; +}; + +function viewerLayout({ leftPanels, rightPanels, extensionManager }) { + const getPanelData = id => { + const entry = extensionManager.getModuleEntry(id); + return { + iconName: entry.iconName, + iconLabel: entry.iconLabel, + label: entry.label, + name: entry.name, + content: entry.component, + }; + }; + + const leftPanelComponents = leftPanels.map(getPanelData); + const rightPanelComponents = rightPanels.map(getPanelData); + + return ( +
+
+
+ +
+
+ +
+
+ {/* alert(`Series ${direction}`)} + studyData={{ + label: 'A', + isTracked: true, + isLocked: false, + studyDate: '07-Sep-2011', + currentSeries: 1, + seriesDescription: + 'Series description lorem ipsum dolor sit Series description lorem ipsum dolor sit Series description lorem ipsum dolor sit ', + modality: 'CT', + patientInformation: { + patientName: 'Smith, Jane', + patientSex: 'F', + patientAge: '59', + MRN: '10000001', + thickness: '5.0mm', + spacing: '1.25mm', + scanner: 'Aquilion', + }, + }} + > +
+ CONTENT +
+ , + alert(`Series ${direction}`)} + studyData={{ + label: 'A', + isTracked: false, + isLocked: true, + studyDate: '07-Sep-2010', + currentSeries: 2, + seriesDescription: + 'Series description lorem ipsum dolor sit Series description lorem ipsum dolor sit Series description lorem ipsum dolor sit ', + modality: 'SR', + patientInformation: { + patientName: 'Smith, Jane', + patientSex: 'F', + patientAge: '59', + MRN: '10000001', + thickness: '2.0mm', + spacing: '1.25mm', + scanner: 'Aquilion', + }, + }} + > +
+ CONTENT +
+
, + ]} + setActiveViewportIndex={setActiveViewportIndex} + activeViewportIndex={activeViewportIndex} + />*/} +
+
+ +
+
+ ); +} diff --git a/extensions/default/src/getSidePanelModule.js b/extensions/default/src/getSidePanelModule.js new file mode 100644 index 000000000..8c1eae334 --- /dev/null +++ b/extensions/default/src/getSidePanelModule.js @@ -0,0 +1,20 @@ +import React from 'react'; + +function helloWorldComponent() { + return
{'Hello world'}
; +} + +function getSidePanelModule() { + return [ + { + name: 'org.ohif.defaults.seriesList', + component: helloWorldComponent, + }, + { + name: 'org.ohif.defaults.measure', + component: helloWorldComponent, + }, + ]; +} + +export default getSidePanelModule; diff --git a/extensions/default/src/index.js b/extensions/default/src/index.js index 13e977231..4543d51f2 100644 --- a/extensions/default/src/index.js +++ b/extensions/default/src/index.js @@ -1,9 +1,15 @@ +import getContextModule from './getContextModule.js'; import getDataSourcesModule from './getDataSourcesModule.js'; +import getLayoutTemplatesModule from './getLayoutTemplatesModule.js'; +import getSidePanelModule from './getSidePanelModule.js'; export default { /** * Only required property. Should be a unique value across all extensions. */ id: 'org.ohif.default', + getContextModule, getDataSourcesModule, + getLayoutTemplatesModule, + getSidePanelModule, };