FreehandRoi Tool ROI Cannot Be Removed
I added the FreehandRoi tool to the toolbar and the tool draws an ROI but produces the following warnings:
MeasurementService.js?f3c7:274 Failed to map 'CornerstoneTools@4' measurement for definition RectangleRoi: Cannot read property 'toMeasurementSchema' of undefined
More importantly, there appears no way to remove the ROI drawn. Should the ROI appear as a measurement in the "Measurements" window where it could be deleted?
Today, the "MeasurementPanel" extension listens for cornerstone-tools measurement events. Those events inform the panel, and the panel tracks and displays the measurements.
src/appExtensions/MeasurementsPanel/*
I would check out ConnectedMeasurementTable.js and init.js to see why freeHandROI measurements aren't included in the table. It's possible the tool may not emit the data/events we expect, or that we have an "allow list" hardcoded somewhere.
In the future, the MeasurementsPanel will likely pull from the "Measurement Service". So that anything that pushes to the Measurement Service will update subscribers, like the Measurement Panel. Allowing us to decouple from cornerstone-tools as the source of truth.
The ROI drawn with the FreehandRoi tool can be removed with the eraser. That is sufficient for now. But there's some other issue(s) because other tools such as the ellipse and rectangle ROI produce warnings in the measurement pane and don't show the measurement data. I believe these worked correctly in the past.
Ellipse and Rectangle may not currently work, but they should be easier to add support for as we improve the measurement service and the kinds of measurements it works with. Adding support for new measurements should be as simple as:
- Adding a new "mapping" type to the Measurement Service
- Providing a map from/to the measurement type to the Measurement Service's format
- Making sure the underlying source (cornerstone-tools) pushes updates from measurement-* events to the service
The bulk of this will be implemented round trip for length and bidirectional. You'll be able to follow the same pattern for other tools.