Last active
April 6, 2021 06:16
-
-
Save romainGuiet/643e7de75ef453a19ba514edbc0e0080 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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