import { toolGroupIds } from './initToolGroups'; import { ViewportGridService } from '@ohif/core'; import i18n from 'i18next'; const setToolActiveToolbar = { commandName: 'setToolActiveToolbar', commandOptions: { toolGroupIds: [toolGroupIds.PT, toolGroupIds.CT, toolGroupIds.Fusion, toolGroupIds.default], }, }; const callbacks = (toolName: string) => [ { commandName: 'setViewportForToolConfiguration', commandOptions: { toolName, }, }, ]; const toolbarButtons = [ { id: 'MeasurementTools', uiType: 'ohif.toolButtonList', props: { buttonSection: true, }, }, { id: 'BrushTools', uiType: 'ohif.toolBoxButtonGroup', props: { buttonSection: true, }, }, { id: 'SegmentationTools', uiType: 'ohif.toolBoxButton', props: { buttonSection: true, }, }, { id: 'AdvancedRenderingControls', uiType: 'ohif.advancedRenderingControls', props: { buttonSection: true, }, }, { id: 'modalityLoadBadge', uiType: 'ohif.modalityLoadBadge', props: { icon: 'Status', label: i18n.t('Buttons:Status'), tooltip: i18n.t('Buttons:Status'), evaluate: { name: 'evaluate.modalityLoadBadge', hideWhenDisabled: true, }, }, }, { id: 'navigationComponent', uiType: 'ohif.navigationComponent', props: { icon: 'Navigation', label: i18n.t('Buttons:Navigation'), tooltip: i18n.t('Buttons:Navigate between segments/measurements and manage their visibility'), evaluate: { name: 'evaluate.navigationComponent', hideWhenDisabled: true, }, }, }, { id: 'windowLevelMenuEmbedded', uiType: 'ohif.windowLevelMenuEmbedded', props: { icon: 'WindowLevel', label: i18n.t('Buttons:Window Level'), tooltip: i18n.t('Buttons:Adjust window/level presets and customize image contrast settings'), evaluate: { name: 'evaluate.windowLevelMenuEmbedded', hideWhenDisabled: true, }, }, }, { id: 'trackingStatus', uiType: 'ohif.trackingStatus', props: { icon: 'TrackingStatus', label: i18n.t('Buttons:Tracking Status'), tooltip: i18n.t('Buttons:View and manage tracking status of measurements and annotations'), evaluate: { name: 'evaluate.trackingStatus', hideWhenDisabled: true, }, }, }, { id: 'Length', uiType: 'ohif.toolButton', props: { icon: 'tool-length', label: i18n.t('Buttons:Length'), tooltip: i18n.t('Buttons:Length Tool'), commands: setToolActiveToolbar, evaluate: 'evaluate.cornerstoneTool', }, }, { id: 'Bidirectional', uiType: 'ohif.toolButton', props: { icon: 'tool-bidirectional', label: i18n.t('Buttons:Bidirectional'), tooltip: i18n.t('Buttons:Bidirectional Tool'), commands: setToolActiveToolbar, evaluate: 'evaluate.cornerstoneTool', }, }, { id: 'ArrowAnnotate', uiType: 'ohif.toolButton', props: { icon: 'tool-annotate', label: i18n.t('Buttons:Annotation'), tooltip: i18n.t('Buttons:Arrow Annotate'), commands: setToolActiveToolbar, evaluate: 'evaluate.cornerstoneTool', }, }, { id: 'EllipticalROI', uiType: 'ohif.toolButton', props: { icon: 'tool-ellipse', label: i18n.t('Buttons:Ellipse'), tooltip: i18n.t('Buttons:Ellipse ROI'), commands: setToolActiveToolbar, evaluate: 'evaluate.cornerstoneTool', }, }, { id: 'Zoom', uiType: 'ohif.toolButton', props: { icon: 'tool-zoom', label: i18n.t('Buttons:Zoom'), commands: setToolActiveToolbar, evaluate: 'evaluate.cornerstoneTool', }, }, { id: 'WindowLevel', uiType: 'ohif.toolButton', props: { icon: 'tool-window-level', label: i18n.t('Buttons:Window Level'), commands: setToolActiveToolbar, evaluate: 'evaluate.cornerstoneTool', }, }, { id: 'Pan', uiType: 'ohif.toolButton', props: { type: 'tool', icon: 'tool-move', label: i18n.t('Buttons:Pan'), commands: setToolActiveToolbar, evaluate: 'evaluate.cornerstoneTool', }, }, { id: 'TrackballRotate', uiType: 'ohif.toolButton', props: { type: 'tool', icon: 'tool-3d-rotate', label: i18n.t('Buttons:3D Rotate'), commands: setToolActiveToolbar, evaluate: 'evaluate.cornerstoneTool', }, }, { id: 'Capture', uiType: 'ohif.toolButton', props: { icon: 'tool-capture', label: i18n.t('Buttons:Capture'), commands: 'showDownloadViewportModal', evaluate: [ 'evaluate.action', { name: 'evaluate.viewport.supported', unsupportedViewportTypes: ['video', 'wholeSlide'], }, ], }, }, { id: 'Layout', uiType: 'ohif.layoutSelector', props: { rows: 3, columns: 4, evaluate: 'evaluate.action', commands: 'setViewportGridLayout', }, }, { id: 'Crosshairs', uiType: 'ohif.toolButton', props: { type: 'tool', icon: 'tool-crosshair', label: i18n.t('Buttons:Crosshairs'), commands: setToolActiveToolbar, evaluate: 'evaluate.cornerstoneTool', }, }, { id: 'ProgressDropdown', uiType: 'ohif.progressDropdown', }, { id: 'RectangleROIStartEndThreshold', uiType: 'ohif.toolBoxButton', props: { icon: 'tool-create-threshold', label: i18n.t('Buttons:Rectangle ROI Threshold'), commands: setToolActiveToolbar, evaluate: { name: 'evaluate.cornerstone.segmentation', toolNames: ['RectangleROIStartEndThreshold'], }, options: 'tmtv.RectangleROIThresholdOptions', }, }, { id: 'Brush', uiType: 'ohif.toolButton', props: { icon: 'icon-tool-brush', label: i18n.t('Buttons:Brush'), evaluate: { name: 'evaluate.cornerstone.segmentation', toolNames: ['CircularBrush', 'SphereBrush'], }, options: [ { name: 'Size (mm)', id: 'brush-radius', type: 'range', min: 0.5, max: 99.5, step: 0.5, value: 7, commands: { commandName: 'setBrushSize', commandOptions: { toolNames: ['CircularBrush', 'SphereBrush'] }, }, }, { name: 'Shape', type: 'radio', id: 'brush-mode', value: 'CircularBrush', values: [ { value: 'CircularBrush', label: 'Circle' }, { value: 'SphereBrush', label: 'Sphere' }, ], commands: 'setToolActiveToolbar', }, ], }, }, { id: 'Eraser', uiType: 'ohif.toolButton', props: { icon: 'icon-tool-eraser', label: i18n.t('Buttons:Eraser'), evaluate: { name: 'evaluate.cornerstone.segmentation', toolNames: ['CircularEraser', 'SphereEraser'], }, options: [ { name: 'Radius (mm)', id: 'eraser-radius', type: 'range', min: 0.5, max: 99.5, step: 0.5, value: 7, commands: { commandName: 'setBrushSize', commandOptions: { toolNames: ['CircularEraser', 'SphereEraser'] }, }, }, { name: 'Shape', type: 'radio', id: 'eraser-mode', value: 'CircularEraser', values: [ { value: 'CircularEraser', label: 'Circle' }, { value: 'SphereEraser', label: 'Sphere' }, ], commands: 'setToolActiveToolbar', }, ], }, }, { id: 'Threshold', uiType: 'ohif.toolButton', props: { icon: 'icon-tool-threshold', label: i18n.t('Buttons:Threshold'), evaluate: { name: 'evaluate.cornerstone.segmentation', toolNames: ['ThresholdCircularBrush', 'ThresholdSphereBrush'], }, options: [ { name: 'Radius (mm)', id: 'threshold-radius', type: 'range', min: 0.5, max: 99.5, step: 0.5, value: 7, commands: { commandName: 'setBrushSize', commandOptions: { toolNames: ['ThresholdCircularBrush', 'ThresholdSphereBrush'], }, }, }, { name: 'Shape', type: 'radio', id: 'eraser-mode', value: 'ThresholdCircularBrush', values: [ { value: 'ThresholdCircularBrush', label: 'Circle' }, { value: 'ThresholdSphereBrush', label: 'Sphere' }, ], commands: 'setToolActiveToolbar', }, { name: 'ThresholdRange', type: 'double-range', id: 'threshold-range', min: 0, max: 100, step: 0.5, value: [2, 50], commands: { commandName: 'setThresholdRange', commandOptions: { toolNames: ['ThresholdCircularBrush', 'ThresholdSphereBrush'], }, }, }, ], }, }, { id: 'Shapes', uiType: 'ohif.toolBoxButton', props: { label: 'Shapes', evaluate: { name: 'evaluate.cornerstone.segmentation', toolNames: ['CircleScissor', 'SphereScissor', 'RectangleScissor'], }, icon: 'icon-tool-shape', options: [ { name: 'Shape', type: 'radio', value: 'CircleScissor', id: 'shape-mode', values: [ { value: 'CircleScissor', label: 'Circle' }, { value: 'SphereScissor', label: 'Sphere' }, { value: 'RectangleScissor', label: 'Rectangle' }, ], commands: 'setToolActiveToolbar', }, ], }, }, { id: 'dataOverlayMenu', uiType: 'ohif.dataOverlayMenu', props: { icon: 'ViewportViews', label: i18n.t('Buttons:Data Overlay'), tooltip: i18n.t( 'Buttons:Configure data overlay options and manage foreground/background display sets' ), evaluate: 'evaluate.dataOverlayMenu', }, }, { id: 'orientationMenu', uiType: 'ohif.orientationMenu', props: { icon: 'OrientationSwitch', label: i18n.t('Buttons:Orientation'), tooltip: i18n.t( 'Buttons:Change viewport orientation between axial, sagittal, coronal and reformat planes' ), evaluate: { name: 'evaluate.orientationMenu', // hideWhenDisabled: true, }, }, }, { id: 'windowLevelMenu', uiType: 'ohif.windowLevelMenu', props: { icon: 'WindowLevel', label: i18n.t('Buttons:Window Level'), tooltip: i18n.t('Buttons:Adjust window/level presets and customize image contrast settings'), evaluate: 'evaluate.windowLevelMenu', }, }, { id: 'voiManualControlMenu', uiType: 'ohif.voiManualControlMenu', props: { icon: 'WindowLevelAdvanced', label: i18n.t('Buttons:Advanced Window Level'), tooltip: i18n.t('Buttons:Advanced window/level settings with manual controls and presets'), evaluate: 'evaluate.voiManualControlMenu', }, }, { id: 'thresholdMenu', uiType: 'ohif.thresholdMenu', props: { icon: 'Threshold', label: i18n.t('Buttons:Threshold'), tooltip: i18n.t('Buttons:Image threshold settings'), evaluate: { name: 'evaluate.thresholdMenu', hideWhenDisabled: true, }, }, }, { id: 'opacityMenu', uiType: 'ohif.opacityMenu', props: { icon: 'Opacity', label: i18n.t('Buttons:Opacity'), tooltip: i18n.t('Buttons:Image opacity settings'), evaluate: { name: 'evaluate.opacityMenu', hideWhenDisabled: true, }, }, }, { id: 'Colorbar', uiType: 'ohif.colorbar', props: { type: 'tool', label: i18n.t('Buttons:Colorbar'), }, }, ]; export default toolbarButtons;