Use float32 to reduce memory footprint.
[master-thesis.git] / Parasitemia / Parasitemia / Config.fs
1 module Config
2
3 open System
4
5 open Const
6
7 type Debug =
8 | DebugOff
9 | DebugOn of string // Output directory.
10
11 type Parameters = {
12 scale: float
13
14 initialAreaOpen: int
15
16 minRbcRadius: float32
17 maxRbcRadius: float32
18
19 preFilterSigma: float
20
21 // Ellipse.
22 factorNbPick: float
23
24 // Parasites detection.
25 darkStainLevel: float
26 maxDarkStainRatio: float
27
28 stainArea: float32 // Factor of a RBC area. 0.5 means the half of RBC area.
29 stainLevel: float // > 1
30 maxStainRatio: float // [0, 1]
31
32 infectionArea: float32 // Factor of a RBC area. 0.5 means the half of RBC area.
33 infectionLevel: float // > 1
34
35 standardDeviationMaxRatio: float // The standard deviation of the pixel values of a cell can't be greater than standardDeviationMaxRatio * global standard deviation
36 minimumCellArea: float32 // Factor of the nominal RBC area.
37 }
38
39 type Config (param: Parameters) =
40 member this.Parameters = param
41 member val Debug = DebugOff with get, set
42 member val RBCRadius = 30.f with get, set
43
44 member this.RBCMinRadius = this.RBCRadius + param.minRbcRadius * this.RBCRadius
45 member this.RBCMaxRadius = this.RBCRadius + param.maxRbcRadius * this.RBCRadius
46
47 member this.RBCArea = PI * this.RBCRadius ** 2.f
48 member this.RBCMinArea = param.minimumCellArea * this.RBCArea
49
50 member this.InfectionArea = param.infectionArea * this.RBCArea
51 member this.StainArea = param.stainArea * this.RBCArea
52
53 member this.Copy () =
54 this.MemberwiseClone() :?> Config