-
Notifications
You must be signed in to change notification settings - Fork 3
/
binarize.ijm
16 lines (14 loc) · 716 Bytes
/
binarize.ijm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// ----------------------------------------------------------------------------------------------
// This macro calculates a binary mask given a certain threshold.
// Credits:
// - DeepImageJ team:
// - Reference: "DeepImageJ: A user-friendly plugin to run deep learning models in ImageJ,
// E. Gomez-de-Mariscal, C. Garcia-Lopez-de-Haro, et al., bioRxiv 2019.
// ----------------------------------------------------------------------------------------------
getStatistics(_, _, min, max, _, _);
// Threshold the output.
optimalThreshold = 0.5;
setThreshold(optimalThreshold, max);
setOption("BlackBackground", true);
run("Convert to Mask", "method=Default background=Dark black");
run("Divide...", "value=255");