[ImageJ-bugs] [Bug 938] Bug in the Intermodes algorithm of threshold
bugzilla at fiji.sc
bugzilla at fiji.sc
Mon Oct 6 06:00:20 CDT 2014
http://fiji.sc/bugzilla/show_bug.cgi?id=938
Gadea Mata <gadea.mata at unirioja.es> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |---
--- Comment #4 from Gadea Mata <gadea.mata at unirioja.es> ---
Thanks for all your answers. I am not completely sure about some parts of your
answers.
1) Packing 16bit histogram into an 8 bit space.
The problem that I commented not only appears when working with 16bits images,
but also with 8bits images. For instance, you can find a problematic image in
the link: https://www.dropbox.com/s/sm7p9f0n8z1mxdw/gfp-6.tif?dl=0. For this
image (an 8bits-image), different threshold values are returned when using the
Intermodes method of the plugins "Auto Threshold" and "Threshold...".
Therefore, I think that the problem is not related to the packaging of a 16bit
histogram into an 8 bit space.
2) What is the class that contains the correct code?
>From my point of view, the two correct implementations are (1) the "Auto
Threshold" implementation (which is part of Fiji, and can be found at:
https://github.com/fiji/Auto_Threshold/blob/0565751243a83688c84857475adb51ae836a843e/src/main/java/fiji/threshold/Auto_Threshold.java#L493-L541),
and (2) the recently ported implementation from Fiji's Auto_Thresold, in the
ImageJ OPS library
(https://github.com/imagej/imagej-ops/blob/114183192d41e9dcbe0e6450512170f8a566dc6e/src/main/java/net/imagej/ops/threshold/global/methods/ComputeIntermodesThreshold.java#L58-L100).
On the contrary, the ImageJ 1.x implementation in the class AutoThresholder is
not correct. I think that the problem appears when the “mean filter” is applied
to smooth the histogram
(https://github.com/imagej/ImageJA/blob/v1.49h/src/main/java/ij/process/AutoThresholder.java#L198-L199).
If I understand properly, the process to apply the mean filter with radius 3 to
an array A could be seen as follows. We have a new array B with the same length
as A and the value of B[i] is (A[i-1] + A[i] + A[i+1])/3 (the values of the
first and last element of B are computed using (A[0] + A[1])/3 and
(A[A.length-2]+A[A.length-1])/3) ― these are the formulas used in
Implementations (1) and (2). However, the formula that is used in the ImageJ
1.x implementation is B[i] = (B[i-1] + A[i] + A[i+1])/3.
In the case that the latter formula is the correct one, it should also be used
in Implementations (1) and (2); otherwise, different results will be obtained.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-bugs/attachments/20141006/3615a91f/attachment.html>
More information about the Imagej-bugs
mailing list