View in #ohif on Slack
@Alya_D.: Hi, is it possible to customize cornerstonejs tool in ohif?
I want to customize the cornerstonejs tool (more precisely, slightly customizing the bidirectional tool) so I created a new button in the toolbar of the More Tools group instead of More Measure Tools, and copy the code in BidirectionalTool.ts to a new file inside the extensions/cornerstone/src/tools folder to make sure the button works first before I customize it. But I’m having trouble getting the tool to work first. Could you please assist me in adding the tool and activate it in the newest version of ohif?
@Ibrahim_Mohamed: You need to import the new tool and add it to the ToolGroups you are going to use it with, try these steps in order it will work
@Ibrahim_Mohamed: • Add it here https://github.com/OHIF/Viewers/blob/d8ef36ed24466988586e19b855d2bbb86f8c657a/extensions/cornerstone/src/initCornerstoneTools.js or create a similar initializer in your own extension/mode that calls addTool with your custom tool.
• Then add it to the ToolGroups here https://github.com/OHIF/Viewers/blob/d8ef36ed24466988586e19b855d2bbb86f8c657a/modes/longitudinal/src/initToolGroups.js
• Then create a button for it here https://github.com/OHIF/Viewers/blob/d8ef36ed24466988586e19b855d2bbb86f8c657a/modes/longitudinal/src/toolbarButtons.ts
• Then add a toolbar section for it or if u don’t want to do that add it to the more tools dropdown https://github.com/OHIF/Viewers/blob/d8ef36ed24466988586e19b855d2bbb86f8c657a/modes/longitudinal/src/index.ts
These steps can all be replicated in your own modes/extension, you don’t have to use the longitudinal mode but just to test it out u can.
@Alya_D.: Hi, thank you for your response. I managed to add my tool button from the steps you described but it’s still in inactive state. What should i do to activate it?
@Ibrahim_Mohamed: In step number 3, double check that the setToolActive command is done correctly, and has your tool.toolName
otherwise it should work not sure
@Alya_D.: It works, thanks!
@Ibrahim_Mohamed: No problem happy to help