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. 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 Zhengyu Pang, Ph.D. Biochemistry and Bioanalytics Laboratory Life Sciences and Molecular Diagnostics Technology Organization Diagnostics, Imaging, and Biomedical Technologies GE Global Research, K1-5B37A One Research Circle Niskayuna, NY 12309 T: 518-387-4015 F: 518-387-7765 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Tuesday 21 Oct 2014 12:56:47 you wrote:
> 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. > > 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. This is because the thresholder uses a 256-bin histogram out of the 16 bit image to pack it into a manageable size, so in the first bin there are more than one pixel value. You perhaps need to do it by hand: go pixel by pixel and set it to the highest value and the rest to 0. Or use the changeValues(v1, v2, v3) macro function. Hope this helps Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Zhengyu,
one more remark: Even if you don't see the correct pixels painted red, most operations using the threshold do the correct thing. So if you have a 16-bit image and set the Threshold at from 1 to 1, operations like 'Create Mask' or the Wand tool select the area where the pixel value is exactly one. (for the Wand tool, of course you have to know where to click, which might be a problem is you don't see it). What exactly do you have in mind? Seeing where a given cell number can be found in something like the 'Count Masks' created by Analyze Particles? If you use Analyze Particles with "record starts" enabled, one could e.g. create a macro that recovers the starting coordinates of a given particle, uses the Wand to select it, and then use Overlay.addSelection("", 0, "red") to show it red. Michael ________________________________________________________________ On Oct 21, 2014, at 15:13, Gabriel Landini wrote: > On Tuesday 21 Oct 2014 12:56:47 you wrote: >> 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. >> >> 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. > > This is because the thresholder uses a 256-bin histogram out of the 16 bit > image to pack it into a manageable size, so in the first bin there are more > than one pixel value. > > You perhaps need to do it by hand: go pixel by pixel and set it to the highest > value and the rest to 0. > Or use the changeValues(v1, v2, v3) macro function. > > Hope this helps > > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by pang
> 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 |
Free forum by Nabble | Edit this page |