From: Greg Burri Date: Wed, 23 Dec 2015 11:29:51 +0000 (+0100) Subject: Change the way the parasites are detected. X-Git-Tag: 1.0.11~71 X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=commitdiff_plain;h=785a7ea4885e87d76f0b1fb1c715230a08389558 Change the way the parasites are detected. --- diff --git a/Parasitemia/Parasitemia/Config.fs b/Parasitemia/Parasitemia/Config.fs index 3e3a06c..5cf392c 100644 --- a/Parasitemia/Parasitemia/Config.fs +++ b/Parasitemia/Parasitemia/Config.fs @@ -23,11 +23,11 @@ type Parameters = { maxDarkStainRatio: float stainArea: float // Factor of a RBC area. 0.5 means the half of RBC area. - stainLevel: float // [0, 1] + stainLevel: float // [0, 2] maxStainRatio: float // [0, 1] infectionArea: float // Factor of a RBC area. 0.5 means the half of RBC area. - infectionLevel: float // [0, 1] + infectionLevel: float // [0, 2] parasitePixelsRequired: int standardDeviationMaxRatio: float // The standard deviation of the pixel values of a cell can't be greater than standardDeviationMaxRatio * global standard deviation diff --git a/Parasitemia/Parasitemia/ParasitesMarker2.fs b/Parasitemia/Parasitemia/ParasitesMarker2.fs index 6afef44..42645b4 100644 --- a/Parasitemia/Parasitemia/ParasitesMarker2.fs +++ b/Parasitemia/Parasitemia/ParasitesMarker2.fs @@ -1,6 +1,7 @@ module ParasitesMarker2 open System.Drawing +open System.Linq open Emgu.CV open Emgu.CV.Structure @@ -30,7 +31,7 @@ let find (filteredGreen: Image) (filteredGreenFloat: Image) (closed: Image) (threshold: float) : Image = + let marker (img: Image) (closed: Image) (level: float) : Image = let diff = closed - img let min = ref [| 0. |] @@ -40,8 +41,15 @@ let find (filteredGreen: Image) (filteredGreenFloat: Image float }) + threshold + + let valueThreshold = m * level diff._ThresholdBinary(Gray(valueThreshold), Gray(255.)) diff diff --git a/Parasitemia/Parasitemia/Program.fs b/Parasitemia/Parasitemia/Program.fs index 781d9ad..25c707d 100644 --- a/Parasitemia/Parasitemia/Program.fs +++ b/Parasitemia/Parasitemia/Program.fs @@ -73,11 +73,11 @@ let main args = maxDarkStainRatio = 0.1 infectionArea = 0.012 // 1.2 % - infectionLevel = 0.2 + infectionLevel = 0.85 parasitePixelsRequired = 1 stainArea = 0.08 - stainLevel = 0.1 + stainLevel = 0.85 maxStainRatio = 0.12 // 12 % standardDeviationMaxRatio = 0.55