LPFStandardDeviationRBC: float<μm>
// Ellipse.
- factorNbPick: float // The number of computed ellipse per edge pixel.
+ nbPickElementsMin: int
+ factorNbValidPick: float // The number of computed ellipse per edge pixel.
+ factorNbMaxPick: float
// Parasites detection.
darkStainLevel: float // Lower -> more sensitive. Careful about illumination on the borders.
LPFStandardDeviationParasite = 0.15<μm>
LPFStandardDeviationRBC = 0.22<μm>
- factorNbPick = 1.0
+ nbPickElementsMin = 10
+ factorNbValidPick = 0.05 //1.0
+ factorNbMaxPick = 2.
darkStainLevel = 0.25
maxDarkStainRatio = 0.1 // 10 %
// We choose a window size for which the biggest ellipse can always be fitted in.
let windowSize = roundInt (2.f * r2)
- let factorNbPick = config.Parameters.factorNbPick
+ let factorNbValidPick = config.Parameters.factorNbValidPick
+ let factorNbMaxPick = config.Parameters.factorNbMaxPick
+ let nbPickElementsMin = config.Parameters.nbPickElementsMin
let increment = windowSize / (int incrementWindowDivisor)
if currentElements.Count >= 10
then
- let mutable nbOfPicks = (float currentElements.Count) * factorNbPick |> int
- while nbOfPicks > 0 do
+ let mutable nbOfPicks = (float currentElements.Count) * factorNbMaxPick |> int
+ let mutable nbOfValidPicks = (float currentElements.Count) * factorNbValidPick |> int
+ while nbOfPicks > 0 && nbOfValidPicks > 0 do
let p1 = currentElements.[rng.Next(currentElements.Count)]
let p2 = currentElements.[rng.Next(currentElements.Count)]
let p3 = currentElements.[rng.Next(currentElements.Count)]
match ellipse p1xf p1yf (float m1) p2xf p2yf (float m2) p3xf p3yf with
| Some e when e.Cx > 0.f && e.Cx < w_f - 1.f && e.Cy > 0.f && e.Cy < h_f - 1.f &&
e.A >= r1 - radiusTolerance && e.A <= r2 + radiusTolerance && e.B >= r1 - radiusTolerance && e.B <= r2 + radiusTolerance ->
- ellipses.Add e
+ nbOfValidPicks <- nbOfValidPicks - 1
+ ellipses.Add e
| _ -> ()
| _ -> ()
buildTreeFromSortedArray xSorted ySorted 1
member this.Search (searchRegion: Region) : 'a list =
- let rec valuesFrom (tree: Tree<'a>) : 'a list =
+ let rec valuesFrom (tree: Tree<'a>) (acc: 'a list) : 'a list =
match tree with
- | Node (_, part1, part2) -> (valuesFrom part1) @ (valuesFrom part2)
- | Leaf v -> [v]
+ | Node (_, left, right) -> (valuesFrom right (valuesFrom left acc))
+ | Leaf v -> v :: acc
let rec searchWithRegion (tree: Tree<'a>) (currentRegion: Region) (depth: int) : 'a list =
match tree with
let valuesInRegion (region: Region) (treeRegion: Tree<'a>) =
if region.IsSub searchRegion
then
- valuesFrom treeRegion
+ valuesFrom treeRegion []
elif region.Intersects searchRegion
then
searchWithRegion treeRegion region (depth + 1)
[<Measure>] type inch
[<Measure>] type ppi = px / inch // Pixel per inch.
-let μmInchRatio = 25.4e3<μm/inch>
-let mmInchRatio = 25.4<mm/inch>
+let μmPerInch = 25.4e3<μm/inch>
+let mmPerInch = 25.4<mm/inch>
-let μmToInch(x: float<μm>) : float<inch> = x / μmInchRatio
-let inchToμm(x: float<inch>) : float<μm> = x * μmInchRatio
+let μmToInch(x: float<μm>) : float<inch> = x / μmPerInch
+let inchToμm(x: float<inch>) : float<μm> = x * μmPerInch
-let mmToInch(x: float<mm>) : float<inch> = x / mmInchRatio
-let inchTomm(x: float<inch>) : float<mm> = x * mmInchRatio
+let mmToInch(x: float<mm>) : float<inch> = x / mmPerInch
+let inchTomm(x: float<inch>) : float<mm> = x * mmPerInch