Dear list,
I am trying to automatically set the threshold of a 16-bit image from its
minimum threshold to one bin below its maximum in order to threshold
everything except the background in the image. Here is the code snippet
(threshFactor = 32768, since the ImageStatistics returns unsigned values, I
need to subtract it to get the correct thresholds):
ImageStatistics stats = new ImageStatistics();
stats = itemp.getStatistics();
double thismax = stats.histMax;
double thismin = stats.histMin;
double bins = stats.binSize;
int min = (int) (thismin - threshFactor),
max = (int) (thismax - bins - threshFactor);
IJ.run("Threshold..."); // this line is needed to make it
work!!!
IJ.setThreshold(min, max);
The problem is that if I comment out the line ³IJ.run("Threshold...");³ the
image is completely thresholded as if I had used the minimum and maximum.
With the line, it thresholds correctly, but I have the threshold window.
This doesn¹t seem right. Is this some kind of bug? Is there a workaround?
Thanks in advance.
Chris Coulon
The GAIA Group
Global Automated Image Analysis
http://www.gaiag.net[hidden email]
We welcome image analysis problems in all fields.
Christopher Coulon, Ph.D., Founder