Create a paint brush

Hi,

I am making an extension. I want to add one button to it which creates a paint brush with optional diameter (such as the one that exists in Segment Editor), the only thing it should return is the area in pixels in which the user has right clicked with the brush. How should this be done?

Thank you

One option is to add a segment editor widget to your module and activate the paint effect. You don’t need to show the widget, just create the object and use it. You can set up masking options (paint inside certain regions or intensity range) and then you can get area of the painted region using Segment Statistics module.

Alternatively, you can just use a markup and model to specify a circular region (something like this) and then compute what you need from the click position and the input image/segmentation using numpy.