a simple question about macro

Posted by Stone Von on
URL: http://imagej.273.s1.nabble.com/a-simple-question-about-macro-tp3702154.html

Dear ImageJ users and developers,

I am a new ImageJ user.

I want to use ImageJ to analyze particles in a tiff sequence.

First, I generate a tiff sequence which contains 5000 tiff images.
And there is only one particle in each tiff image.
I only want to know the particle positions.

Then, because there are so many images, I can not measure images one by one.
I wanted to use macro command to analyze particle positions.
I changed the macro command "Batch Measure" to a similar macro command "Batch Particle Analyze".
The macro command "Batch Particle Analyze" is below:


// This macro batch measures a folder of images.
// Use the Analyze>Set Measurements command
// to specify the measurement parameters. Check
// "Display Label" in the Set Measurements dialog
// and the file names will be added to the first
// column of the "Results" table.

macro "Batch Particle Analyze" {
    requires("1.33n");
    dir = getDirectory("Choose a Directory ");
    list = getFileList(dir);
    start = getTime();
    setBatchMode(true); // runs up to 6 times faster
    for (i=0; i<list.length; i++) {
        path = dir+list[i];
        showProgress(i, list.length);
        if (!endsWith(path,"/")) open(path);
        if (nImages>=1) {
                setThreshold(1, 16384);
            run("Analyze Particles...");

            close();
        }
    }
  //print((getTime()-start)/1000);
}


It can calculate the particle positions, but I have to click "OK" on the "Analyze Particles" window
appears when ImageJ begins to calculate a new image.
However, it is almost impossible for me to click 5000 times to analyze our images.
Could you tell me how to add a command in the "Batch Particle Analyze" to help me click "OK" on
the "Analyze Particles" window appears when ImageJ begins to calculate a new image.

Thanks in advance for any answer and any suggestion!

Stone