Fwd: particle analysis - angle determination

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

Fwd: particle analysis - angle determination

Jarek Grodek
-------------------------- Wiadomość oryginalna --------------------------
Temat: particle analysis - angle determination
Od:    [hidden email]
Data:  Cz Maja 10 2007, 14:34
Do:    [hidden email]
--------------------------------------------------------------------------

Hi all,

i was wondering how to introduce "angle-tolerance" parameter? i work with
binary image were particles are elongated and oriented horizontally and
vertically. What i need is to measure only horizontally oriented
particles. Isn't it would be nice to introduce this parameter in "Analyze
particle" menu where one can set direction of orientation and tolerance of
angle?

can anyone be so kind and prepare macro which can offer this funcionality?
any help extremely appreciated.

greetings,
jarek
Reply | Threaded
Open this post in threaded view
|

Re: particle analysis - angle determination

Michael Schmid
Hi Jarek,

just have a look at the Macro language documentation and see
how the Macro Recorder (Plugins>Macros>Record) records the
commands you need.

Here is an example that you can use as a starting point:

run("Set Measurements...", " area fit redirect=None decimal=9"); //
whatever you want to record besides "fit"
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00  
show=Nothing display exclude record"); //whatever options you need
for (i=0; i<nResults; i++) {
   major = getResult("Major",i);
   minor = getResult("Minor",i);
   angle = getResult("Angle",i);
   area = getResult("Area",i);
   if (major > minor * 1.2 && (angle <45 || angle>135)) { //whatever  
kind of criterion you like
     print ((i+1)+": area="+area+", angle="+angle);  //whatever  
results you are interested in
   }
}

Instead of the fit ellipse you can also have a look at the
bounding rectangle.

Michael
________________________________________________________________

On 10 May 2007, at 14:38, Jarek Grodek wrote:

>
> Hi all,
>
> i was wondering how to introduce "angle-tolerance" parameter? i  
> work with
> binary image were particles are elongated and oriented horizontally  
> and
> vertically. What i need is to measure only horizontally oriented
> particles. Isn't it would be nice to introduce this parameter in  
> "Analyze
> particle" menu where one can set direction of orientation and  
> tolerance of
> angle?
>
> can anyone be so kind and prepare macro which can offer this  
> funcionality?
> any help extremely appreciated.
>
> greetings,
> jarek
Reply | Threaded
Open this post in threaded view
|

Re: particle analysis - angle determination

Jarek Grodek
Hello Michael,

thanks for your help.
I don't know to much about ImageJ macro language and java... i tried to
combine your code but it doesn't work in a macro...

it is:

run("Set Measurements...", " area fit redirect=None decimal=9");
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00
show=Nothing display exclude record");
for (i=0; i<nResults; i++) {
    major = getResult("Major",i);
    minor = getResult("Minor",i);
    angle = getResult("Angle",i);
    area = getResult("Area",i);
    if (major > minor * 1.2 && (angle <45 || angle>135))
 {
      print ((i+1)+": area="+area+", angle="+angle);
    }
}

and what I receive is error message:

"(...) ')' expected in line 3.
<show>=Nothing display exclude record ");" (...)"


I realize that it's dummy, but I have to ask for help or information,
where can I find information about this problem.

The other thing what I was thinking of was how to prepare the macro which
will read width and height of image, and split it in 3 ROIs(upper
rectangle, middle one and bottom rectangle)and will carry detection of
horizontally oriented particles in each of ROI, and in results table it
will be indicated in which ROI particle was found? Images may have
different width and height.

Thanks in advance to you, Michael, and anyone who may be helpful.

Greetings,
Jarek



> Hi Jarek,
>
> just have a look at the Macro language documentation and see
> how the Macro Recorder (Plugins>Macros>Record) records the
> commands you need.
>
> Here is an example that you can use as a starting point:
>
> run("Set Measurements...", " area fit redirect=None decimal=9"); //
> whatever you want to record besides "fit"
> run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00
> show=Nothing display exclude record"); //whatever options you need
> for (i=0; i<nResults; i++) {
>    major = getResult("Major",i);
>    minor = getResult("Minor",i);
>    angle = getResult("Angle",i);
>    area = getResult("Area",i);
>    if (major > minor * 1.2 && (angle <45 || angle>135)) { //whatever
> kind of criterion you like
>      print ((i+1)+": area="+area+", angle="+angle);  //whatever
> results you are interested in
>    }
> }
>
> Instead of the fit ellipse you can also have a look at the
> bounding rectangle.
>
> Michael
> ________________________________________________________________
>
> On 10 May 2007, at 14:38, Jarek Grodek wrote:
>
>>
>> Hi all,
>>
>> i was wondering how to introduce "angle-tolerance" parameter? i
>> work with
>> binary image were particles are elongated and oriented horizontally
>> and
>> vertically. What i need is to measure only horizontally oriented
>> particles. Isn't it would be nice to introduce this parameter in
>> "Analyze
>> particle" menu where one can set direction of orientation and
>> tolerance of
>> angle?
>>
>> can anyone be so kind and prepare macro which can offer this
>> funcionality?
>> any help extremely appreciated.
>>
>> greetings,
>> jarek
>
>
Reply | Threaded
Open this post in threaded view
|

Re: particle analysis - angle determination

Michael Schmid
Hi Jarek,

> and what I receive is error message:
>
> "(...) ')' expected in line 3.
> <show>=Nothing display exclude record ");" (...)"

The mailer has wrapped the long line.

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

should be in *one* line.

By the way, for Macros, you need no Java; the macro language has
some similarities to it, but you need not know anything about
object-oriented programming.

> The other thing what I was thinking of was how to prepare the macro  
> which
> will read width and height of image, and split it in 3 ROIs(upper
> rectangle, middle one and bottom rectangle)

Split the image manually (rectangular selections, duplicate) and use
the Macro Recorder. This should do the job (if you have a fixed image
size, you need no modifications to the code generated).
Otherwise, I fear, you will have to kook a little bit at the
documentation and a few sample macros to learn the macro language -
it is easy.


Michael
Reply | Threaded
Open this post in threaded view
|

Re: particle analysis - angle determination

Jarek Grodek
Hi Michael,

thank you again.
I try to "bite a cake" and find the solution of macro i need.
Greetings,
Jarek



> Hi Jarek,
>
>> and what I receive is error message:
>>
>> "(...) ')' expected in line 3.
>> <show>=Nothing display exclude record ");" (...)"
>
> The mailer has wrapped the long line.
>
> run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00
> show=Nothing display exclude record");
>
> should be in *one* line.
>
> By the way, for Macros, you need no Java; the macro language has
> some similarities to it, but you need not know anything about
> object-oriented programming.
>
>> The other thing what I was thinking of was how to prepare the macro
>> which
>> will read width and height of image, and split it in 3 ROIs(upper
>> rectangle, middle one and bottom rectangle)
>
> Split the image manually (rectangular selections, duplicate) and use
> the Macro Recorder. This should do the job (if you have a fixed image
> size, you need no modifications to the code generated).
> Otherwise, I fear, you will have to kook a little bit at the
> documentation and a few sample macros to learn the macro language -
> it is easy.
>
>
> Michael
>
>