-
-
Save maweigert/8dd6ef139e1cd37b2307b35fb50dee4a 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
#@ DatasetIOService io | |
#@ CommandService command | |
""" This example runs stardist on all tif files in a folder | |
Full list of Parameters: | |
res = command.run(StarDist2D, False, | |
"input", imp, "modelChoice", "Versatile (fluorescent nuclei)", | |
"modelFile","/path/to/TF_SavedModel.zip", | |
"normalizeInput",True, "percentileBottom",1, "percentileTop",99.8, | |
"probThresh",0.5, "nmsThresh", 0.3, "outputType","Label Image", | |
"nTiles",1, "excludeBoundary",2, "verbose",1, "showCsbdeepProgress",1, "showProbAndDist",0).get(); | |
""" | |
from de.csbdresden.stardist import StarDist2D | |
from glob import glob | |
import os | |
# run stardist on all tiff files in <indir> and save the label image to <outdir> | |
indir = os.path.expanduser("~/Tmp/images/") | |
outdir = os.path.expanduser("~/Tmp/labels/") | |
for f in sorted(glob(os.path.join(indir,"*.tif"))): | |
print "processing ", f | |
imp = io.open(f) | |
res = command.run(StarDist2D, False, | |
"input", imp, | |
"modelChoice", "Versatile (fluorescent nuclei)", | |
).get() | |
label = res.getOutput("label") | |
io.save(label, os.path.join(outdir,"label."+os.path.basename(f))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello!
I am trying to use this code to run stardist on all the pics in the directory but I am getting this error,
SyntaxError: no viable alternative at input ‘=’
does anyone know how to fix it.
thank you
`#@ DatasetIOService io
#@ CommandService command
theinput = "C:\Users\abdel\Downloads\8bitgreen";
output = "C:\Users\abdel\Downloads\try";
print (theinput)
setBatchMode(true);
list = getFileList(theinput);
print (list)
for (i = 0; i < lengthof(list); i+=){
IJ.run(list[i], "8-bit", "");
run("Command From Macro", "command=[de.csbdresden.stardist.StarDist2D], args=['input':'list[i]', 'modelChoice':'Versatile (fluorescent nuclei)', 'normalizeInput':'true', 'percentileBottom':'1.0', 'percentileTop':'99.8', 'probThresh':'0.15000000000000002', 'nmsThresh':'0.3', 'outputType':'Both', 'modelFile':'C:\\Users\\abdel\\Downloads\\dsb2018_heavy_augment.zip', 'nTiles':'5', 'excludeBoundary':'2', 'roiPosition':'Automatic', 'verbose':'false', 'showCsbdeepProgress':'false', 'showProbAndDist':'false'], process=[false]");
rm.runCommand(list[i],"Measure");
IJ.saveAs("Results", output + filename);
}
setBatchMode(false);
`