a simple question about macro

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

a simple question about macro

Stone Von
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
Reply | Threaded
Open this post in threaded view
|

Re: a simple question about macro

Stone Von
Because the image is 14-bit, so I set the lower threshold as 1, upper threshold as 2^14=16384
Reply | Threaded
Open this post in threaded view
|

Re: a simple question about macro

Christophe CHAMOT
In reply to this post by Stone Von
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/
---------------------------------------------------------------------  
Reply | Threaded
Open this post in threaded view
|

AW: a simple question about macro

Lucas, Falk /BDF HAM
In reply to this post by Stone Von
Hi,

just open one of your image, start the macro recorder, click  on analyze>>analyse particles... make all the setting you need and click the OK button. In the recorder window you will get something like

run("Analyze Particles...", "size=2-Infinity circularity=0.00-1.00 show=Masks clear record");  

just copy this line into your macro  an you never have to click the OK button anymore...

BTW, this works on pretty much all commands that have the syntax run("bla..."). They usally have a second parameter (string) for all settings one would enter in a dialog.

Falk

-----Ursprüngliche Nachricht-----
Von: ImageJ Interest Group [mailto:[hidden email]] Im Auftrag von Stone Von
Gesendet: Freitag, 14. Juli 2006 17:28
An: [hidden email]
Betreff: a simple question about macro

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
--
View this message in context: http://www.nabble.com/a-simple-question-about-macro-tf1943755.html#a5328462
Sent from the ImageJ forum at Nabble.com.


_____________________  Confidentiality  ______________________

This electronic transmission is strictly confidential and intended
solely for the addressee.  It may contain information which is covered
by legal, professional or other privilege.  If you are not the intended
addressee, you must not disclose, copy or take any action in reliance
of this transmission.  If you have received this transmission in error,
please notify us and delete the received data as soon as possible.

This footnote also confirms that this email message has been swept
for the presence of computer viruses.
_______________________________________________________