Hello,
I'm trying to deploy an OHIFViewer server in a hospital in France, and for this I would like to add a freehandROI tool from Cornerstone tools ((https://tools.cornerstonejs.org/examples/tools/freehand-mouse.html), and afterwards be able to save the Dicom and the segmentation. .
I found how I could add the corresponding button in the Toolbar (getDefaultToolbarButtons.js), but I am struggling to find how and where the tools are called in the code, and so where to add my code calling the corresponding tool.
I know this issue has already been posted but the posts mainly refer to the version 1.x and I could not find my answers.
Many thanks in advance
Our extension/module system is still in its infancy, and will likely change a fair amount over the next month or two before stabilizing. I have _just_ updated existing extensions to specify their own toolbar buttons, commands, etc. as well as in what "contexts" they should be visible/active.
The only way to modify the toolbar, today, is to modify the toolbarModule for the appropriate extension. I have a few different ideas on how we can improve the ergonomics here that I'll post shortly to a discussion issue.
You'll notice in the @ohif/extension-cornerstone, that there is a command named setToolActive that takes a toolName via options. The tool's currently available for a cornerstone viewport are set in the react-cornerstone-viewport via the availableTools prop.
If you:
freehand as a default availableTool@ohif/extension-cornerstone and modify the toolbarModuleViewers reference to your forked extensionYou should be able to add support for the freehand tool.
save the Dicom and the segmentation
Are you trying to "burn in" the annotation, or push the seg to your PACS? I know we have a few efforts internally to get functionality in line w/ our Meteor version, but I'm not sure where we're at on their progress.
Thank you for your quick answer.
I will try what you suggest and let you know how this goes.
In the future the idea would be to push the seg to the PACS, but for the moment we would like to push the DICOM image and the segmentation to a local server.
Hi @dannyrb,
I followed your advices but I am still struggling.
After rebuilding, nothing is different. I even tried to remove all tool from the toolbarModule file, but they are still there, working.
Many thanks for the support
Hi @MathisGuilhin
The development workflow really sucks right now for extensions. You have to use yalc (https://github.com/whitecolor/yalc) or something similar to make changes and push it to a local npm registry (yarn link might also work). See https://docs.ohif.org/contributing.html#when-changes-impact-multiple-repositories
We are looking into ways to make this easier. The problem is that the extensions have a separate build process from the main application.
Thanks for your help @swederik
I managed to add the segmentation tool with yalc.
@MathisGuilhin will you create a PR for this? Currently struggling myself with this...
@t-fi, recent changes to the ExtensionManager could make this easier. Need someone to spike adding configuration to specify the availableTools for the cornerstone extension in the ExtensionManager's preRegistration hook.
Thanks for the feedback! I managed to do this by myself by now, in a quite hacky manual way. But it works 馃帀馃帀馃帀
It was basically adding a few lines to the toolbar module and fighting with yarn and yalc.
Can I shamelessly advertise this issue about storing the annotaitons? That would be the next big step!
Well done @t-fi,
I am currently able to save the measurement under a JSON format, and I'm now trying to be able to load them back. I'll open an issue today about this.
If you want to be able to save the measurement, I could give you a few hints, don't hesitate to write me
Mat
@MathisGuilhin Could you please guide me too? This code has the tools, but they're commented out for a future release. I have a requirement to get the segmentation tool save the segmentation to the DICOM. Could you help me out as well?
@KhyatiMehta3 I'm sorry, I haven't been working on this for a year and haven't followed the recent updates, so I can't help you with this.. Wish you good luck though
Oh okay, thank you.. But if possible could you point me to your commits that worked? I'll figure something out from there?
You can check them there : https://github.com/MathisGuilhin/CREATIS-OHIFViewer-dev/commits/master. I left something that was working, with a segmentation tool, a repulsor toor and saving/loading measurements, but I have missed one year of OHIFViewer commit.. Hope that can help you though
Okay thank you very much! :)
Are you trying to "burn in" the annotation, or push the seg to your PACS? I know we have a few efforts internally to get functionality in line w/ our Meteor version, but I'm not sure where we're at on their progress.
@dannyrb Could you please give advice on how to achieve this? I'm trying something similar and the tools are up, but I want to know how to add the segmentation to the DICOM, just like how measurementsApi assists in persisting measurements inside the DICOM. I know the DataExchange.js file performs burning the data into the DICOM file, but would like your guidance on how to go forward.
Most helpful comment
Thanks for the feedback! I managed to do this by myself by now, in a quite hacky manual way. But it works 馃帀馃帀馃帀
It was basically adding a few lines to the toolbar module and fighting with yarn and yalc.
Can I shamelessly advertise this issue about storing the annotaitons? That would be the next big step!