Algorithm of the calculation of the average diameter in ImageJ plugin DiameterJ

Hello, I’ve successfully used the plugin DiameterJ of ImageJ to calculate the diameters of the fibers represented in SEM images. I would like to know the exact way how the plugin calculates the average diameter: I know it is a cumulative average but looking for its definition and trying to do it manually the results do not match with the ones given by the plugin.
Here the formula I found:
avg(i)=(i-1)/i*avg(i-1)+x(i)/i ; i > 1
So I would ask if someone has some detail on it because I really need to know for the analysis of those images.
Thanks a lot for any suggestions.

@Cla

You can check the source code for DiameterJ here: