How to fit a circle in a binary image?

I am wondering if anyone knows of a way on ImageJ to fit a circle in a binary mask (see red circle in attached image) . Thanks in advance. Ideally the algorithm should try to find the best area on the image that can fit a circle. Thanks!

Hi Mongoose,

It is hard to help you as how would you define “finding the best area on the image that can fit a circle”. What is your criteria to say that that is the best place to fit a circle? The simplest I know is where to fit the largest circle into your ROI.

You could try computing something like the local curvature of your ROI and where it remains similar, fit a disk…?
(working code in progress)

I have a small “Fit largest inscribed circle” plugin, though I don’t think this will be what you expect.

Here is an example with your data, I colored the ROIs using the BAR plugin ROI color coder.


Hi @oburri,

Thanks for the help and explanation. Maybe your tool could be helpful for my problem. Is it available as a plugin in Fiji to try it out? I cannot seem to be able to find it on the menus.


Beautiful plugin! :heart:

From the plugin’s wiki page:

This plugin is available from the BIOP Update Site This places it in a “BIOP” Folder in the plugins directory of Fiji/ImageJ

1 Like