I try to analyze images with Fiji. Therefore I first “calibrate” the scale with set scale run(“Set Scale…”, “distance=52.6 known=30 pixel=1 unit=no global”);
and then make a rectangle as seen in the picture: Pic 1. Then I execute a measurement with run(“Measure”);
and try to make a point at the centre of the rectangle with makePoint(XPos, YPos, “small yellow hybrid”);
as shown here: Pic 2.
XPos and YPos refer to the measured center coordinates of the rectangle. However the point is totally misplaced. I saw that the point is placed based on the pixels in the brackets and not based on my scale as seen in the second picture. Does anyone understand this behaviour, and how to help it?
Full Code:
run("Set Measurements...", "area centroid fit display redirect=None decimal=3");
run("Measure");
XPos=getResult("X", nResults-1);
YPos=getResult("Y", nResults-1);
print("Point placed at X "+XPos+" and Y "+YPos+".");
makePoint(XPos, YPos, "small yellow hybrid");
Would be happy if you could help me.
Best Max
Answer from biovoxxel on forum.image.sc
You can try the following after running the measurement. waitForUser("make a rectangular selection"); getSelectionBounds(x, y, width, height); makePoint(x+width/2, y+height/2); This is independent of the Results table and should produce the correct point position.