Viewers icon indicating copy to clipboard operation
Viewers copied to clipboard

How to add new tool to the React based Ohif viewer like Reset or RectangleRoi.

Open viss3595 opened this issue 7 years ago • 3 comments

Hello Team,

I want to add some new custom tool to react based ohif viewer like a Reset button or Rectangle roi Button. so which steps I follow or Which files I need to change. And give me if any documentation available for understanding the Architecture.

viss3595 avatar Aug 27 '19 10:08 viss3595

Hello @viss3595

If i'm right, the current Viewer version already has these tools.

Still, if you want to create a custom tool, you can use cornerstoneTools library, I've been there myself and got through You need to fork cornerstoneTools and link it to your project (with yalc for example). Then, on the same principle of existing tools, you create yours. Then to add it to the toolbar, you have to modify the cornerstone toolbarModule. Finally, modify setupTools to add your tool, and then I think it should be fine

I opened an issue to ask how to make cornerstoneTools part of the source code so we don't have to link it because it's not very convenient. You can follow it here

MathisGuilhin avatar Aug 27 '19 13:08 MathisGuilhin

Thanks for contributing some helpful advice, @MathisGuilhin ^_^

We're working on updating the cornerstone extension to support run-time configuration that allows you to more easily customize it's behavior without the need to fork it. There are essentially three paths forward:

1. Fork and modify the cornerstone extension

2. Create your own extension and register it

This is the approach the ohif-segmentation-extension takes. It assumes that the @ohif/extension-cornerstone extension is registered, and uses it's preRegistration hook to add it's custom tools to the cornerstone-tool's instance.

3. Draft a PR that adds runtime configuration support to the @ohif/extension-cornerstone extension

This is on my "to do" list, but I'm more than happy to lay out the scope if someone with more availability is interested in spearheading it.

You need to fork cornerstoneTools and link it to your project (with yalc for example). Then, on the same principle of existing tools, you create yours.

Can you help me better understand your use case? In CornerstoneTools v3, you shouldn't need to fork to add new tools, or extend existing tools. The only reason to fork would be to modify very core functionality that you don't think makes sense to contribute back to the framework.

dannyrb avatar Aug 27 '19 15:08 dannyrb

Related to the already slated config docs. Going to close.

dannyrb avatar Sep 06 '19 16:09 dannyrb