2024-03-27 21:01:32 +01:00
|
|
|
import type { Button } from '@ohif/core/types';
|
2025-09-25 16:22:02 +02:00
|
|
|
import i18n from 'i18next';
|
2022-07-27 18:39:04 +02:00
|
|
|
|
2025-03-07 04:19:47 +01:00
|
|
|
export const setToolActiveToolbar = {
|
|
|
|
|
commandName: 'setToolActive',
|
|
|
|
|
commandOptions: {
|
|
|
|
|
toolGroupIds: ['default', 'mpr'],
|
|
|
|
|
},
|
|
|
|
|
context: 'CORNERSTONE',
|
|
|
|
|
};
|
2024-03-27 21:01:32 +01:00
|
|
|
|
|
|
|
|
const toolbarButtons: Button[] = [
|
2025-03-07 04:19:47 +01:00
|
|
|
// sections
|
|
|
|
|
{
|
2025-05-16 19:42:35 +02:00
|
|
|
id: 'MeasurementTools',
|
2025-03-07 04:19:47 +01:00
|
|
|
uiType: 'ohif.toolButtonList',
|
|
|
|
|
props: {
|
2025-05-16 19:42:35 +02:00
|
|
|
buttonSection: true,
|
2025-03-07 04:19:47 +01:00
|
|
|
},
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
{
|
2025-03-07 04:19:47 +01:00
|
|
|
id: 'MoreTools',
|
2025-01-29 19:36:52 +01:00
|
|
|
uiType: 'ohif.toolButtonList',
|
2022-07-27 18:39:04 +02:00
|
|
|
props: {
|
2025-05-16 19:42:35 +02:00
|
|
|
buttonSection: true,
|
2025-03-07 04:19:47 +01:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// tool defs
|
|
|
|
|
{
|
|
|
|
|
id: 'Length',
|
|
|
|
|
uiType: 'ohif.toolButton',
|
|
|
|
|
props: {
|
|
|
|
|
icon: 'tool-length',
|
2025-09-25 16:22:02 +02:00
|
|
|
label: i18n.t('Buttons:Length'),
|
|
|
|
|
tooltip: i18n.t('Buttons:Length Tool'),
|
2025-03-07 04:19:47 +01:00
|
|
|
commands: {
|
|
|
|
|
...setToolActiveToolbar,
|
|
|
|
|
commandOptions: {
|
|
|
|
|
...setToolActiveToolbar.commandOptions,
|
|
|
|
|
toolName: 'Length',
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
},
|
2025-03-07 04:19:47 +01:00
|
|
|
evaluate: 'evaluate.cornerstoneTool',
|
2022-07-27 18:39:04 +02:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-07 04:19:47 +01:00
|
|
|
id: 'Bidirectional',
|
2025-01-29 19:36:52 +01:00
|
|
|
uiType: 'ohif.toolButton',
|
2022-07-27 18:39:04 +02:00
|
|
|
props: {
|
2025-03-07 04:19:47 +01:00
|
|
|
icon: 'tool-bidirectional',
|
2025-09-25 16:22:02 +02:00
|
|
|
label: i18n.t('Buttons:Bidirectional'),
|
|
|
|
|
tooltip: i18n.t('Buttons:Bidirectional Tool'),
|
2025-03-07 04:19:47 +01:00
|
|
|
commands: {
|
|
|
|
|
...setToolActiveToolbar,
|
|
|
|
|
commandOptions: {
|
|
|
|
|
...setToolActiveToolbar.commandOptions,
|
|
|
|
|
toolName: 'Bidirectional',
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-03-27 21:01:32 +01:00
|
|
|
evaluate: 'evaluate.cornerstoneTool',
|
2022-07-27 18:39:04 +02:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-07 04:19:47 +01:00
|
|
|
id: 'EllipticalROI',
|
|
|
|
|
uiType: 'ohif.toolButton',
|
2022-07-27 18:39:04 +02:00
|
|
|
props: {
|
2025-03-07 04:19:47 +01:00
|
|
|
icon: 'tool-ellipse',
|
2025-09-25 16:22:02 +02:00
|
|
|
label: i18n.t('Buttons:Ellipse'),
|
|
|
|
|
tooltip: i18n.t('Buttons:Ellipse ROI'),
|
2025-03-07 04:19:47 +01:00
|
|
|
commands: {
|
|
|
|
|
...setToolActiveToolbar,
|
|
|
|
|
commandOptions: {
|
|
|
|
|
...setToolActiveToolbar.commandOptions,
|
|
|
|
|
toolName: 'EllipticalROI',
|
|
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
},
|
2025-03-07 04:19:47 +01:00
|
|
|
evaluate: 'evaluate.cornerstoneTool',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'CircleROI',
|
|
|
|
|
uiType: 'ohif.toolButton',
|
|
|
|
|
props: {
|
|
|
|
|
icon: 'tool-circle',
|
2025-09-25 16:22:02 +02:00
|
|
|
label: i18n.t('Buttons:Circle'),
|
|
|
|
|
tooltip: i18n.t('Buttons:Circle Tool'),
|
2025-03-07 04:19:47 +01:00
|
|
|
commands: {
|
|
|
|
|
...setToolActiveToolbar,
|
|
|
|
|
commandOptions: {
|
|
|
|
|
...setToolActiveToolbar.commandOptions,
|
|
|
|
|
toolName: 'CircleROI',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
evaluate: 'evaluate.cornerstoneTool',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'Zoom',
|
|
|
|
|
uiType: 'ohif.toolButton',
|
|
|
|
|
props: {
|
|
|
|
|
icon: 'tool-zoom',
|
2025-09-25 16:22:02 +02:00
|
|
|
label: i18n.t('Buttons:Zoom'),
|
|
|
|
|
tooltip: i18n.t('Buttons:Zoom'),
|
2025-03-07 04:19:47 +01:00
|
|
|
commands: {
|
|
|
|
|
...setToolActiveToolbar,
|
|
|
|
|
commandOptions: {
|
|
|
|
|
...setToolActiveToolbar.commandOptions,
|
|
|
|
|
toolName: 'Zoom',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
evaluate: 'evaluate.cornerstoneTool',
|
2022-07-27 18:39:04 +02:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'Pan',
|
2025-01-29 19:36:52 +01:00
|
|
|
uiType: 'ohif.toolButton',
|
2022-07-27 18:39:04 +02:00
|
|
|
props: {
|
|
|
|
|
icon: 'tool-move',
|
2025-09-25 16:22:02 +02:00
|
|
|
label: i18n.t('Buttons:Pan'),
|
|
|
|
|
tooltip: i18n.t('Buttons:Pan'),
|
2025-03-07 04:19:47 +01:00
|
|
|
commands: {
|
|
|
|
|
...setToolActiveToolbar,
|
|
|
|
|
commandOptions: {
|
|
|
|
|
...setToolActiveToolbar.commandOptions,
|
|
|
|
|
toolName: 'Pan',
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-03-27 21:01:32 +01:00
|
|
|
evaluate: 'evaluate.cornerstoneTool',
|
2022-07-27 18:39:04 +02:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'Capture',
|
2025-01-29 19:36:52 +01:00
|
|
|
uiType: 'ohif.toolButton',
|
2022-07-27 18:39:04 +02:00
|
|
|
props: {
|
|
|
|
|
icon: 'tool-capture',
|
2025-09-25 16:22:02 +02:00
|
|
|
label: i18n.t('Buttons:Capture'),
|
|
|
|
|
tooltip: i18n.t('Buttons:Capture'),
|
2025-03-07 04:19:47 +01:00
|
|
|
commands: 'showDownloadViewportModal',
|
2024-11-11 20:28:34 +01:00
|
|
|
evaluate: [
|
|
|
|
|
'evaluate.action',
|
|
|
|
|
{
|
|
|
|
|
name: 'evaluate.viewport.supported',
|
|
|
|
|
unsupportedViewportTypes: ['video', 'wholeSlide'],
|
|
|
|
|
},
|
|
|
|
|
],
|
2022-07-27 18:39:04 +02:00
|
|
|
},
|
|
|
|
|
},
|
2025-01-10 21:05:35 +01:00
|
|
|
{
|
2022-07-27 18:39:04 +02:00
|
|
|
id: 'Layout',
|
2024-03-27 21:01:32 +01:00
|
|
|
uiType: 'ohif.layoutSelector',
|
|
|
|
|
props: {
|
|
|
|
|
rows: 3,
|
2024-03-28 15:40:32 +01:00
|
|
|
columns: 4,
|
2024-03-27 21:01:32 +01:00
|
|
|
evaluate: 'evaluate.action',
|
2025-03-07 04:19:47 +01:00
|
|
|
commands: 'setViewportGridLayout',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
id: 'Reset',
|
|
|
|
|
uiType: 'ohif.toolButton',
|
|
|
|
|
props: {
|
|
|
|
|
icon: 'tool-reset',
|
2025-09-25 16:22:02 +02:00
|
|
|
label: i18n.t('Buttons:Reset View'),
|
|
|
|
|
tooltip: i18n.t('Buttons:Reset View'),
|
2025-03-07 04:19:47 +01:00
|
|
|
commands: 'resetViewport',
|
|
|
|
|
evaluate: 'evaluate.action',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'RotateRight',
|
|
|
|
|
uiType: 'ohif.toolButton',
|
|
|
|
|
props: {
|
|
|
|
|
icon: 'tool-rotate-right',
|
2025-09-25 16:22:02 +02:00
|
|
|
label: i18n.t('Buttons:Rotate Right'),
|
|
|
|
|
tooltip: i18n.t('Buttons:Rotate Right +90'),
|
2025-03-07 04:19:47 +01:00
|
|
|
commands: 'rotateViewportCW',
|
|
|
|
|
evaluate: 'evaluate.action',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'FlipHorizontal',
|
|
|
|
|
uiType: 'ohif.toolButton',
|
|
|
|
|
props: {
|
|
|
|
|
icon: 'tool-flip-horizontal',
|
2025-09-25 16:22:02 +02:00
|
|
|
label: i18n.t('Buttons:Flip Horizontally'),
|
|
|
|
|
tooltip: i18n.t('Buttons:Flip Horizontally'),
|
2025-03-07 04:19:47 +01:00
|
|
|
commands: 'flipViewportHorizontal',
|
|
|
|
|
evaluate: 'evaluate.action',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'StackScroll',
|
|
|
|
|
uiType: 'ohif.toolButton',
|
|
|
|
|
props: {
|
|
|
|
|
icon: 'tool-stack-scroll',
|
2025-09-25 16:22:02 +02:00
|
|
|
label: i18n.t('Buttons:Stack Scroll'),
|
|
|
|
|
tooltip: i18n.t('Buttons:Stack Scroll'),
|
2025-03-07 04:19:47 +01:00
|
|
|
commands: {
|
|
|
|
|
...setToolActiveToolbar,
|
|
|
|
|
commandOptions: {
|
|
|
|
|
...setToolActiveToolbar.commandOptions,
|
|
|
|
|
toolName: 'StackScroll',
|
2024-03-27 21:01:32 +01:00
|
|
|
},
|
2025-03-07 04:19:47 +01:00
|
|
|
},
|
|
|
|
|
evaluate: 'evaluate.cornerstoneTool',
|
2024-03-27 21:01:32 +01:00
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
},
|
|
|
|
|
{
|
2025-03-07 04:19:47 +01:00
|
|
|
id: 'Invert',
|
|
|
|
|
uiType: 'ohif.toolButton',
|
2025-01-10 21:05:35 +01:00
|
|
|
props: {
|
2025-03-07 04:19:47 +01:00
|
|
|
icon: 'tool-invert',
|
2025-09-25 16:22:02 +02:00
|
|
|
label: i18n.t('Buttons:Invert Colors'),
|
|
|
|
|
tooltip: i18n.t('Buttons:Invert Colors'),
|
2025-03-07 04:19:47 +01:00
|
|
|
commands: 'invertViewport',
|
|
|
|
|
evaluate: 'evaluate.action',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'CalibrationLine',
|
|
|
|
|
uiType: 'ohif.toolButton',
|
|
|
|
|
props: {
|
|
|
|
|
icon: 'tool-calibration',
|
2025-09-25 16:22:02 +02:00
|
|
|
label: i18n.t('Buttons:Calibration Line'),
|
|
|
|
|
tooltip: i18n.t('Buttons:Calibration Line'),
|
2025-03-07 04:19:47 +01:00
|
|
|
commands: {
|
|
|
|
|
...setToolActiveToolbar,
|
|
|
|
|
commandOptions: {
|
|
|
|
|
...setToolActiveToolbar.commandOptions,
|
|
|
|
|
toolName: 'CalibrationLine',
|
|
|
|
|
},
|
2025-01-10 21:05:35 +01:00
|
|
|
},
|
2025-03-07 04:19:47 +01:00
|
|
|
evaluate: 'evaluate.cornerstoneTool',
|
2025-01-10 21:05:35 +01:00
|
|
|
},
|
2022-07-27 18:39:04 +02:00
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export default toolbarButtons;
|