Describe Your Question
First, thanks for taking the time to read this !
I am using OHIF v3.8. I want to add custom buttons to a panel in the same way that the brush and other segmentation tools are added in the segmentation mode.
- I have created their configuration taking inspiration on the toolbarButtons.ts file
- I have added the buttons to the toolbarService and created a button section
- I can see the buttons in my panel (I used a Toolbox btw), but they are disabled
I looked up the code for the evaluate function (evaluate.cornerstoneTool). There I saw that the tools have to be registered in a ToolGroupā¦
Do I have to create my own evaluate function to make my buttons available ??? If so, I wonāt be able to leverage the same mechanisms to know if my buttons are active or not since it uses the ToolGroupService, meaning I should develop my own mechanismā¦
I tried registering fake tools with the right names in the default toolGroup to no avail. I couldnāt see my buttons in the toolGroup.
The fact that you can add buttons via a config file is cool and all, but isnāt it too complicated ?
What steps can we follow to reproduce the bug?
Simplified code :
In my modeās index.js
ToolBarService.addButtons([
...customButtons,
]);
ToolBarService.createButtonSection("CustomTools", [
"CustomTools",
]);
In my modeās customButtons.ts
const customButtons: Button[] = [
{
id: "CustomTools",
uiType: "ohif.buttonGroup",
props: {
groupId: "CustomTools",
items: [
{
id: "new",
icon: "circle-add",
label: "New",
commands: [
{
commandName: <SOME COMMAND I CREATED>,
context: "AWESOMME",
},
],
options: [],
evaluate: "evaluate.cornerstoneTool", // To be changed...
},
]
}
}
];
In my extensionās Panel.tsx
return (
<Toolbox
buttonSectionId={"CustomTools"}
commandsManager={props.commandsManager}
servicesManager={props.servicesManager}
title="Custom Tools"
/>
);