diff --git a/extensions/cornerstone/src/commandsModule.ts b/extensions/cornerstone/src/commandsModule.ts index c6873f5ad..bc5737007 100644 --- a/extensions/cornerstone/src/commandsModule.ts +++ b/extensions/cornerstone/src/commandsModule.ts @@ -1858,22 +1858,16 @@ function commandsModule({ } }); }, - toggleSegmentLabel: () => { + toggleSegmentLabel: ({ enabled }) => { const toolName = cornerstoneTools.SegmentLabelTool.toolName; const toolGroupIds = toolGroupService.getToolGroupIds(); - const isOn = toolGroupIds.some(toolGroupId => { - const toolGroup = cornerstoneTools.ToolGroupManager.getToolGroup(toolGroupId); - const mode = toolGroup.getToolInstance(toolName)?.mode; - return mode === 'Active'; - }); - toolGroupIds.forEach(toolGroupId => { const toolGroup = cornerstoneTools.ToolGroupManager.getToolGroup(toolGroupId); - if (isOn) { - toolGroup.setToolDisabled(toolName); - } else { + if (enabled) { toolGroup.setToolActive(toolName); + } else { + toolGroup.setToolDisabled(toolName); } }); }, diff --git a/extensions/cornerstone/src/customizations/segmentationPanelCustomization.tsx b/extensions/cornerstone/src/customizations/segmentationPanelCustomization.tsx index 82280b270..33114372d 100644 --- a/extensions/cornerstone/src/customizations/segmentationPanelCustomization.tsx +++ b/extensions/cornerstone/src/customizations/segmentationPanelCustomization.tsx @@ -36,6 +36,7 @@ export default function getSegmentationPanelCustomization({ commandsManager, ser 'segmentationToolbox.config': () => { // Get initial states based on current configuration const [previewEdits, setPreviewEdits] = useState(false); + const [segmentLabelEnabled, setSegmentLabelEnabled] = useState(false); const [toggleSegmentEnabled, setToggleSegmentEnabled] = useState(false); const [useCenterAsSegmentIndex, setUseCenterAsSegmentIndex] = useState(false); const handlePreviewEditsChange = checked => { @@ -53,14 +54,19 @@ export default function getSegmentationPanelCustomization({ commandsManager, ser commandsManager.run('toggleUseCenterSegmentIndex', { toggle: checked }); }; + const handleSegmentLabelEnabledChange = checked => { + setSegmentLabelEnabled(checked); + commandsManager.run('toggleSegmentLabel', { enabled: checked }); + }; + return ( -
+
- Preview edits before creating + Preview edits before creating
@@ -68,7 +74,7 @@ export default function getSegmentationPanelCustomization({ commandsManager, ser checked={useCenterAsSegmentIndex} onCheckedChange={handleUseCenterAsSegmentIndexChange} /> - Use center as segment index + Use center as segment index
@@ -76,7 +82,15 @@ export default function getSegmentationPanelCustomization({ commandsManager, ser checked={toggleSegmentEnabled} onCheckedChange={handleToggleSegmentEnabledChange} /> - Hover on segment border to activate + Hover on segment border to activate +
+ +
+ + Show segment name on hover
); diff --git a/modes/longitudinal/src/index.ts b/modes/longitudinal/src/index.ts index 59a265e38..f02e0ff56 100644 --- a/modes/longitudinal/src/index.ts +++ b/modes/longitudinal/src/index.ts @@ -160,8 +160,7 @@ function modeFactory({ modeConfiguration }) { 'TagBrowser', 'AdvancedMagnify', 'UltrasoundDirectionalTool', - 'WindowLevelRegion', - 'SegmentLabelTool', +'WindowLevelRegion', ]); customizationService.setCustomizations({ diff --git a/modes/longitudinal/src/toolbarButtons.ts b/modes/longitudinal/src/toolbarButtons.ts index 9d7eaed89..2e3863517 100644 --- a/modes/longitudinal/src/toolbarButtons.ts +++ b/modes/longitudinal/src/toolbarButtons.ts @@ -667,24 +667,6 @@ const toolbarButtons: Button[] = [ buttonSection: true, }, }, - { - id: 'SegmentLabelTool', - uiType: 'ohif.toolBoxButton', - props: { - icon: 'tool-segment-label', - label: i18n.t('Buttons:Segment Label Display'), - tooltip: i18n.t( - 'Buttons:Click to show or hide segment labels when hovering with your mouse.' - ), - commands: { commandName: 'toggleSegmentLabel' }, - evaluate: [ - 'evaluate.cornerstoneTool.toggle', - { - name: 'evaluate.cornerstone.hasSegmentation', - }, - ], - }, - }, // { // id: 'Undo', // uiType: 'ohif.toolButton', diff --git a/modes/segmentation/src/index.tsx b/modes/segmentation/src/index.tsx index 5962f56df..4a0d09cc6 100644 --- a/modes/segmentation/src/index.tsx +++ b/modes/segmentation/src/index.tsx @@ -121,8 +121,7 @@ function modeFactory({ modeConfiguration }) { toolbarService.updateSection('SegmentationUtilities', [ 'LabelmapSlicePropagation', 'InterpolateLabelmap', - 'SegmentBidirectional', - 'SegmentLabelTool', +'SegmentBidirectional', ]); toolbarService.updateSection('SegmentationTools', [ 'BrushTools', diff --git a/modes/segmentation/src/toolbarButtons.ts b/modes/segmentation/src/toolbarButtons.ts index 1815f9777..03bc7c7a5 100644 --- a/modes/segmentation/src/toolbarButtons.ts +++ b/modes/segmentation/src/toolbarButtons.ts @@ -749,24 +749,6 @@ const toolbarButtons: Button[] = [ ], }, }, - { - id: 'SegmentLabelTool', - uiType: 'ohif.toolBoxButton', - props: { - icon: 'tool-segment-label', - label: i18n.t('Buttons:Segment Label Display'), - tooltip: i18n.t( - 'Buttons:Click to show or hide segment labels when hovering with your mouse.' - ), - commands: { commandName: 'toggleSegmentLabel' }, - evaluate: [ - 'evaluate.cornerstoneTool.toggle', - { - name: 'evaluate.cornerstone.hasSegmentation', - }, - ], - }, - }, ]; export default toolbarButtons;