Professional Documents
Culture Documents
//find the particle with the largest Area, which will be the one you want
//remove all the other particles
//from now on, BX, BY, Width, Height refer to the values in YOUR PARTICLE'S ROW
only
BX = getResult("BX", my_particle);
BY = getResult("BY", my_particle);
Width = getResult("Width", my_particle);
Height = getResult("Height", my_particle);
run("Fill Holes");
makeRectangle(BX, BY, Width, Height);
waitForUser("Your particle is selected on-screen");
wait(100);
run("Select None");
==
+=
+=
+=
+=
+=
+=
+=
+=
255) {
getPixel(i-1,j-1);
getPixel(i,j-1);
getPixel(i+1,j-1);
getPixel(i-1,j);
getPixel(i+1,j);
getPixel(i-1,j+1);
getPixel(i,j+1);
getPixel(i+1,j+1);
NNcounter /= 255;
if (NNcounter > 2) {
node_xpoints = Array.concat(node_xpoints, i);
node_ypoints = Array.concat(node_ypoints, j);
}
}
}
}
run("Duplicate...", "title=[branch image-1.jpg]");
run("Select All");
run("Clear");
makeSelection("point", node_xpoints,node_ypoints)
setForegroundColor(255, 255, 255);
run("Draw");
waitForUser("Make a blank image of the same size as the original image a
nd draw the node points (zoom in if you can't see them)");
run("Invert");
run("Ultimate Points");
waitForUser("Shrink the nodes down to single points (zoom in if you can'
t see them)");
run("Multiply...", "value=255");
run("Make Binary");
run("Set Measurements...", "centroid redirect=None decimal=0");
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show=[Count M
asks] display clear in_situ");
close();
for (n=0;n<nResults;n++) {
X=getResult("X",n);
Y=getResult("Y",n);
makeRectangle(X-6, Y-6, 10, 10);
setKeyDown("shift");
}
setKeyDown("none");
waitForUser(nResults + " nodes are displayed on-screen. See Results Table for co
ordinates. End of macro");
wait(100);
run("Revert");