I’m getting unexpected results when I use Analyse > Measure for small straight lines in Fiji.
When they are of the order of a few pixels in length, the angle measurements (angle between line segment and the horizontal) seem incorrect. This is very clear for lines contained within a single pixel (<1px in length), which seem to always have angle 0. However line segment lengths are measured correctly. Is this a known issue?
I think that the coordinates of the ends are being rounded to the nearest pixel for the angle measurements, but not for the lengths.
Steps to reproduce:
create new image (File>New>Image…)
zoom in (to 3200%)
draw a single bright pixel (Pencil tool)
create small line segment contained within a single pixel (Straight line tool)
Expected behaviour: angle should be non-zero.
Observed behaviour: zero angle.
You are correct about this behavior, See my script, below, that
also reproduces what you describe.
I don’t know whether this is a “known issue” or not. I agree
with you that this behavior is sub-optimal, although one could
argue that this is “by design.”
You are correct that the Line endpoints are being converted
to the nearest pixel in the process of calculating the angle.
(I believe that they are being truncated rather than rounded,
although the issue is essentially the same.)
What’s odd is that the code is there to calculate the angle
without truncating. I think that Measure should calculate
the correct (untruncated) angles for Lines with sub-pixel
endpoints; it would be easy to fix; and I suspect that this
is just a historical artifact.
In the code, Analyzer.java, it looks like this issue can be
addressed by replacing the calls to: