Login  Register

Re: particle analysis - angle determination

Posted by Michael Schmid on May 10, 2007; 5:34pm
URL: http://imagej.273.s1.nabble.com/Fwd-particle-analysis-angle-determination-tp3699508p3699509.html

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