-
-
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
@Bassetyabrag You cross-posted this also at the image.sc forum, where I replied to you.