Macro problem: number comparisons conditions in "if" statements

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

Macro problem: number comparisons conditions in "if" statements

Rogerio Hein
Dear all,

I am trying to create a macro to exclude some particles based on size
(Feret) and shape (circularity) ranges from image stacks. I am trying
to  use a solution similar to that in "CircularParticles.txt", as follows:

for (i=0; i<nResults; i++) {
    x = getResult('XStart', i);
    y = getResult('YStart', i);
    circularity = getResult('Circ.', i);
    if (circularity<0.85) {
        doWand(x,y);
        run("Clear");
    }
}

After running "Analyze Particles" command, some particles present values
outside the expected range. The same occurs for the circularity values
in the "CircularParticles.txt", from the IJ website, or as presented
above, some particles present circularity values below 0.85, even for
Blobs.gif example image. Is there a bug or am I forgotting any detail? I
am using version 1.41d.
Thanks in advance.

Best wishes,

Rogerio Hein


--
Prof. Dr. Luis Rogerio de Oliveira Hein, L.D.
Professor Adjunto
Departamento de Materiais e Tecnologia
Faculdade de Engenharia de Guaratinguetá
UNESP - Universidade Estadual Paulista "Júlio de Mesquita Filho"

Av. Ariberto Pereira da Cunha, 333
12516-410   Guaratinguetá, SP
Tel.: (12) 3123 2873
Fax: (12) 3123 2852
Cel.: (12) 8125 0651
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Macro problem: number comparisons conditions in "if" statements

Michael Schmid
Hi Luis,

using the "Blobs (25K)" sample image with auto threshold and
"apply" I cannot reproduce the problem.

I ran "Analyze Particles" once, then your macro, and "Analyze
Particles" again. This is the result:

        Area Mean Circ Feret
Mean 337 255 0.909 22.426
SD 190.592 0 0.034 8.081
Min 1 255 0.857 1.414
Max 660 255 1 35

One possible problem:
Did you make sure that the background color is set correctly
for erasing with "Clear" ?

Michael
________________________________________________________________

On 2 Jun 2008, at 17:03, Rogerio Hein wrote:

> Dear all,
>
> I am trying to create a macro to exclude some particles based on  
> size (Feret) and shape (circularity) ranges from image stacks. I am  
> trying to  use a solution similar to that in  
> "CircularParticles.txt", as follows:
>
> for (i=0; i<nResults; i++) {
>    x = getResult('XStart', i);
>    y = getResult('YStart', i);
>    circularity = getResult('Circ.', i);
>    if (circularity<0.85) {
>        doWand(x,y);
>        run("Clear");
>    }
> }
>
> After running "Analyze Particles" command, some particles present  
> values outside the expected range. The same occurs for the  
> circularity values in the "CircularParticles.txt", from the IJ  
> website, or as presented above, some particles present circularity  
> values below 0.85, even for Blobs.gif example image. Is there a bug  
> or am I forgotting any detail? I am using version 1.41d.
> Thanks in advance.
>
> Best wishes,
>
> Rogerio Hein
>
>
> --
> Prof. Dr. Luis Rogerio de Oliveira Hein, L.D.
> Professor Adjunto Departamento de Materiais e Tecnologia
> Faculdade de Engenharia de Guaratinguetá
> UNESP - Universidade Estadual Paulista "Júlio de Mesquita Filho"
>
> Av. Ariberto Pereira da Cunha, 333
> 12516-410   Guaratinguetá, SP
> Tel.: (12) 3123 2873
> Fax: (12) 3123 2852
> Cel.: (12) 8125 0651
> [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Macro problem: number comparisons conditions in "if" statements

Gabriel Landini
In reply to this post by Rogerio Hein
On Monday 02 June 2008, Rogerio Hein wrote:
> Dear all,
>
> I am trying to create a macro to exclude some particles based on size
> (Feret) and shape (circularity) ranges from image stacks.

> After running "Analyze Particles" command, some particles present values
> outside the expected range. The same occurs for the circularity values
> in the "CircularParticles.txt", from the IJ website, or as presented
> above, some particles present circularity values below 0.85, even for
> Blobs.gif example image. Is there a bug or am I forgotting any detail? I

If you are doing the above and you are testing for 2 criteria (circularity
*and* feret diameter) for particle deletion, there might be some particles
that do not satisfy both and therefore remain in the image.
Perhaps you want "or" instead of "and".

I hope it helps
G.