Skip to content

Instantly share code, notes, and snippets.

@miura
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miura/9845061 to your computer and use it in GitHub Desktop.
Save miura/9845061 to your computer and use it in GitHub Desktop.
setBatchMode(true);
title = getTitle();
c1 = "C1-" + title;
c2 = "C2-" + title;
run("Split Channels");
selectWindow(c1);
c1ID = getImageID();
selectWindow(c2);
c2ID = getImageID();
run("Gaussian Blur...", "sigma=1");
run("Auto Threshold", "method=Li white");
run("Open");
run("Fill Holes");
run("Duplicate...", "title=C2-2-" + title);
c2bID = getImageID();
setOption("BlackBackground", true);
for (i = 0; i < 3; i++)
run("Erode");
selectImage(c2ID);
for (i = 0; i < 3; i++)
run("Dilate");
imageCalculator("Subtract create", c2ID, c2bID);
rimID = getImageID();
run("Create Selection");
run("Make Inverse");
roiManager("Add");
selectImage(c1ID)
run("Set Measurements...", "area mean min integrated redirect=None decimal=2");
roiManager("select", 0)
roiManager("Measure");
//cleanup
selectImage(c2ID); close();
selectImage(c2bID); close();
selectImage(rimID); close();
setBatchMode("exit and display");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment