Path Writer plugin

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

Path Writer plugin

Michael Doube-2
Hi all

I've got a use for the Path Writer plugin - generating a curve that
describes a joint surface of my favourite bone, the equine 3rd
metacarpal, in large SEM montages of bone sections.

http://rsb.info.nih.gov/ij/plugins/download/Path_Writer.java

I can find the joint surface quickly by thresholding (outside world
black, bone white) then magic wanding the outside world.  Path Writer
returns a handy set of points that I can use for analysis.

My problem is this:  I don't want the points of the path that define the
edges of the image, just the points on the joint surface.  Is there a
quick hack that I can do that dumps only the points that are not on the
image boundary?  My Java skills are non-existent, so any comments
appreciated.

Cheers

Mike

--
Michael Doube  BPhil BVSc MRCVS
MPhil / PhD Student
Dental Institute
Barts and The London School of Medicine and Dentistry
Queen Mary, University of London
New Rd
London  E1 1BB
United Kingdom

Phone +44 (0)20 7377 7000 ext 2681
Reply | Threaded
Open this post in threaded view
|

Re: Path Writer plugin

Gabriel Landini
On Monday 27 February 2006 20:04, Michael Doube wrote:
> My problem is this:  I don't want the points of the path that define the
> edges of the image, just the points on the joint surface.  Is there a
> quick hack that I can do that dumps only the points that are not on the
> image boundary?  My Java skills are non-existent, so any comments
> appreciated.

No particular solution only some comments.

I am not sure the format of the path returned by the plugin, but if they are
ordered along the curve and it is not self-intersecting, you could define a
rectangular ROI that encloses the points of interest and then go through the
list of points and delete those that are not in the ROI.

If the search along the boundary is done using an edge tracking algorithm like
Freeman's (code in the Particles8 plugin), then this becomes a complicated
problem. Imagine that the boundary crosses the same point twice in a shape
like o-o. If the detection of the boundary starts from the  top left pixel
(the top of the left "o" and the search goes clockwise,  the line in the
middle  will be crossed going from let to right and also when coming back.
You would get those coordinates recorded twice. I suppose that this may be a
problem depending on what is one is intending to measure.

Another idea: would NeuronJ do the trick?

Cheers,

Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: Path Writer plugin

Michael Doube-2
Thanks everyone for your helpful suggestions!

An example image is at http://doube.net/images/condyle.gif

Chris Coulon wrote a nice macro that really streamlines the process,
dumping just the data from the boundary between the outside world
(bottom, black) and bone (white and black marrow spaces). FYI, here it is...

Mike

macro "get edge coordinates [f1]" {
  //  selectWindow("condyle.gif");
    w = getWidth(); h = getHeight();
    print("width: "+w+"\nheight: "+h);
    run("Erode");
    run("Dilate");
    run("Set Measurements...", "area limit redirect=None decimal=3");
    setThreshold(0, 121);
    run("Analyze Particles...",
        "size=1000-Infinity circularity=0.00-1.00 "
        +"show=Nothing clear record");
    aMax = 0;
    area = 0;
    x = 0; y = 0;
    for (i=0; i < nResults; i++) {
        area = getResult("Area", i);
        if (aMax < area) {
            aMax = area;
            x = getResult('XStart', i);
            y = getResult('YStart', i);
        }
    }
    doWand(x, y);
    run("Clear Outside");
    getSelectionCoordinates(x0, y0);
    n0 = 0; n1 = x0.length;
    x = newArray(n1);
    y = newArray(n1);
    for (i = 0; i < x0.length; i++) {
        print(i + " "+x0[i] + "  " + y0[i]);
        if ((x0[i] > 0) && (x0[i] < w) && (y0[i] < h) && (y0[i] > 0)) {
            x[n0] = x0[i];
            y[n0] = y0[i];
            write(n0 + " " + x[n0] + " " + y[n0]);
            n0++;
        }
    }
    selectWindow("Log");
    selectWindow("Results");
}