ohif-viewer/modes/basic-dev-mode/src/toolbarButtons.ts
Alireza 2bdf4afa4d
refactor(ui): Migrate components to ui-next (#4930)
Co-authored-by: Dan Rukas <dan.rukas@gmail.com>
2025-04-08 12:06:07 -04:00

242 lines
5.2 KiB
TypeScript

import type { Button } from '@ohif/core/types';
export const setToolActiveToolbar = {
commandName: 'setToolActive',
commandOptions: {
toolGroupIds: ['default', 'mpr'],
},
context: 'CORNERSTONE',
};
const toolbarButtons: Button[] = [
// sections
{
id: 'measurementSection',
uiType: 'ohif.toolButtonList',
props: {
buttonSection: 'measurementSection',
groupId: 'measurementSection',
},
},
{
id: 'MoreTools',
uiType: 'ohif.toolButtonList',
props: {
buttonSection: 'moreToolsSection',
groupId: 'MoreTools',
},
},
// tool defs
{
id: 'Length',
uiType: 'ohif.toolButton',
props: {
icon: 'tool-length',
label: 'Length',
tooltip: 'Length Tool',
commands: {
...setToolActiveToolbar,
commandOptions: {
...setToolActiveToolbar.commandOptions,
toolName: 'Length',
},
},
evaluate: 'evaluate.cornerstoneTool',
},
},
{
id: 'Bidirectional',
uiType: 'ohif.toolButton',
props: {
icon: 'tool-bidirectional',
label: 'Bidirectional',
tooltip: 'Bidirectional Tool',
commands: {
...setToolActiveToolbar,
commandOptions: {
...setToolActiveToolbar.commandOptions,
toolName: 'Bidirectional',
},
},
evaluate: 'evaluate.cornerstoneTool',
},
},
{
id: 'EllipticalROI',
uiType: 'ohif.toolButton',
props: {
icon: 'tool-ellipse',
label: 'Ellipse',
tooltip: 'Ellipse ROI',
commands: {
...setToolActiveToolbar,
commandOptions: {
...setToolActiveToolbar.commandOptions,
toolName: 'EllipticalROI',
},
},
evaluate: 'evaluate.cornerstoneTool',
},
},
{
id: 'CircleROI',
uiType: 'ohif.toolButton',
props: {
icon: 'tool-circle',
label: 'Circle',
tooltip: 'Circle Tool',
commands: {
...setToolActiveToolbar,
commandOptions: {
...setToolActiveToolbar.commandOptions,
toolName: 'CircleROI',
},
},
evaluate: 'evaluate.cornerstoneTool',
},
},
{
id: 'Zoom',
uiType: 'ohif.toolButton',
props: {
icon: 'tool-zoom',
label: 'Zoom',
tooltip: 'Zoom',
commands: {
...setToolActiveToolbar,
commandOptions: {
...setToolActiveToolbar.commandOptions,
toolName: 'Zoom',
},
},
evaluate: 'evaluate.cornerstoneTool',
},
},
{
id: 'Pan',
uiType: 'ohif.toolButton',
props: {
icon: 'tool-move',
label: 'Pan',
tooltip: 'Pan',
commands: {
...setToolActiveToolbar,
commandOptions: {
...setToolActiveToolbar.commandOptions,
toolName: 'Pan',
},
},
evaluate: 'evaluate.cornerstoneTool',
},
},
{
id: 'Capture',
uiType: 'ohif.toolButton',
props: {
icon: 'tool-capture',
label: 'Capture',
tooltip: '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: 'Reset',
uiType: 'ohif.toolButton',
props: {
icon: 'tool-reset',
label: 'Reset View',
tooltip: 'Reset View',
commands: 'resetViewport',
evaluate: 'evaluate.action',
},
},
{
id: 'RotateRight',
uiType: 'ohif.toolButton',
props: {
icon: 'tool-rotate-right',
label: 'Rotate Right',
tooltip: 'Rotate Right +90',
commands: 'rotateViewportCW',
evaluate: 'evaluate.action',
},
},
{
id: 'FlipHorizontal',
uiType: 'ohif.toolButton',
props: {
icon: 'tool-flip-horizontal',
label: 'Flip Horizontally',
tooltip: 'Flip Horizontally',
commands: 'flipViewportHorizontal',
evaluate: 'evaluate.action',
},
},
{
id: 'StackScroll',
uiType: 'ohif.toolButton',
props: {
icon: 'tool-stack-scroll',
label: 'Stack Scroll',
tooltip: 'Stack Scroll',
commands: {
...setToolActiveToolbar,
commandOptions: {
...setToolActiveToolbar.commandOptions,
toolName: 'StackScroll',
},
},
evaluate: 'evaluate.cornerstoneTool',
},
},
{
id: 'Invert',
uiType: 'ohif.toolButton',
props: {
icon: 'tool-invert',
label: 'Invert Colors',
tooltip: 'Invert Colors',
commands: 'invertViewport',
evaluate: 'evaluate.action',
},
},
{
id: 'CalibrationLine',
uiType: 'ohif.toolButton',
props: {
icon: 'tool-calibration',
label: 'Calibration Line',
tooltip: 'Calibration Line',
commands: {
...setToolActiveToolbar,
commandOptions: {
...setToolActiveToolbar.commandOptions,
toolName: 'CalibrationLine',
},
},
evaluate: 'evaluate.cornerstoneTool',
},
},
];
export default toolbarButtons;