Login  Register

Re: Autothresholding results; (was FW: Threshold is giving an incomplete range ?)

Posted by Gabriel Landini on May 22, 2017; 3:43pm
URL: http://imagej.273.s1.nabble.com/Autothresholding-results-was-FW-Threshold-is-giving-an-incomplete-range-tp5018760p5018774.html

Hello Robert,
I had a look at the Auto Threshold plugin. The Otsu algorithm had indeed an
issue only with certain 16bit histograms where the computation of the variance
could cause an overflow that carried on without triggering an error.
I checked Emre Celebi's library (Fourier 0.8) and his C++ version does not
have the problem so I replaced the previous version with Emre's.
8 bit images were not affected.  I just checked and it finds the ball in your
sample image now.

The Huang method is a different issue. The original code by Emre was
rewritten in 2011 by Johannes Schindelin to use more efficiently the 16bit data
and has a massive execution speed advantage. However I just noted that in some
cases it does return exactly the same values as the original even in some 8bit
images. I therefore added back the original code and kept Johannes' method as
"Huang2" for the time being until I have time to look at it in more depth.

I also found that the Mean method (again in 16bits only) had a potential for
overflow that could go without triggering errors, so I fixed that too.
Your example image was very useful to track that down.

Here is the link to the updated file.
http://www.mecourse.com/landinig/software/autothreshold/autothreshold.html

I will update the Fiji source too, but this won't happen for some days as I
will be away. Perhaps it is best consider the 16bit support in the other
methods as experimental in the mean time.

Cheers
Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html