imagej / ImageJ

Public domain software for processing and analyzing scientific images
http://imagej.org
Other
576 stars 227 forks source link

Scale bar length off by 1 pixel due to not rounding #180

Closed bobfRT1 closed 2 years ago

bobfRT1 commented 2 years ago

Line 301 in https://github.com/imagej/ImageJ/blob/84e9e3b0c872b5c38121d0e77b6fbd4cfa4a3b9b/ij/plugin/ScaleBar.java

should read

barWidthInPixels = (int)Math.round((barWidth/cal.pixelWidth));

instead of

barWidthInPixels = (int)(barWidth/cal.pixelWidth);

This issue is obvious then setting the pixel size to 3.25 mu and adding a 10 mu scale bar. In that case the scale bar is only 2 pixels long instead of 3.

(I don't have Java, so sorry for not submitting this as a pull request)

rasband commented 2 years ago

This fix is in the ImageJ 1.53u44 daily build.