Dividing circle into 8 equal areas

Hello all,

I am relatively new to Image J. I am using it to quantify vessels in a defined area between two circles (donut) using the concentric circle plugin. Also, I’ve thresholded the image to highlight these capillaries to obtain the area. However, I desire separate measurements of area for each of 8 equally divided regions of the donut. Any advice on how to create these 8 equal regions of the donut in order to obtain their area? The creation of quadrants would also be permissible.

Thank you for any help!

Welcome to the forum, @acha!

Can you post a sample image?

Hi @acha,

This looked fun to do so I took at swing at it using the macro language.

You can find the macro under


Right click on RAW to download the .ijm file.

To run it, open the .ijm file in Fiji and Hit the Run button.

Or go to Plugins > Macros > Install… if you want to run it using the [F2] shortcut.

Best

Oli

8 Likes

Hello @oburri,

Thank you for this macro! It seems like a great solution. I’m having just a few difficulties with running it, which likely may be related to my inexperience.

When I run it, as expected, it asks me to draw a line thru the image and then 2nd box asks for number of circles and quadrants. However, afterwards, a single quadrant (or 1/8 region) appears instead of a diagram like yours. Additionally, although the macro text includes radii of the circles, when I’ve run it, there has been no dialog box prompt for it (and thus the quadrant does not extend entirely to the rim of the inner circle). I also ran the macro in an empty window and got the same result. I appreciate your help. I’ve attached a sample of what I ended up with to the right. Thank you very much!

To see all segments, simply activate the Show All checkbox in the ROI Manager:

Thank you @imagejan for the ROI Manager show all advice!

Also, in regards to the quadrant not extending to the rim, I realized that was due needing to change the radius within the macro text since I have two different fixed radii.

Thank you for all the help!

Hello,
My situation is a little bit different; I drew a polygon that represents cell surface and then I used the DrawEllipse macro to fit this polygon to an ellipse:

I then would like to generate multiple concentric ellipses around this original ellipe. The final aspect would be something like presented in this paper (C, c). Is there a way to modify the macro created by @oburri to do that ?
I apologize if this is too trivial, but I am new at writting macros and apparently also don`t know enough about basic geometry.
Thank you very much !

Good day,

here is a macro that starts from the image with polygon selection and does not perfectly what is shown in the paper but may help you further:

fact = 1.5;
invfact = 1 / fact;
roiManager( "Add" );
run( "Fit Ellipse" );
roiManager( "Add" );
for ( i = 0; i < 3; i++ ) {
	run( "Scale... ", "x=" + fact + " y=" + fact + " centered" );
	roiManager( "Add" );
}
roiManager( "select", 1 );
for ( i = 0; i < 3; i++ ) {
	run( "Scale... ", "x=" + invfact + " y=" + invfact + " centered" );
	roiManager( "Add" );
}
roiManager( "select", 0 );
roiManager( "Set Color", "grey" );
roiManager( "Show All" );
run( "Overlay Options...", "stroke=yellow width=1 fill=none" );
run( "From ROI Manager" );
run( "Close" );

Paste the above macro code to an empty macro window (Plugins >> New >> Macro) and run it.
(Make sure that you’ve made the polygon selection first.)

The original polygon and the ellipses are drawn as Overlay that you may hide and show.

Regards

Herbie

3 Likes

Here is an alternative:

delta = 6;
roiManager( "Add" );
run( "Fit Ellipse" );
roiManager( "Add" );
for ( i = -3; i < 5; i++ ) {
	roiManager( "select", 1 );
	run( "Enlarge...", "enlarge=" + i * delta );
	run( "Fit Ellipse" );
	roiManager( "Add" );
}
roiManager( "select", 0 );
roiManager( "Set Color", "grey" );
roiManager( "Show All" );
run( "Overlay Options...", "stroke=yellow width=1 fill=none" );
run( "From ROI Manager" );
run( "Close" );

Regards

Herbie

2 Likes

Thats terrific, @Herbie ! Its exactly what I was looking for.
I`ll now search in this forum for a way of get measurements from the area between two consecutive ellipses.
Thank you very much, @anon96376101 !

A post was split to a new topic: Dividing into equal areas over time with object drift