Is fit ellipse angle's positive direction counterclockwise or clockwise (unusual)?

Normally when we want to report angle, we assume that the angle the line and positive section of x-axis in the counter-clockwise orientation to be positive as shown in the image:
download
and for fitted ellipse from here:
Angle is the angle between the primary axis and a line parallel to the X-axis of the image.”
which is normally the “counter-clockwise” direction.
BUT I saw in here that it is:
"t: theta, angle of major axis, clockwise with respect to x axis. "
Any idea whether the positive direction is clockwise or counter clockwise? It is so very disappointing to use the uncommon way of definition and not including it in the guide section.

Hi @Zeynab_Mousavi,

The angle reported by the “fit ellipse” routine is measured between the X axis and the major axis of the ellipse, starting from the positive X direction (right), and moving counter-clockwise. Due to the simmetry of the ellipse, this angle will always be positive.

Nico

Thanks. I agreed with you until I saw this statement in the source code:
"t: theta, angle of major axis, clockwise with respect to x axis. "
Reference:
https://github.com/imagej/ImageJA/blob/8e283502055d25b9f0456f4aad95afa30a649d45/src/main/java/ij/process/EllipseFitter.java#L15
Please check the definition from this website. It is different from what you assumed.

I’m not sure about that comment in the source code (are you positive that’s the actual way it is implemented? I should read that code carefully to be sure.). Anyways, you can actually try some examples to convince yourself:

newImage("Untitled", "8-bit black", 256, 256, 1);
run("Specify...", "width=128 height=72 x=128 y=128 oval centered");
setForegroundColor(255, 255, 255);
run("Fill", "slice");
run("Select None");

run("Copy");
for (i = 1; i <18 ; i++) {
	run("Add Slice");
	run("Paste");
	run("Rotate... ", "angle="+(-10*i)+" grid=1 interpolation=Bilinear slice");
	}

run("Select None");


run("Set Measurements...", "fit display redirect=None decimal=4");
setAutoThreshold("Default dark");
run("Analyze Particles...", "display stack");

resetThreshold();

2 Likes

@NicoDF Thank Nico. I think it is better to correct it in the source code.