Change the parasite detection method.
[master-thesis.git] / Parasitemia / Parasitemia / Config.fs
index 75aa95f..55e142c 100644 (file)
@@ -1,20 +1,47 @@
 module Config
 
-type Config = {
+open System
+
+type Debug =
+    | DebugOff
+    | DebugOn of string // Output directory.
+
+type Parameters = {
     scale: float
 
-    doGSigma1: float
-    doGSigma2: float
-    doGLowFreqPercentageReduction: float
+    minRbcRadius: float
+    maxRbcRadius: float
+
+    preFilterSigma: float
+
+    // Ellipse.
+    factorNbPick: float
+    factorWindowSize: float // factor of 'maxRBCSize'.
 
     // Parasites detection.
     darkStainLevel: float
 
-    stainSigma: float
-    stainLevel: float
-    stainSpreadRequired: float
-    
-    infectionSigma: float
-    infectionLevel: float
+    stainArea: float // Factor of a RBC area. 0.5 means the half of RBC area.
+    stainLevel: float // [0, 1]
+
+    infectionArea: float // Factor of a RBC area. 0.5 means the half of RBC area.
+    infectionLevel: float // [0, 1]
     infectionPixelsRequired: int
-}
\ No newline at end of file
+
+    maxDarkStainRatio: float
+
+    minimumCellArea: float // Factor of RBC area.
+}
+
+type Config (param: Parameters) =
+    member this.Parameters = param
+    member val Debug = DebugOff with get, set
+    member val RBCSize = 30. with get, set
+
+    member this.RBCMin = this.RBCSize + param.minRbcRadius * this.RBCSize
+    member this.RBCMax = this.RBCSize + param.maxRbcRadius * this.RBCSize
+
+    member this.RBCMinArea = param.minimumCellArea * Math.PI * this.RBCSize ** 2.0
+
+    member this.ParasiteArea = param.infectionArea * Math.PI * this.RBCSize ** 2.0
+    member this.StainArea = param.stainArea * Math.PI * this.RBCSize ** 2.0