feat(measurement): Add support measurement label autocompletion (#3855)
This commit is contained in:
1 parent
807afb8ce5
commit
56b1eae635
25 files changed
+830
-138
No files matched your search
@@ -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', [
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,8 +44,12 @@ function modeFactory({ modeConfiguration }) {
|
||||
* Lifecycle hooks
|
||||
*/
|
||||
onModeEnter: ({ servicesManager, extensionManager, commandsManager }) => {
|
||||
const { toolbarService, toolGroupService, hangingProtocolService, displaySetService } =
|
||||
servicesManager.services;
|
||||
const {
|
||||
toolbarService,
|
||||
toolGroupService,
|
||||
hangingProtocolService,
|
||||
displaySetService,
|
||||
} = servicesManager.services;
|
||||
|
||||
const utilityModule = extensionManager.getModuleEntry(
|
||||
'@ohif/extension-cornerstone.utilityModule.tools'
|
||||
|
||||
@@ -7,7 +7,7 @@ export const toolGroupIds = {
|
||||
// MPR: 'mpr',
|
||||
};
|
||||
|
||||
function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||
function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager, modeLabelConfig) {
|
||||
const tools = {
|
||||
active: [
|
||||
{
|
||||
@@ -30,18 +30,24 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||
toolName: toolNames.ArrowAnnotate,
|
||||
configuration: {
|
||||
getTextCallback: (callback, eventDetails) => {
|
||||
commandsManager.runCommand('arrowTextCallback', {
|
||||
callback,
|
||||
eventDetails,
|
||||
});
|
||||
if (modeLabelConfig) {
|
||||
callback(' ');
|
||||
} else {
|
||||
commandsManager.runCommand('arrowTextCallback', {
|
||||
callback,
|
||||
eventDetails,
|
||||
});
|
||||
}
|
||||
},
|
||||
changeTextCallback: (data, eventDetails, callback) => {
|
||||
if (modeLabelConfig === undefined) {
|
||||
commandsManager.runCommand('arrowTextCallback', {
|
||||
callback,
|
||||
data,
|
||||
eventDetails,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
changeTextCallback: (data, eventDetails, callback) =>
|
||||
commandsManager.runCommand('arrowTextCallback', {
|
||||
callback,
|
||||
data,
|
||||
eventDetails,
|
||||
}),
|
||||
},
|
||||
},
|
||||
{ toolName: toolNames.Bidirectional },
|
||||
@@ -102,8 +108,8 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||
toolGroupService.createToolGroupAndAddTools(toolGroupIds.MIP, mipTools);
|
||||
}
|
||||
|
||||
function initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||
_initToolGroups(toolNames, Enums, toolGroupService, commandsManager);
|
||||
function initToolGroups(toolNames, Enums, toolGroupService, commandsManager, modeLabelConfig) {
|
||||
_initToolGroups(toolNames, Enums, toolGroupService, commandsManager, modeLabelConfig);
|
||||
}
|
||||
|
||||
export default initToolGroups;
|
||||
Reference in new issue
Block a user