Posted by
Rasband, Wayne (NIH/NIMH) [E] on
Oct 21, 2014; 4:05pm
URL: http://imagej.273.s1.nabble.com/Can-not-set-Threshold-at-1-tp5010131p5010133.html
> On Oct 21, 2014, at 8:56 AM, Pang, Zhengyu (GE Global Research) <
[hidden email]> wrote:
>
> Dear ImageJ colleagues,
>
> I have a 16-bit image with labeled cells. Pixel values for cell 1 is 1, and pixel values for cell 2 is 2, and so on. The background pixel value is zero. There are about 5000 cells in this image. When I tried to make a binary image to mask all cells using thresholding ( set threshold at 1). Surprisingly, the whole image becomes red (I set the threshold mode as RED), and I found that the minimum threshold I could use is 16. I would like to use setThreshold( 1, 5000), but it does not seem to do in that way.
Please make a sample image available online. It is difficult to answer a question like this without having an image to use for testing.
The image may not be displayed correctly because the Image>Adjust>Threshold command uses a 256 entry LUT but you can write a macro that sets the threshold range to 1-5000 and converts the image to binary.
The following example macro opens the Particles sample image, converts the 5097 particles to count masks (first particle has pixel values of 1, second has pixel values of 2, etc.), sets the threshold to 1-5000 and converts to binary. The resulting binary image has 5000 particles.
-wayne
setBatchMode(true);
run("Particles (75K)");
setAutoThreshold("Default");
run("Analyze Particles...", " show=[Count Masks]");
setThreshold(1, 5000);
setOption("BlackBackground", true);
run("Convert to Mask");
setBatchMode(false);
> Is there any people could help me to explain why this happens, and how to set the threshold at 1? Should I use plugin to do it? I am currently using ImageJ 1.47 and I found FIJI has the same issue too.
>
> Thanks!
>
> Zhengyu
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html