<html>
<head>
<base href="http://fiji.sc/bugzilla/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:gadea.mata@unirioja.es" title="Gadea Mata <gadea.mata@unirioja.es>"> <span class="fn">Gadea Mata</span></a>
</span> changed
<a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED - Bug in the Intermodes algorithm of threshold"
href="http://fiji.sc/bugzilla/show_bug.cgi?id=938">bug 938</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>RESOLVED
</td>
<td>REOPENED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>INVALID
</td>
<td>---
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED - Bug in the Intermodes algorithm of threshold"
href="http://fiji.sc/bugzilla/show_bug.cgi?id=938#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED - Bug in the Intermodes algorithm of threshold"
href="http://fiji.sc/bugzilla/show_bug.cgi?id=938">bug 938</a>
from <span class="vcard"><a class="email" href="mailto:gadea.mata@unirioja.es" title="Gadea Mata <gadea.mata@unirioja.es>"> <span class="fn">Gadea Mata</span></a>
</span></b>
<pre>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: <a href="https://www.dropbox.com/s/sm7p9f0n8z1mxdw/gfp-6.tif?dl=0">https://www.dropbox.com/s/sm7p9f0n8z1mxdw/gfp-6.tif?dl=0</a>. 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:
<a href="https://github.com/fiji/Auto_Threshold/blob/0565751243a83688c84857475adb51ae836a843e/src/main/java/fiji/threshold/Auto_Threshold.java#L493-L541">https://github.com/fiji/Auto_Threshold/blob/0565751243a83688c84857475adb51ae836a843e/src/main/java/fiji/threshold/Auto_Threshold.java#L493-L541</a>),
and (2) the recently ported implementation from Fiji's Auto_Thresold, in the
ImageJ OPS library
(<a href="https://github.com/imagej/imagej-ops/blob/114183192d41e9dcbe0e6450512170f8a566dc6e/src/main/java/net/imagej/ops/threshold/global/methods/ComputeIntermodesThreshold.java#L58-L100">https://github.com/imagej/imagej-ops/blob/114183192d41e9dcbe0e6450512170f8a566dc6e/src/main/java/net/imagej/ops/threshold/global/methods/ComputeIntermodesThreshold.java#L58-L100</a>).
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
(<a href="https://github.com/imagej/ImageJA/blob/v1.49h/src/main/java/ij/process/AutoThresholder.java#L198-L199">https://github.com/imagej/ImageJA/blob/v1.49h/src/main/java/ij/process/AutoThresholder.java#L198-L199</a>).
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>