Created
December 3, 2019 14:08
-
-
Save romainGuiet/250edffa7d07604fb6e575d51abf86cf to your computer and use it in GitHub Desktop.
Postprocessing macro for DeepImageJ using StarDist model
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
name=getTitle(); | |
run("Make Substack...", "channels=1"); | |
rename("Predicted object probability"); | |
proba_ID = getImageID(); | |
run("Fire"); | |
selectWindow(name); | |
run("Make Substack...", "channels=2-33"); | |
rename("Predicted distance"); | |
selectWindow(name); | |
//close(); | |
// Get Mask From Proba | |
selectImage(proba_ID); | |
run("Duplicate...", "title=[proba-blur] duplicate"); | |
run("Gaussian Blur...", "sigma=5"); | |
run("Find Maxima...", "prominence=0.05 output=[Point Selection]"); | |
getDimensions(width, height, channels, slices, frames); | |
//Draw peaks position on a new image & make a Voronoi | |
newImage("peaks", "8-bit black", width, height, 1); | |
run("Restore Selection"); | |
setForegroundColor(255, 255, 255); | |
run("Draw", "slice"); | |
run("Voronoi"); | |
setThreshold(1, 110); | |
setOption("BlackBackground", true); | |
run("Convert to Mask"); | |
// Threshold the proba > 0.5 | |
selectImage(proba_ID); | |
run("Duplicate...", "title=[proba-mask] duplicate"); | |
setThreshold(0.05, 110); | |
run("Convert to Mask"); | |
// Math & Morphopho to clean it up a bit | |
imageCalculator("Subtract create", "proba-mask","peaks"); | |
run("Options...", "iterations=5 count=3 black do=Open"); | |
// Make some ROIs, defined minimum size is 250 here | |
run("Analyze Particles...", "size=250-Infinity add"); | |
selectImage(proba_ID); | |
roiManager("Show All"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment