imagej / ImageJ

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

Fix float z-projections #172

Closed hinerm closed 1 year ago

hinerm commented 1 year ago

@rasband when you get a chance to look at this, there are two issues addressed in this change:

  1. There is currently an off-by-one error in the new float average projection method
  2. By using a double to track the intermediate sum, Z-projection values are changed compared to the old AverageIntensity projector.

As-is, this PR fixes the off-by-one error and makes the new behavior consistent with old average float projections, by returning to a float intermediate.

But you have some options here: what is your preference for the z projections? Would you rather use a double to have better rounding, BigDecimal for accuracy at the expense of performance, or stick to float to keep things consistent with previous ImageJ behavior?

rasband commented 1 year ago

The off-by-one error in the ZProjector.doAverageFloatProjection() method is fixed in the ImageJ 1.53u5 daily build. The method continues to use double when summing to have better rounding. The commit is at https://github.com/imagej/ImageJ/commit/d7f396b7517fb990a6ad5d4f60d1efe3f27058c1