fix(segmentation): Restored segment label tool in longitudinal mode. (#5443)

This commit is contained in:
Joe Boccanfuso 2025-09-29 15:56:11 -04:00 committed by GitHub
parent 47164463cc
commit dd86a8eabd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 30 additions and 3 deletions

View File

@ -1858,13 +1858,21 @@ function commandsModule({
} }
}); });
}, },
toggleSegmentLabel: ({ enabled }) => { toggleSegmentLabel: ({ enabled }: { enabled?: boolean }) => {
const toolName = cornerstoneTools.SegmentLabelTool.toolName; const toolName = cornerstoneTools.SegmentLabelTool.toolName;
const toolGroupIds = toolGroupService.getToolGroupIds(); const toolGroupIds = toolGroupService.getToolGroupIds();
const isToolOn = toolGroupIds.some(toolGroupId => {
const toolGroup = cornerstoneTools.ToolGroupManager.getToolGroup(toolGroupId);
const mode = toolGroup.getToolInstance(toolName)?.mode;
return mode === 'Active';
});
const enableTool = enabled !== undefined ? enabled : !isToolOn;
toolGroupIds.forEach(toolGroupId => { toolGroupIds.forEach(toolGroupId => {
const toolGroup = cornerstoneTools.ToolGroupManager.getToolGroup(toolGroupId); const toolGroup = cornerstoneTools.ToolGroupManager.getToolGroup(toolGroupId);
if (enabled) { if (enableTool) {
toolGroup.setToolActive(toolName); toolGroup.setToolActive(toolName);
} else { } else {
toolGroup.setToolDisabled(toolName); toolGroup.setToolDisabled(toolName);

View File

@ -161,6 +161,7 @@ function modeFactory({ modeConfiguration }) {
'AdvancedMagnify', 'AdvancedMagnify',
'UltrasoundDirectionalTool', 'UltrasoundDirectionalTool',
'WindowLevelRegion', 'WindowLevelRegion',
'SegmentLabelTool',
]); ]);
customizationService.setCustomizations({ customizationService.setCustomizations({

View File

@ -667,6 +667,24 @@ const toolbarButtons: Button[] = [
buttonSection: true, 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', // id: 'Undo',
// uiType: 'ohif.toolButton', // uiType: 'ohif.toolButton',