Use float32 to reduce memory footprint.
[master-thesis.git] / Parasitemia / Parasitemia / Config.fs
index b22a4fd..aa8f0e5 100644 (file)
@@ -1,9 +1,54 @@
 module Config
 
-type Config = {
-    doGSigma1: float
-    doGSigma2: float
-    doGLowFreqPercentageReduction: float
+open System
 
+open Const
+
+type Debug =
+    | DebugOff
+    | DebugOn of string // Output directory.
+
+type Parameters = {
     scale: float
-}
\ No newline at end of file
+
+    initialAreaOpen: int
+
+    minRbcRadius: float32
+    maxRbcRadius: float32
+
+    preFilterSigma: float
+
+    // Ellipse.
+    factorNbPick: float
+
+    // Parasites detection.
+    darkStainLevel: float
+    maxDarkStainRatio: float
+
+    stainArea: float32 // Factor of a RBC area. 0.5 means the half of RBC area.
+    stainLevel: float // > 1
+    maxStainRatio: float // [0, 1]
+
+    infectionArea: float32 // Factor of a RBC area. 0.5 means the half of RBC area.
+    infectionLevel: float // > 1
+
+    standardDeviationMaxRatio: float // The standard deviation of the pixel values of a cell can't be greater than standardDeviationMaxRatio * global standard deviation
+    minimumCellArea: float32 // Factor of the nominal RBC area.
+}
+
+type Config (param: Parameters) =
+    member this.Parameters = param
+    member val Debug = DebugOff with get, set
+    member val RBCRadius = 30.f with get, set
+
+    member this.RBCMinRadius = this.RBCRadius + param.minRbcRadius * this.RBCRadius
+    member this.RBCMaxRadius = this.RBCRadius + param.maxRbcRadius * this.RBCRadius
+
+    member this.RBCArea = PI * this.RBCRadius ** 2.f
+    member this.RBCMinArea = param.minimumCellArea * this.RBCArea
+
+    member this.InfectionArea = param.infectionArea * this.RBCArea
+    member this.StainArea = param.stainArea * this.RBCArea
+
+    member this.Copy () =
+        this.MemberwiseClone() :?> Config