feat(measurement): Add support measurement label autocompletion (#3855)

This commit is contained in:
nithin-trenser authored and GitHub committed 2024-04-04 22:42:48 -04:00
1 parent 807afb8ce5
commit 56b1eae635
25 files changed
+830 -138

No files matched your search

+16 -2
View File
@@ -70,14 +70,28 @@ function modeFactory({ modeConfiguration }) {
/**
* Lifecycle hooks
*/
onModeEnter: ({ servicesManager, extensionManager, commandsManager }) => {
onModeEnter: function ({ servicesManager, extensionManager, commandsManager }) {
const { measurementService, toolbarService, toolGroupService, customizationService } =
servicesManager.services;
measurementService.clearMeasurements();
// customizationService.addModeCustomizations([
// {
// id: 'measurementLabels',
// labelOnMeasure: true,
// exclusive: true,
// items: [
// { value: 'Head', label: 'Head' },
// { value: 'Shoulder', label: 'Shoulder' },
// { value: 'Knee', label: 'Knee' },
// { value: 'Toe', label: 'Toe' },
// ],
// },
// ]);
// Init Default and SR ToolGroups
initToolGroups(extensionManager, toolGroupService, commandsManager);
initToolGroups(extensionManager, toolGroupService, commandsManager, this.labelConfig);
toolbarService.addButtons([...toolbarButtons, ...moreTools]);
toolbarService.createButtonSection('primary', [
+56 -30
View File
@@ -1,4 +1,10 @@
function initDefaultToolGroup(extensionManager, toolGroupService, commandsManager, toolGroupId) {
function initDefaultToolGroup(
extensionManager,
toolGroupService,
commandsManager,
toolGroupId,
modeLabelConfig
) {
const utilityModule = extensionManager.getModuleEntry(
'@ohif/extension-cornerstone.utilityModule.tools'
);
@@ -26,18 +32,25 @@ function initDefaultToolGroup(extensionManager, toolGroupService, commandsManage
{
toolName: toolNames.ArrowAnnotate,
configuration: {
getTextCallback: (callback, eventDetails) =>
commandsManager.runCommand('arrowTextCallback', {
callback,
eventDetails,
}),
changeTextCallback: (data, eventDetails, callback) =>
commandsManager.runCommand('arrowTextCallback', {
callback,
data,
eventDetails,
}),
getTextCallback: (callback, eventDetails) => {
if (modeLabelConfig) {
callback(' ');
} else {
commandsManager.runCommand('arrowTextCallback', {
callback,
eventDetails,
});
}
},
changeTextCallback: (data, eventDetails, callback) => {
if (modeLabelConfig === undefined) {
commandsManager.runCommand('arrowTextCallback', {
callback,
data,
eventDetails,
});
}
},
},
},
{ toolName: toolNames.Bidirectional },
@@ -126,7 +139,7 @@ function initSRToolGroup(extensionManager, toolGroupService) {
toolGroupService.createToolGroupAndAddTools(toolGroupId, tools);
}
function initMPRToolGroup(extensionManager, toolGroupService, commandsManager) {
function initMPRToolGroup(extensionManager, toolGroupService, commandsManager, modeLabelConfig) {
const utilityModule = extensionManager.getModuleEntry(
'@ohif/extension-cornerstone.utilityModule.tools'
);
@@ -154,18 +167,25 @@ function initMPRToolGroup(extensionManager, toolGroupService, commandsManager) {
{
toolName: toolNames.ArrowAnnotate,
configuration: {
getTextCallback: (callback, eventDetails) =>
commandsManager.runCommand('arrowTextCallback', {
callback,
eventDetails,
}),
changeTextCallback: (data, eventDetails, callback) =>
commandsManager.runCommand('arrowTextCallback', {
callback,
data,
eventDetails,
}),
getTextCallback: (callback, eventDetails) => {
if (modeLabelConfig) {
callback('');
} else {
commandsManager.runCommand('arrowTextCallback', {
callback,
eventDetails,
});
}
},
changeTextCallback: (data, eventDetails, callback) => {
if (modeLabelConfig === undefined) {
commandsManager.runCommand('arrowTextCallback', {
callback,
data,
eventDetails,
});
}
},
},
},
{ toolName: toolNames.Bidirectional },
@@ -227,10 +247,16 @@ function initVolume3DToolGroup(extensionManager, toolGroupService) {
toolGroupService.createToolGroupAndAddTools('volume3d', tools);
}
function initToolGroups(extensionManager, toolGroupService, commandsManager) {
initDefaultToolGroup(extensionManager, toolGroupService, commandsManager, 'default');
initSRToolGroup(extensionManager, toolGroupService);
initMPRToolGroup(extensionManager, toolGroupService, commandsManager);
function initToolGroups(extensionManager, toolGroupService, commandsManager, modeLabelConfig) {
initDefaultToolGroup(
extensionManager,
toolGroupService,
commandsManager,
'default',
modeLabelConfig
);
initSRToolGroup(extensionManager, toolGroupService, commandsManager);
initMPRToolGroup(extensionManager, toolGroupService, commandsManager, modeLabelConfig);
initVolume3DToolGroup(extensionManager, toolGroupService);
}