132 lines
4.0 KiB
TypeScript
132 lines
4.0 KiB
TypeScript
function createTools(utilityModule) {
|
|
const { toolNames, Enums } = utilityModule.exports;
|
|
return {
|
|
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: 'CircularBrush',
|
|
parentTool: 'Brush',
|
|
configuration: {
|
|
activeStrategy: 'FILL_INSIDE_CIRCLE',
|
|
},
|
|
},
|
|
{
|
|
toolName: 'CircularEraser',
|
|
parentTool: 'Brush',
|
|
configuration: {
|
|
activeStrategy: 'ERASE_INSIDE_CIRCLE',
|
|
},
|
|
},
|
|
{
|
|
toolName: 'SphereBrush',
|
|
parentTool: 'Brush',
|
|
configuration: {
|
|
activeStrategy: 'FILL_INSIDE_SPHERE',
|
|
},
|
|
},
|
|
{
|
|
toolName: 'SphereEraser',
|
|
parentTool: 'Brush',
|
|
configuration: {
|
|
activeStrategy: 'ERASE_INSIDE_SPHERE',
|
|
},
|
|
},
|
|
{
|
|
toolName: 'ThresholdCircularBrush',
|
|
parentTool: 'Brush',
|
|
configuration: {
|
|
activeStrategy: 'THRESHOLD_INSIDE_CIRCLE',
|
|
dynamicRadius: 3,
|
|
},
|
|
},
|
|
{
|
|
toolName: 'ThresholdSphereBrush',
|
|
parentTool: 'Brush',
|
|
configuration: {
|
|
activeStrategy: 'THRESHOLD_INSIDE_SPHERE',
|
|
dynamicRadius: 3,
|
|
},
|
|
},
|
|
{ toolName: toolNames.CircleScissors },
|
|
{ toolName: toolNames.RectangleScissors },
|
|
{ toolName: toolNames.SphereScissors },
|
|
{ toolName: toolNames.StackScroll },
|
|
{ toolName: toolNames.Magnify },
|
|
{ toolName: toolNames.SegmentationDisplay },
|
|
{ toolName: toolNames.AdvancedMagnify },
|
|
{ toolName: toolNames.UltrasoundDirectional },
|
|
],
|
|
disabled: [{ toolName: toolNames.ReferenceLines }],
|
|
};
|
|
}
|
|
|
|
function initDefaultToolGroup(extensionManager, toolGroupService, commandsManager, toolGroupId) {
|
|
const utilityModule = extensionManager.getModuleEntry(
|
|
'@ohif/extension-cornerstone.utilityModule.tools'
|
|
);
|
|
const tools = createTools(utilityModule);
|
|
toolGroupService.createToolGroupAndAddTools(toolGroupId, tools);
|
|
}
|
|
|
|
function initMPRToolGroup(extensionManager, toolGroupService, commandsManager) {
|
|
const utilityModule = extensionManager.getModuleEntry(
|
|
'@ohif/extension-cornerstone.utilityModule.tools'
|
|
);
|
|
const tools = createTools(utilityModule);
|
|
tools.disabled.push(
|
|
{
|
|
toolName: utilityModule.exports.toolNames.Crosshairs,
|
|
configuration: {
|
|
viewportIndicators: false,
|
|
disableOnPassive: true,
|
|
autoPan: {
|
|
enabled: false,
|
|
panSize: 10,
|
|
},
|
|
},
|
|
},
|
|
{ toolName: utilityModule.exports.toolNames.ReferenceLines }
|
|
);
|
|
toolGroupService.createToolGroupAndAddTools('mpr', tools);
|
|
}
|
|
|
|
function initVolume3DToolGroup(extensionManager, toolGroupService) {
|
|
const utilityModule = extensionManager.getModuleEntry(
|
|
'@ohif/extension-cornerstone.utilityModule.tools'
|
|
);
|
|
|
|
const { toolNames, Enums } = utilityModule.exports;
|
|
|
|
const tools = {
|
|
active: [
|
|
{
|
|
toolName: toolNames.TrackballRotateTool,
|
|
bindings: [{ mouseButton: Enums.MouseBindings.Primary }],
|
|
},
|
|
{
|
|
toolName: toolNames.Zoom,
|
|
bindings: [{ mouseButton: Enums.MouseBindings.Secondary }],
|
|
},
|
|
{
|
|
toolName: toolNames.Pan,
|
|
bindings: [{ mouseButton: Enums.MouseBindings.Auxiliary }],
|
|
},
|
|
],
|
|
};
|
|
|
|
toolGroupService.createToolGroupAndAddTools('volume3d', tools);
|
|
}
|
|
|
|
function initToolGroups(extensionManager, toolGroupService, commandsManager) {
|
|
initDefaultToolGroup(extensionManager, toolGroupService, commandsManager, 'default');
|
|
initMPRToolGroup(extensionManager, toolGroupService, commandsManager);
|
|
initVolume3DToolGroup(extensionManager, toolGroupService);
|
|
}
|
|
|
|
export default initToolGroups;
|