diff --git a/extensions/default/src/utils/promptLabelAnnotation.js b/extensions/default/src/utils/promptLabelAnnotation.js index 28a39c87f..eb3cbaa3f 100644 --- a/extensions/default/src/utils/promptLabelAnnotation.js +++ b/extensions/default/src/utils/promptLabelAnnotation.js @@ -1,32 +1,42 @@ import { showLabelAnnotationPopup } from './callInputDialog'; function promptLabelAnnotation({ servicesManager }, ctx, evt) { - const { measurementService, customizationService } = servicesManager.services; - const { viewportId, StudyInstanceUID, SeriesInstanceUID, measurementId } = evt; + const { measurementService, customizationService, toolGroupService } = servicesManager.services; + const { viewportId, StudyInstanceUID, SeriesInstanceUID, measurementId, toolName } = evt; return new Promise(async function (resolve) { - const labelConfig = customizationService.getCustomization('measurementLabels'); - const renderContent = customizationService.getCustomization('ui.labellingComponent'); - const measurement = measurementService.getMeasurement(measurementId); - const value = await showLabelAnnotationPopup( - measurement, - servicesManager.services.uiDialogService, - labelConfig, - renderContent - ); + const toolGroup = toolGroupService.getToolGroupForViewport(viewportId); + const activeToolOptions = toolGroup.getToolConfiguration(toolName); + if(activeToolOptions.getTextCallback) { + resolve({ + StudyInstanceUID, + SeriesInstanceUID, + viewportId, + }) + } else { + const labelConfig = customizationService.getCustomization('measurementLabels'); + const measurement = measurementService.getMeasurement(measurementId); + const renderContent = customizationService.getCustomization('ui.labellingComponent'); + const value = await showLabelAnnotationPopup( + measurement, + servicesManager.services.uiDialogService, + labelConfig, + renderContent + ); - measurementService.update( - measurementId, - { - ...value, - }, - true - ); + measurementService.update( + measurementId, + { + ...value, + }, + true + ); - resolve({ - StudyInstanceUID, - SeriesInstanceUID, - viewportId, - }); + resolve({ + StudyInstanceUID, + SeriesInstanceUID, + viewportId, + }); + } }); } diff --git a/extensions/measurement-tracking/src/viewports/TrackedCornerstoneViewport.tsx b/extensions/measurement-tracking/src/viewports/TrackedCornerstoneViewport.tsx index 15be51e64..50d630ce6 100644 --- a/extensions/measurement-tracking/src/viewports/TrackedCornerstoneViewport.tsx +++ b/extensions/measurement-tracking/src/viewports/TrackedCornerstoneViewport.tsx @@ -150,6 +150,7 @@ function TrackedCornerstoneViewport( referenceStudyUID: StudyInstanceUID, referenceSeriesUID: SeriesInstanceUID, uid: measurementId, + toolName, } = measurement; sendTrackedMeasurementsEvent('SET_DIRTY', { SeriesInstanceUID }); @@ -158,6 +159,7 @@ function TrackedCornerstoneViewport( StudyInstanceUID, SeriesInstanceUID, measurementId, + toolName, }); } }).unsubscribe diff --git a/modes/longitudinal/src/index.ts b/modes/longitudinal/src/index.ts index 380a4710c..7c2e922d9 100644 --- a/modes/longitudinal/src/index.ts +++ b/modes/longitudinal/src/index.ts @@ -89,7 +89,7 @@ function modeFactory({ modeConfiguration }) { measurementService.clearMeasurements(); // Init Default and SR ToolGroups - initToolGroups(extensionManager, toolGroupService, commandsManager, this.labelConfig); + initToolGroups(extensionManager, toolGroupService, commandsManager); toolbarService.addButtons([...toolbarButtons, ...moreTools]); toolbarService.createButtonSection('primary', [ diff --git a/modes/longitudinal/src/initToolGroups.js b/modes/longitudinal/src/initToolGroups.js index 2622d40f6..63d1f6122 100644 --- a/modes/longitudinal/src/initToolGroups.js +++ b/modes/longitudinal/src/initToolGroups.js @@ -16,8 +16,7 @@ function initDefaultToolGroup( extensionManager, toolGroupService, commandsManager, - toolGroupId, - modeLabelConfig + toolGroupId ) { const utilityModule = extensionManager.getModuleEntry( '@ohif/extension-cornerstone.utilityModule.tools' @@ -50,23 +49,17 @@ function initDefaultToolGroup( toolName: toolNames.ArrowAnnotate, configuration: { getTextCallback: (callback, eventDetails) => { - if (modeLabelConfig) { - callback(' '); - } else { - commandsManager.runCommand('arrowTextCallback', { - callback, - eventDetails, - }); - } + commandsManager.runCommand('arrowTextCallback', { + callback, + eventDetails, + }); }, changeTextCallback: (data, eventDetails, callback) => { - if (modeLabelConfig === undefined) { - commandsManager.runCommand('arrowTextCallback', { - callback, - data, - eventDetails, - }); - } + commandsManager.runCommand('arrowTextCallback', { + callback, + data, + eventDetails, + }); }, }, }, @@ -178,7 +171,7 @@ function initSRToolGroup(extensionManager, toolGroupService) { toolGroupService.createToolGroupAndAddTools(toolGroupId, tools); } -function initMPRToolGroup(extensionManager, toolGroupService, commandsManager, modeLabelConfig) { +function initMPRToolGroup(extensionManager, toolGroupService, commandsManager) { const utilityModule = extensionManager.getModuleEntry( '@ohif/extension-cornerstone.utilityModule.tools' ); @@ -213,23 +206,17 @@ function initMPRToolGroup(extensionManager, toolGroupService, commandsManager, m toolName: toolNames.ArrowAnnotate, configuration: { getTextCallback: (callback, eventDetails) => { - if (modeLabelConfig) { - callback(''); - } else { - commandsManager.runCommand('arrowTextCallback', { - callback, - eventDetails, - }); - } + commandsManager.runCommand('arrowTextCallback', { + callback, + eventDetails, + }); }, changeTextCallback: (data, eventDetails, callback) => { - if (modeLabelConfig === undefined) { - commandsManager.runCommand('arrowTextCallback', { - callback, - data, - eventDetails, - }); - } + commandsManager.runCommand('arrowTextCallback', { + callback, + data, + eventDetails, + }); }, }, }, @@ -320,16 +307,15 @@ function initVolume3DToolGroup(extensionManager, toolGroupService) { toolGroupService.createToolGroupAndAddTools('volume3d', tools); } -function initToolGroups(extensionManager, toolGroupService, commandsManager, modeLabelConfig) { +function initToolGroups(extensionManager, toolGroupService, commandsManager) { initDefaultToolGroup( extensionManager, toolGroupService, commandsManager, - 'default', - modeLabelConfig + 'default' ); - initSRToolGroup(extensionManager, toolGroupService, commandsManager); - initMPRToolGroup(extensionManager, toolGroupService, commandsManager, modeLabelConfig); + initSRToolGroup(extensionManager, toolGroupService); + initMPRToolGroup(extensionManager, toolGroupService, commandsManager); initVolume3DToolGroup(extensionManager, toolGroupService); } diff --git a/modes/tmtv/src/index.ts b/modes/tmtv/src/index.ts index aa59c00a3..464c9f87e 100644 --- a/modes/tmtv/src/index.ts +++ b/modes/tmtv/src/index.ts @@ -61,7 +61,7 @@ function modeFactory({ modeConfiguration }) { const { toolNames, Enums } = utilityModule.exports; // Init Default and SR ToolGroups - initToolGroups(toolNames, Enums, toolGroupService, commandsManager, null, servicesManager); + initToolGroups(toolNames, Enums, toolGroupService, commandsManager); const { unsubscribe } = toolGroupService.subscribe( toolGroupService.EVENTS.VIEWPORT_ADDED, diff --git a/modes/tmtv/src/initToolGroups.js b/modes/tmtv/src/initToolGroups.js index 73f66eb62..00447ce56 100644 --- a/modes/tmtv/src/initToolGroups.js +++ b/modes/tmtv/src/initToolGroups.js @@ -6,7 +6,7 @@ export const toolGroupIds = { default: 'default', }; -function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager, modeLabelConfig) { +function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) { const tools = { active: [ { @@ -32,23 +32,17 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager, mo toolName: toolNames.ArrowAnnotate, configuration: { getTextCallback: (callback, eventDetails) => { - if (modeLabelConfig) { - callback(' '); - } else { - commandsManager.runCommand('arrowTextCallback', { - callback, - eventDetails, - }); - } + commandsManager.runCommand('arrowTextCallback', { + callback, + eventDetails, + }); }, changeTextCallback: (data, eventDetails, callback) => { - if (modeLabelConfig === undefined) { - commandsManager.runCommand('arrowTextCallback', { - callback, - data, - eventDetails, - }); - } + commandsManager.runCommand('arrowTextCallback', { + callback, + data, + eventDetails, + }); }, }, }, @@ -180,8 +174,8 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager, mo toolGroupService.createToolGroupAndAddTools(toolGroupIds.MIP, mipTools); } -function initToolGroups(toolNames, Enums, toolGroupService, commandsManager, modeLabelConfig) { - _initToolGroups(toolNames, Enums, toolGroupService, commandsManager, modeLabelConfig); +function initToolGroups(toolNames, Enums, toolGroupService, commandsManager) { + _initToolGroups(toolNames, Enums, toolGroupService, commandsManager); } export default initToolGroups;