let _, mean_fg, mean_bg =
let hist = histogramImg imgWithoutNucleus 300
otsu hist
- imgWithoutNucleus.Cmp(-(float mean_bg) * config.Parameters.darkStainLevel + (float mean_fg), CvEnum.CmpType.LessThan)
+ imgWithoutNucleus.Cmp(float mean_fg - config.Parameters.darkStainLevel * float (mean_bg - mean_fg), CvEnum.CmpType.LessThan)
let marker (img: Image<Gray, float32>) (closed: Image<Gray, float32>) (level: float) : Image<Gray, byte> =
let diff = img.Copy()
diff._ThresholdBinary(Gray(0.0), Gray(255.))
diff.Convert<Gray, byte>()
+ // Nucleus.
let nucleusMarker = marker img imgWithoutNucleus (1. / config.Parameters.infectionSensitivity)
+ // Cytoplasm.
let imgWithoutParasite = img.CopyBlank()
let kernelSize =
- let size = roundInt (config.RBCRadius.Pixel / 5.f)
+ let size = roundInt config.RBCRadius.CytoplasmSize
if size % 2 = 0 then size + 1 else size
use kernel =
if kernelSize <= 3