Re: a simple question about macro

Posted by Christophe CHAMOT on
URL: http://imagej.273.s1.nabble.com/a-simple-question-about-macro-tp3702154p3702156.html

Stone Von a écrit :

> 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
>  
Hello Stone,

You need to pass all the arguments to "Analyse particle" with a line
(according your version) like this one :

run("Analyze Particles..." , "size=0-Infinity circularity=0.00-1.00
show=Nothing display");

Regards,

Kriss

--
Christophe CHAMOT
---------------------------------------------------------------------
Plate-Forme  de Recherche IFR117
"Imageries des Processus Dynamiques
en Biologie  Cellulaire et Biologie du Développement "
Institut Jacques Monod, CNRS,  Universités Paris 6 et 7
2, place Jussieu - Tour 43
75251 Paris cedex  05
Tel: 01 44 27 47 56
fax: 01 44 27 98 57
http://www.ijm.jussieu.fr/
---------------------------------------------------------------------