-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path0.5.0 Stardist.groovy
More file actions
28 lines (24 loc) · 1.02 KB
/
0.5.0 Stardist.groovy
File metadata and controls
28 lines (24 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import qupath.ext.stardist.StarDist2D
import qupath.lib.gui.dialogs.Dialogs
import qupath.lib.scripting.QP
def modelPath = 'F:/QuPath/Stardist/dsb2018_heavy_augment.pb'
selectAnnotations();
def stardist = StarDist2D
.builder(modelPath)
.channels('DAPI') // Extract channel called 'DAPI'
.normalizePercentiles(1, 98) // Percentile normalization
.threshold(0.4) // Probability (detection) threshold
.pixelSize(0.5) // Resolution for detection
.cellExpansion(5) // Expand nuclei to approximate cell boundaries
.measureShape() // Add shape measurements
.measureIntensity() // Add cell measurements (in all compartments)
.build()
def pathObjects = QP.getSelectedObjects()
def imageData = QP.getCurrentImageData()
if (pathObjects.isEmpty()) {
QP.getLogger().error("No parent objects are selected!")
return
}
stardist.detectObjects(imageData, pathObjects)
stardist.close() // This can help clean up & regain memory
println('Done!')