Posted by
Michael Doube-2 on
URL: http://imagej.273.s1.nabble.com/Path-Writer-plugin-tp3703553p3703555.html
Thanks everyone for your helpful suggestions!
An example image is at
http://doube.net/images/condyle.gifChris 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");
}