Extending Osimis viewer ROI with Cornerstone FreehandMouseTool

I am considering extending the Osimis viewer’s ROI capability (currently with support for elliptical and rectangular ROIs) to use the Cornerstone FreehandMouseTool for regular closed polygon ROIs. I’d like to be able to draw ROI around non-regular objects in the images.

I wondered if the Osimis developers could give me a sense of whether that is feasible.

Digging into the code, it looks like CPP code for the plugin backend doesn’t really care about the contents of the json returned by the existing ROI tools. It seems to simply store or retrieve a json blob from the appropriate study attachment, but not care whether that blob is formatted as an ellipse, point, rectangle, etc.

Would the work be mostly modifying the javascript of the frontend to add FreehandMouseTool similar to how the elliptical and rectangular tools are already coded there? Obviously, I’d also need to add another icon element to the front end to invoke the free hand ROI.

I don’t have a sense for how constrained the APIs are of the elliptical and rectangular ROI code and where else it might be called from the code. So I’m not certain how easy it would be to drop in a call to the FreehandMouseTool.