Login  Register

Analyze Particles macro in headless mode

Posted by nickxtsui on Mar 07, 2014; 9:41pm
URL: http://imagej.273.s1.nabble.com/Analyze-Particles-macro-in-headless-mode-tp5006825.html

Dear ImageJ fellows:

Many many thanks for your time reading my email. I am trying to do Analyze
Particles in macro, using Fiji headless mode. I have two questions, and I
am showing my code first, which will followed by the questions:

Code:

for (i=0; i<list.length; i++) // go through files in the folder
    {
        showProgress(i+1, list.length);

        if (endsWith(list[i], ".tif")) // process tiff
        {
            open(input_dir+list[i]);
            print(list[i]);
run("Invert LUT");
run("8-bit");
setAutoThreshold();
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00
show=Overlay Outlines display record slice");
run("16-bit");
            dotIndex = lastIndexOf(list[i], ".");
            if (dotIndex != -1) output_file = substring(list[i], 0,
dotIndex); //remove extension
            saveAs("PNG", output_dir+output_file);
            close(output_file);
            close(list[i]);
            check++;
        }
else if (list[i] == "Experiment.xml") // Experiment.xml file copied into
output folder for review in ThorImageLS
{
print(list[i]);
src = input_dir + list[i];
dst = output_dir + list[i];
 print(src);
print(dst);
 exec("cmd", "/c", "copy", src , dst);
}
    }


Questions 1:
In my results, I can only see the Invert LUT works, but I cannot see run
Analyze Particles work, because there is neither outline, nor object count
showing on the result images. However, when I use the memu on Fiji UI to do
the same thing, I can see outlines and object counts on the results images.
I am wondering something wrong with my script?


Questions 2:
Even if I can show outlines and object counts with Fiji UI, I cannot save
the outlines and object counts together with result images when they are
saved as .TIFF, however, when the results are saved as .PNG, or .JPEG, I
can see the outlines and objects counts saved together. I am wondering is
there anyway to save outlines and object counts even when result images are
saved as .TIFF?

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