open System
+open Const
+
type Debug =
| DebugOff
| DebugOn of string // Output directory.
type Parameters = {
- scale: float
+ initialAreaOpen: int // Area of the first initial opening to remove the central illumination of RBC.
+ ratioSecondAreaOpen: float32 // The area of the second opening is 'ratioSecondAreaOpen' * mean RBC area. It's applied only if greater than 'initialAreaOpen'.
- minRbcRadius: float
- maxRbcRadius: float
+ minRbcRadius: float32 // Factor of the mean RBC radius.
+ maxRbcRadius: float32 // Factor of the mean RBC radius.
- preFilterSigma: float
+ preFilterSigma: float // To remove the high frequency noise.
// Ellipse.
- factorNbPick: float
- factorWindowSize: float // factor of 'maxRBCSize'.
+ factorNbPick: float // The number of computed ellipse per edge pixel.
// Parasites detection.
- darkStainLevel: float
-
- stainArea: float // Factor of a RBC area. 0.5 means the half of RBC area.
- stainLevel: float // [0, 1]
+ darkStainLevel: float // Lower -> more sensitive. Careful about illumination on the borders.
+ maxDarkStainRatio: float // When a cell must own less than this ratio to be a RBC.
- infectionArea: float // Factor of a RBC area. 0.5 means the half of RBC area.
- infectionLevel: float // [0, 1]
- parasitePixelsRequired: int
+ stainArea: float32 // Factor of a RBC area. 0.5 means the half of RBC area.
+ stainLevel: float // > 1
+ maxStainRatio: float // When a cell must own less than this ratio to be a RBC.
- maxDarkStainRatio: float
+ 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: float // Factor of RBC area.
+ minimumCellAreaFactor: float32 // Factor of the mean RBC area.
}
type Config (param: Parameters) =
member this.Parameters = param
member val Debug = DebugOff with get, set
- member val RBCRadius = 30. with get, set
+
+ // Mean RBC radius.
+ 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.RBCMinArea = param.minimumCellArea * Math.PI * this.RBCRadius ** 2.0
+ member this.RBCArea = PI * this.RBCRadius ** 2.f
+ member this.RBCMinArea = param.minimumCellAreaFactor * this.RBCArea
+
+ member this.InfectionArea = param.infectionArea * this.RBCArea
+ member this.StainArea = param.stainArea * this.RBCArea
- member this.InfectionArea = param.infectionArea * Math.PI * this.RBCRadius ** 2.0
- member this.StainArea = param.stainArea * Math.PI * this.RBCRadius ** 2.0
+ member this.Copy () =
+ this.MemberwiseClone() :?> Config