Login  Register

Re: Macro to visualize ellipse, major and minor axes on objects

Posted by jmutterer on Feb 12, 2009; 8:49pm
URL: http://imagej.273.s1.nabble.com/Macro-to-visualize-ellipse-major-and-minor-axes-on-objects-tp3693719p3693720.html

Marc,

The following macro draws the axes on the elipses image of analyzed objects.
Sincerely,

Jerome.

//Draw axes on objects elipses
run("Blobs (25K)");
run("Make Binary");
run("Set Measurements...", "  min centroid bounding fit shape area_fraction
limit redirect=None decimal=3");
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00
show=Ellipses display exclude clear add");
run("RGB Color");
for(i=0; i<nResults; i++) {
    x=getResult('X',i);
    y=getResult('Y',i);
    d=getResult('Major',i);
    a = getResult('Angle',i)*PI/180;
    setColor("blue");
    drawLine(x+(d/2)*cos(a),y-(d/2)*sin(a),x-(d/2)*cos(a),y+(d/2)*sin(a));
    d=getResult('Minor',i);
    a=a+PI/2;
    setColor("red");
    drawLine(x+(d/2)*cos(a),y-(d/2)*sin(a),x-(d/2)*cos(a),y+(d/2)*sin(a));
}
// end


On Thu, Feb 12, 2009 at 6:28 PM, picheral <[hidden email]> wrote:

> I would like to visualize the best fitted ellipse and its axes (minor and
> major) on the object analysed in a vignette. Is there a macro for that ?
> Regards
> Marc P.
>
>
> --
> View this message in context:
> http://n2.nabble.com/Macro-to-visualize-ellipse%2C-major-and-minor-axes-on-objects-tp2316250p2316250.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>