// This macro demonstrates how to convert a stack // to binary using a custom thresholding method. requires("1.49k"); run("Fly Brain (1MB)"); run("8-bit"); setOption("BlackBackground", true); for (i=nSlices; i>0; i--) { setSlice(i); getRawStatistics(n, mean); setThreshold(mean, 255); //print(i, mean); run("Make Binary", "slice"); }