* [refactor] measurement service mapping files - rename to .ts files * [fix] RectangleROI - measurement service mapping _getReport() function - tool name fix * [feat] added CircleROI tool from updated cornerstone3D * [refactor] fix for typescript strong typing warnings * [feat] cornerstone-dicom-sr extension - added CircleROI tool * [feat] added toolbar button for CircleROI tool * [doc] doc updates for CircleROI tool * [update] library - dcmjs to 0.29.5 * [fix] roundNumber() function when given strings * [fix] refactor after upgrading conerstonejs library 0.49.0 * yarn.lock file change
229 lines
6.0 KiB
JavaScript
229 lines
6.0 KiB
JavaScript
function initDefaultToolGroup(
|
|
extensionManager,
|
|
toolGroupService,
|
|
commandsManager,
|
|
toolGroupId
|
|
) {
|
|
const utilityModule = extensionManager.getModuleEntry(
|
|
'@ohif/extension-cornerstone.utilityModule.tools'
|
|
);
|
|
|
|
const { toolNames, Enums } = utilityModule.exports;
|
|
|
|
const tools = {
|
|
active: [
|
|
{
|
|
toolName: toolNames.WindowLevel,
|
|
bindings: [{ mouseButton: Enums.MouseBindings.Primary }],
|
|
},
|
|
{
|
|
toolName: toolNames.Pan,
|
|
bindings: [{ mouseButton: Enums.MouseBindings.Auxiliary }],
|
|
},
|
|
{
|
|
toolName: toolNames.Zoom,
|
|
bindings: [{ mouseButton: Enums.MouseBindings.Secondary }],
|
|
},
|
|
{ toolName: toolNames.StackScrollMouseWheel, bindings: [] },
|
|
],
|
|
passive: [
|
|
{ toolName: toolNames.Length },
|
|
{ toolName: toolNames.ArrowAnnotate },
|
|
{ toolName: toolNames.Bidirectional },
|
|
{ toolName: toolNames.DragProbe },
|
|
{ toolName: toolNames.EllipticalROI },
|
|
{ toolName: toolNames.CircleROI },
|
|
{ toolName: toolNames.RectangleROI },
|
|
{ toolName: toolNames.StackScroll },
|
|
{ toolName: toolNames.Angle },
|
|
{ toolName: toolNames.Magnify },
|
|
{ toolName: toolNames.SegmentationDisplay },
|
|
],
|
|
// enabled
|
|
// disabled
|
|
disabled: [{ toolName: toolNames.ReferenceLines }],
|
|
};
|
|
|
|
const toolsConfig = {
|
|
[toolNames.ArrowAnnotate]: {
|
|
getTextCallback: (callback, eventDetails) =>
|
|
commandsManager.runCommand('arrowTextCallback', {
|
|
callback,
|
|
eventDetails,
|
|
}),
|
|
|
|
changeTextCallback: (data, eventDetails, callback) =>
|
|
commandsManager.runCommand('arrowTextCallback', {
|
|
callback,
|
|
data,
|
|
eventDetails,
|
|
}),
|
|
},
|
|
};
|
|
|
|
toolGroupService.createToolGroupAndAddTools(toolGroupId, tools, toolsConfig);
|
|
}
|
|
|
|
function initSRToolGroup(extensionManager, toolGroupService, commandsManager) {
|
|
const SRUtilityModule = extensionManager.getModuleEntry(
|
|
'@ohif/extension-cornerstone-dicom-sr.utilityModule.tools'
|
|
);
|
|
|
|
const CS3DUtilityModule = extensionManager.getModuleEntry(
|
|
'@ohif/extension-cornerstone.utilityModule.tools'
|
|
);
|
|
|
|
const { toolNames: SRToolNames } = SRUtilityModule.exports;
|
|
const { toolNames, Enums } = CS3DUtilityModule.exports;
|
|
const tools = {
|
|
active: [
|
|
{
|
|
toolName: toolNames.WindowLevel,
|
|
bindings: [
|
|
{
|
|
mouseButton: Enums.MouseBindings.Primary,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
toolName: toolNames.Pan,
|
|
bindings: [
|
|
{
|
|
mouseButton: Enums.MouseBindings.Auxiliary,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
toolName: toolNames.Zoom,
|
|
bindings: [
|
|
{
|
|
mouseButton: Enums.MouseBindings.Secondary,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
toolName: toolNames.StackScrollMouseWheel,
|
|
bindings: [],
|
|
},
|
|
],
|
|
passive: [
|
|
{ toolName: SRToolNames.SRLength },
|
|
{ toolName: SRToolNames.SRArrowAnnotate },
|
|
{ toolName: SRToolNames.SRBidirectional },
|
|
{ toolName: SRToolNames.SREllipticalROI },
|
|
{ toolName: SRToolNames.SRCircleROI },
|
|
],
|
|
enabled: [
|
|
{
|
|
toolName: SRToolNames.DICOMSRDisplay,
|
|
bindings: [],
|
|
},
|
|
],
|
|
// disabled
|
|
};
|
|
|
|
const toolsConfig = {
|
|
[toolNames.ArrowAnnotate]: {
|
|
getTextCallback: (callback, eventDetails) =>
|
|
commandsManager.runCommand('arrowTextCallback', {
|
|
callback,
|
|
eventDetails,
|
|
}),
|
|
|
|
changeTextCallback: (data, eventDetails, callback) =>
|
|
commandsManager.runCommand('arrowTextCallback', {
|
|
callback,
|
|
data,
|
|
eventDetails,
|
|
}),
|
|
},
|
|
};
|
|
|
|
const toolGroupId = 'SRToolGroup';
|
|
toolGroupService.createToolGroupAndAddTools(toolGroupId, tools, toolsConfig);
|
|
}
|
|
|
|
function initMPRToolGroup(extensionManager, toolGroupService, commandsManager) {
|
|
const utilityModule = extensionManager.getModuleEntry(
|
|
'@ohif/extension-cornerstone.utilityModule.tools'
|
|
);
|
|
|
|
const { toolNames, Enums } = utilityModule.exports;
|
|
|
|
const tools = {
|
|
active: [
|
|
{
|
|
toolName: toolNames.WindowLevel,
|
|
bindings: [{ mouseButton: Enums.MouseBindings.Primary }],
|
|
},
|
|
{
|
|
toolName: toolNames.Pan,
|
|
bindings: [{ mouseButton: Enums.MouseBindings.Auxiliary }],
|
|
},
|
|
{
|
|
toolName: toolNames.Zoom,
|
|
bindings: [{ mouseButton: Enums.MouseBindings.Secondary }],
|
|
},
|
|
{ toolName: toolNames.StackScrollMouseWheel, bindings: [] },
|
|
],
|
|
passive: [
|
|
{ toolName: toolNames.Length },
|
|
{ toolName: toolNames.ArrowAnnotate },
|
|
{ toolName: toolNames.Bidirectional },
|
|
{ toolName: toolNames.DragProbe },
|
|
{ toolName: toolNames.EllipticalROI },
|
|
{ toolName: toolNames.CircleROI },
|
|
{ toolName: toolNames.RectangleROI },
|
|
{ toolName: toolNames.StackScroll },
|
|
{ toolName: toolNames.Angle },
|
|
{ toolName: toolNames.SegmentationDisplay },
|
|
],
|
|
disabled: [
|
|
{ toolName: toolNames.Crosshairs },
|
|
{ toolName: toolNames.ReferenceLines },
|
|
],
|
|
|
|
// enabled
|
|
// disabled
|
|
};
|
|
|
|
const toolsConfig = {
|
|
[toolNames.Crosshairs]: {
|
|
viewportIndicators: false,
|
|
autoPan: {
|
|
enabled: false,
|
|
panSize: 10,
|
|
},
|
|
},
|
|
[toolNames.ArrowAnnotate]: {
|
|
getTextCallback: (callback, eventDetails) =>
|
|
commandsManager.runCommand('arrowTextCallback', {
|
|
callback,
|
|
eventDetails,
|
|
}),
|
|
|
|
changeTextCallback: (data, eventDetails, callback) =>
|
|
commandsManager.runCommand('arrowTextCallback', {
|
|
callback,
|
|
data,
|
|
eventDetails,
|
|
}),
|
|
},
|
|
};
|
|
|
|
toolGroupService.createToolGroupAndAddTools('mpr', tools, toolsConfig);
|
|
}
|
|
|
|
function initToolGroups(extensionManager, toolGroupService, commandsManager) {
|
|
initDefaultToolGroup(
|
|
extensionManager,
|
|
toolGroupService,
|
|
commandsManager,
|
|
'default'
|
|
);
|
|
initSRToolGroup(extensionManager, toolGroupService, commandsManager);
|
|
initMPRToolGroup(extensionManager, toolGroupService, commandsManager);
|
|
}
|
|
|
|
export default initToolGroups;
|