Skip to content

Instantly share code, notes, and snippets.

@romainGuiet
Last active April 6, 2021 06:16
Show Gist options
  • Save romainGuiet/643e7de75ef453a19ba514edbc0e0080 to your computer and use it in GitHub Desktop.
Save romainGuiet/643e7de75ef453a19ba514edbc0e0080 to your computer and use it in GitHub Desktop.
run("Close All");
roiManager("reset");
// ring thickness
step = 10 ;
// prepare a test image
setForegroundColor(255, 255, 255);
setBackgroundColor(0, 0, 0);
newImage("Shape", "8-bit black", 512, 512, 1);
makePolygon(258,122,171,192,115,272,167,430,232,350,229,302,289,338,324,300,329,236,411,160);
run("Fill", "slice");
// Make distance map
run("Select All");
run("Duplicate...", "title=dMap");
//run("Invert");
run("Distance Map");
// and iterate to create ROIs
for (i = 0; i < 10; i++) {
selectWindow("dMap");
setThreshold(i*step+1, i*step+step);
run("Create Selection");
roiManager("Add");
}
//Show ROIs on the initial image
selectWindow("Shape");
roiManager("Show All");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment