Skip to content

Instantly share code, notes, and snippets.

@miura
Last active August 29, 2015 14:05
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/ff36ea89d20db4f0d4ac to your computer and use it in GitHub Desktop.
Save miura/ff36ea89d20db4f0d4ac to your computer and use it in GitHub Desktop.
orgtitle = getTitle();
run("Split Channels");
selectWindow("C1-"+orgtitle);
c1id = getImageID();
selectWindow("C2-"+orgtitle);
c2id = getImageID();
selectImage(c2id);
run("Gaussian Blur...", "sigma=1 stack");
run("Auto Threshold", "method=Li white stack use_stack_histogram");
run("Open", "stack");
run("Fill Holes", "stack");
run("Duplicate...", "title=C2-NPC1-1.tif duplicate range=1-15");
c2erodeid = getImageID();
for (i = 0; i < 3; i++)
run("Erode", "stack");
selectImage(c2id);
for (i = 0; i < 3; i++)
run("Dilate", "stack");
imageCalculator("Subtract create stack", c2id, c2erodeid);
edgeid = getImageID();
selectImage(c2id);
close();
selectImage(c2erodeid);
close();
selectImage(edgeid);
for (i = 0; i < nSlices; i++){
setSlice(i + 1);
run("Create Selection");
run("Make Inverse");
roiManager("Add");
run("Select None");
}
selectImage(edgeid);
close();
selectImage(c1id);
run("Bleach Correction", "correction=[Simple Ratio] background=9");
correctedid = getImageID();
selectImage(c1id);
close();
run("Set Measurements...", "area mean standard min integrated stack redirect=None decimal=5");
run("Clear Results");
selectImage(correctedid);
roiManager("Select", newArray(0,1,2,3,4,5,6,7,8,9,10,11,12,13, 14));
roiManager("Measure");
//run("Plot Results", "plot=[Imported Data] x-values=Slice y-values=Mean style=Line color=Red gridlines gridlines labels labels major major");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment