I want to add an option in my DICOM viewer to change the color of a polygon that was made by the freehand tool (different color for each polygon).
I checked the official example, and it seems that the only color customization that cornerstoneTools allow you is changing the global tool color which applies the color for all of the polygons [colorTools.setToolColor(..)].
Thanks
Finally figured out a solution.
// Listening to new measurement tools
// (in our case, this event raises everytime a new ROI is added)
$(canvas).on('cornerstonetoolsmeasurementadded', (e) => {
// Making sure this is the type is 'freehand'
// which is the tool used for drawing ROI
if (e.detail.toolType == 'freehand')
// Changing the color.
e.detail.measurementData.color = this.pickColor
})