fix(measurement label auto-completion): Customization of measurement label auto-completion fails for measurements following arrow annotations. (#4739)
This commit is contained in:
parent
43aa20c372
commit
e035ef1dcc
@ -1,12 +1,21 @@
|
|||||||
import { showLabelAnnotationPopup } from './callInputDialog';
|
import { showLabelAnnotationPopup } from './callInputDialog';
|
||||||
|
|
||||||
function promptLabelAnnotation({ servicesManager }, ctx, evt) {
|
function promptLabelAnnotation({ servicesManager }, ctx, evt) {
|
||||||
const { measurementService, customizationService } = servicesManager.services;
|
const { measurementService, customizationService, toolGroupService } = servicesManager.services;
|
||||||
const { viewportId, StudyInstanceUID, SeriesInstanceUID, measurementId } = evt;
|
const { viewportId, StudyInstanceUID, SeriesInstanceUID, measurementId, toolName } = evt;
|
||||||
return new Promise(async function (resolve) {
|
return new Promise(async function (resolve) {
|
||||||
|
const toolGroup = toolGroupService.getToolGroupForViewport(viewportId);
|
||||||
|
const activeToolOptions = toolGroup.getToolConfiguration(toolName);
|
||||||
|
if(activeToolOptions.getTextCallback) {
|
||||||
|
resolve({
|
||||||
|
StudyInstanceUID,
|
||||||
|
SeriesInstanceUID,
|
||||||
|
viewportId,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
const labelConfig = customizationService.getCustomization('measurementLabels');
|
const labelConfig = customizationService.getCustomization('measurementLabels');
|
||||||
const renderContent = customizationService.getCustomization('ui.labellingComponent');
|
|
||||||
const measurement = measurementService.getMeasurement(measurementId);
|
const measurement = measurementService.getMeasurement(measurementId);
|
||||||
|
const renderContent = customizationService.getCustomization('ui.labellingComponent');
|
||||||
const value = await showLabelAnnotationPopup(
|
const value = await showLabelAnnotationPopup(
|
||||||
measurement,
|
measurement,
|
||||||
servicesManager.services.uiDialogService,
|
servicesManager.services.uiDialogService,
|
||||||
@ -27,6 +36,7 @@ function promptLabelAnnotation({ servicesManager }, ctx, evt) {
|
|||||||
SeriesInstanceUID,
|
SeriesInstanceUID,
|
||||||
viewportId,
|
viewportId,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -150,6 +150,7 @@ function TrackedCornerstoneViewport(
|
|||||||
referenceStudyUID: StudyInstanceUID,
|
referenceStudyUID: StudyInstanceUID,
|
||||||
referenceSeriesUID: SeriesInstanceUID,
|
referenceSeriesUID: SeriesInstanceUID,
|
||||||
uid: measurementId,
|
uid: measurementId,
|
||||||
|
toolName,
|
||||||
} = measurement;
|
} = measurement;
|
||||||
|
|
||||||
sendTrackedMeasurementsEvent('SET_DIRTY', { SeriesInstanceUID });
|
sendTrackedMeasurementsEvent('SET_DIRTY', { SeriesInstanceUID });
|
||||||
@ -158,6 +159,7 @@ function TrackedCornerstoneViewport(
|
|||||||
StudyInstanceUID,
|
StudyInstanceUID,
|
||||||
SeriesInstanceUID,
|
SeriesInstanceUID,
|
||||||
measurementId,
|
measurementId,
|
||||||
|
toolName,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).unsubscribe
|
}).unsubscribe
|
||||||
|
|||||||
@ -89,7 +89,7 @@ function modeFactory({ modeConfiguration }) {
|
|||||||
measurementService.clearMeasurements();
|
measurementService.clearMeasurements();
|
||||||
|
|
||||||
// Init Default and SR ToolGroups
|
// Init Default and SR ToolGroups
|
||||||
initToolGroups(extensionManager, toolGroupService, commandsManager, this.labelConfig);
|
initToolGroups(extensionManager, toolGroupService, commandsManager);
|
||||||
|
|
||||||
toolbarService.addButtons([...toolbarButtons, ...moreTools]);
|
toolbarService.addButtons([...toolbarButtons, ...moreTools]);
|
||||||
toolbarService.createButtonSection('primary', [
|
toolbarService.createButtonSection('primary', [
|
||||||
|
|||||||
@ -16,8 +16,7 @@ function initDefaultToolGroup(
|
|||||||
extensionManager,
|
extensionManager,
|
||||||
toolGroupService,
|
toolGroupService,
|
||||||
commandsManager,
|
commandsManager,
|
||||||
toolGroupId,
|
toolGroupId
|
||||||
modeLabelConfig
|
|
||||||
) {
|
) {
|
||||||
const utilityModule = extensionManager.getModuleEntry(
|
const utilityModule = extensionManager.getModuleEntry(
|
||||||
'@ohif/extension-cornerstone.utilityModule.tools'
|
'@ohif/extension-cornerstone.utilityModule.tools'
|
||||||
@ -50,23 +49,17 @@ function initDefaultToolGroup(
|
|||||||
toolName: toolNames.ArrowAnnotate,
|
toolName: toolNames.ArrowAnnotate,
|
||||||
configuration: {
|
configuration: {
|
||||||
getTextCallback: (callback, eventDetails) => {
|
getTextCallback: (callback, eventDetails) => {
|
||||||
if (modeLabelConfig) {
|
|
||||||
callback(' ');
|
|
||||||
} else {
|
|
||||||
commandsManager.runCommand('arrowTextCallback', {
|
commandsManager.runCommand('arrowTextCallback', {
|
||||||
callback,
|
callback,
|
||||||
eventDetails,
|
eventDetails,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
},
|
},
|
||||||
changeTextCallback: (data, eventDetails, callback) => {
|
changeTextCallback: (data, eventDetails, callback) => {
|
||||||
if (modeLabelConfig === undefined) {
|
|
||||||
commandsManager.runCommand('arrowTextCallback', {
|
commandsManager.runCommand('arrowTextCallback', {
|
||||||
callback,
|
callback,
|
||||||
data,
|
data,
|
||||||
eventDetails,
|
eventDetails,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -178,7 +171,7 @@ function initSRToolGroup(extensionManager, toolGroupService) {
|
|||||||
toolGroupService.createToolGroupAndAddTools(toolGroupId, tools);
|
toolGroupService.createToolGroupAndAddTools(toolGroupId, tools);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initMPRToolGroup(extensionManager, toolGroupService, commandsManager, modeLabelConfig) {
|
function initMPRToolGroup(extensionManager, toolGroupService, commandsManager) {
|
||||||
const utilityModule = extensionManager.getModuleEntry(
|
const utilityModule = extensionManager.getModuleEntry(
|
||||||
'@ohif/extension-cornerstone.utilityModule.tools'
|
'@ohif/extension-cornerstone.utilityModule.tools'
|
||||||
);
|
);
|
||||||
@ -213,23 +206,17 @@ function initMPRToolGroup(extensionManager, toolGroupService, commandsManager, m
|
|||||||
toolName: toolNames.ArrowAnnotate,
|
toolName: toolNames.ArrowAnnotate,
|
||||||
configuration: {
|
configuration: {
|
||||||
getTextCallback: (callback, eventDetails) => {
|
getTextCallback: (callback, eventDetails) => {
|
||||||
if (modeLabelConfig) {
|
|
||||||
callback('');
|
|
||||||
} else {
|
|
||||||
commandsManager.runCommand('arrowTextCallback', {
|
commandsManager.runCommand('arrowTextCallback', {
|
||||||
callback,
|
callback,
|
||||||
eventDetails,
|
eventDetails,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
},
|
},
|
||||||
changeTextCallback: (data, eventDetails, callback) => {
|
changeTextCallback: (data, eventDetails, callback) => {
|
||||||
if (modeLabelConfig === undefined) {
|
|
||||||
commandsManager.runCommand('arrowTextCallback', {
|
commandsManager.runCommand('arrowTextCallback', {
|
||||||
callback,
|
callback,
|
||||||
data,
|
data,
|
||||||
eventDetails,
|
eventDetails,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -320,16 +307,15 @@ function initVolume3DToolGroup(extensionManager, toolGroupService) {
|
|||||||
toolGroupService.createToolGroupAndAddTools('volume3d', tools);
|
toolGroupService.createToolGroupAndAddTools('volume3d', tools);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initToolGroups(extensionManager, toolGroupService, commandsManager, modeLabelConfig) {
|
function initToolGroups(extensionManager, toolGroupService, commandsManager) {
|
||||||
initDefaultToolGroup(
|
initDefaultToolGroup(
|
||||||
extensionManager,
|
extensionManager,
|
||||||
toolGroupService,
|
toolGroupService,
|
||||||
commandsManager,
|
commandsManager,
|
||||||
'default',
|
'default'
|
||||||
modeLabelConfig
|
|
||||||
);
|
);
|
||||||
initSRToolGroup(extensionManager, toolGroupService, commandsManager);
|
initSRToolGroup(extensionManager, toolGroupService);
|
||||||
initMPRToolGroup(extensionManager, toolGroupService, commandsManager, modeLabelConfig);
|
initMPRToolGroup(extensionManager, toolGroupService, commandsManager);
|
||||||
initVolume3DToolGroup(extensionManager, toolGroupService);
|
initVolume3DToolGroup(extensionManager, toolGroupService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -61,7 +61,7 @@ function modeFactory({ modeConfiguration }) {
|
|||||||
const { toolNames, Enums } = utilityModule.exports;
|
const { toolNames, Enums } = utilityModule.exports;
|
||||||
|
|
||||||
// Init Default and SR ToolGroups
|
// Init Default and SR ToolGroups
|
||||||
initToolGroups(toolNames, Enums, toolGroupService, commandsManager, null, servicesManager);
|
initToolGroups(toolNames, Enums, toolGroupService, commandsManager);
|
||||||
|
|
||||||
const { unsubscribe } = toolGroupService.subscribe(
|
const { unsubscribe } = toolGroupService.subscribe(
|
||||||
toolGroupService.EVENTS.VIEWPORT_ADDED,
|
toolGroupService.EVENTS.VIEWPORT_ADDED,
|
||||||
|
|||||||
@ -6,7 +6,7 @@ export const toolGroupIds = {
|
|||||||
default: 'default',
|
default: 'default',
|
||||||
};
|
};
|
||||||
|
|
||||||
function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager, modeLabelConfig) {
|
function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||||
const tools = {
|
const tools = {
|
||||||
active: [
|
active: [
|
||||||
{
|
{
|
||||||
@ -32,23 +32,17 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager, mo
|
|||||||
toolName: toolNames.ArrowAnnotate,
|
toolName: toolNames.ArrowAnnotate,
|
||||||
configuration: {
|
configuration: {
|
||||||
getTextCallback: (callback, eventDetails) => {
|
getTextCallback: (callback, eventDetails) => {
|
||||||
if (modeLabelConfig) {
|
|
||||||
callback(' ');
|
|
||||||
} else {
|
|
||||||
commandsManager.runCommand('arrowTextCallback', {
|
commandsManager.runCommand('arrowTextCallback', {
|
||||||
callback,
|
callback,
|
||||||
eventDetails,
|
eventDetails,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
},
|
},
|
||||||
changeTextCallback: (data, eventDetails, callback) => {
|
changeTextCallback: (data, eventDetails, callback) => {
|
||||||
if (modeLabelConfig === undefined) {
|
|
||||||
commandsManager.runCommand('arrowTextCallback', {
|
commandsManager.runCommand('arrowTextCallback', {
|
||||||
callback,
|
callback,
|
||||||
data,
|
data,
|
||||||
eventDetails,
|
eventDetails,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -180,8 +174,8 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager, mo
|
|||||||
toolGroupService.createToolGroupAndAddTools(toolGroupIds.MIP, mipTools);
|
toolGroupService.createToolGroupAndAddTools(toolGroupIds.MIP, mipTools);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initToolGroups(toolNames, Enums, toolGroupService, commandsManager, modeLabelConfig) {
|
function initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||||
_initToolGroups(toolNames, Enums, toolGroupService, commandsManager, modeLabelConfig);
|
_initToolGroups(toolNames, Enums, toolGroupService, commandsManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default initToolGroups;
|
export default initToolGroups;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user