Simple area measurement from length scaling

Dear all,

I looked for an answer using the search tool but I didn’t find a proper one. That’s why I’m posting the folowing question:

I set the scale for length measurements which works out great and now want to measure the area of an ellipse, circle or even better closed spline.

  1. How do I dram a closed spline for area measurement?

  2. How can I measure the area correctly? The scale seems to apply to length measurements but not to area measurements.


The area in this elliptical example should be A=pi1.6690.138=0.724 but the measurement is 0.198. Why is that?

Best regards,
Felix

Hi
Maybe this?

makeRectangle(344, 0, 1913, 447);
run("Crop");
//setTool("polygon");
makePolygon(2,128,278,72,944,46,1606,72,1882,126,1610,182,944,202,276,186);
run("Fit Spline");
roiManager("Add");
roiManager("Select", 0);
run("Set Measurements...", "area perimeter shape redirect=None decimal=3");
roiManager("Measure");

Hi Mathew,
thank you for your reply.

I have to look deeper into your code and it’ll take me a bit because I’m not used to scripting in ImageJ. I imagined that there could be a very simple solution and I guess I was wrong. I will let you know as soon as I tried your script.

Best regards,
Felix

Hi Mathew,
I attached two screenshots to this mail. One with scaling and the other without. Does it help to test the script?

Hi
@felix.b

Your non-annotated image is “weird”: looks like some kind of screenshot?
Can you confirm?

Wrong reading of your message: this is a screenshot.
It’s a shame, it would take the original image.
In any case here is a macro for this image.

run("Scale...", "x=0.3 y=0.3 width=756 height=337 interpolation=Bilinear average create");
close("\\Others");
//setTool("rectangle");
makeRectangle(0, 12, 753, 325);
run("Duplicate...", "orig");
orig=getImageID();
close("\\Others");
selectImage(orig);
run("Duplicate...", "title=2");
run("8-bit");
run("Statistical Region Merging", "q=25 showaverages");
//setTool("wand");
doWand(374, 145, 0, "Legacy");
roiManager("Add");
roiManager("Select", 0);
run("Set Measurements...", "area perimeter feret's add redirect=None decimal=3");
roiManager("Measure");
roiManager("Set Fill Color", "blue");

Maybe you will need to read this!

Greetings

1 Like

Hi Mathew,
thank you for your help. Your solution is quite interesting.