analyze particles with problem of threhold

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

analyze particles with problem of threhold

Xin Li-6
Hi,there:

  I have a problem to analyze particles of a series of images with macro
script. Every time imageJ report me with a result of NaN. It looks the
command "Analyze Particle" requires my images thrsholded or of 8 bit
format. Here below is my macro. I checked my middle result after making
binary, it looks OK, but when I opened it again and tried analyze
particles, I was told the image must be thrsholded ot of 8-bit format.
Would anyone help me on this? Thanks a lot!


requires("1.33n");
setBatchMode(true);

dir = getDirectory("Choose a Directory ");
count = 1;
processFiles(dir);

function processFiles(dir)
{
        list = getFileList(dir);
      for (i=0; i<list.length; i++)
        {
          if (endsWith(list[i], "/"))
              processFiles(""+dir+list[i]);
          else
                {
                        print("Processing"+(count++) + ": " + dir + list
[i]);
                        open(dir + list[i]);
                        run("Subtract Background...","rolling ball
radius=50 white background=1");
                       
                       
                       
                        setAutoThreshold();
                        run("Colors...", "foreground=black");
                        run("Colors...", "background=white");
                        run("Make Binary", "thresholded remaining");
                       
                       
                        //save("C:\\cellImageProcessing\\temp2\\"+list[i]);
                        //close();
                        //open("C:\\cellImageProcessing\\temp2\\"+list[i]);
                        run("8-bit");
                       
                        run("Analyze Particles...","size=500-Infinity
circularity=0.00-1.00 show=Nothing summarize=1");
                        cellArea=getResult("Area Fraction",nResults-1);
                        print(cellArea);
                        close();
                       
                }
      }
}