From 94fbffc758bf0299b077e344ebcbecca408ae564 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Thu, 21 Jan 2016 17:34:55 +0100 Subject: [PATCH] Cleaning. --- Parasitemia/ParasitemiaCore/EEOver.fs | 2 -- Parasitemia/ParasitemiaCore/ImgTools.fs | 7 +++---- Parasitemia/ParasitemiaCore/KdTree.fs | 2 +- Parasitemia/ParasitemiaCore/MatchingEllipses.fs | 2 +- Parasitemia/ParasitemiaCore/Types.fs | 2 +- Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj | 1 - 6 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Parasitemia/ParasitemiaCore/EEOver.fs b/Parasitemia/ParasitemiaCore/EEOver.fs index 7db9687..eb8ac0b 100644 --- a/Parasitemia/ParasitemiaCore/EEOver.fs +++ b/Parasitemia/ParasitemiaCore/EEOver.fs @@ -207,7 +207,6 @@ let private threeintpts (xint: float[]) (yint: float[]) (a1: float) (b1: float) () twointpts xint yint a1 b1 phi_1 a2 b2 h2_tr k2_tr phi_2 aa bb cc dd ee ff - let private fourintpts (xint: float[]) (yint: float[]) (a1: float) (b1: float) (phi_1: float) (a2: float) (b2: float) (h2_tr: float) (k2_tr: float) (phi_2: float) (aa: float) (bb: float) (cc: float) (dd: float) (ee: float) (ff: float) : float = let a1b1 = a1 * b1 let a2b2 = a2 * b2 @@ -690,7 +689,6 @@ let EEOverlapArea (e1: Types.Ellipse) (e2: Types.Ellipse) : (float32 * float32[] #endif i <- i + 1 - if returnValue = -1.0 then None diff --git a/Parasitemia/ParasitemiaCore/ImgTools.fs b/Parasitemia/ParasitemiaCore/ImgTools.fs index cc15af7..44a6c86 100644 --- a/Parasitemia/ParasitemiaCore/ImgTools.fs +++ b/Parasitemia/ParasitemiaCore/ImgTools.fs @@ -43,7 +43,7 @@ let histogramImg (img: Image) (nbSamples: int) : Histogram = img.MinMax(min, max, minLocation, maxLocation) float32 (!min).[0], float32 (!max).[0] - let bin (x: float32) : int = + let inline bin (x: float32) : int = let p = int ((x - min) / (max - min) * float32 nbSamples) if p >= nbSamples then nbSamples - 1 else p @@ -67,7 +67,7 @@ let histogramMat (mat: Matrix) (nbSamples: int) : Histogram = mat.MinMax(min, max, minLocation, maxLocation) float32 !min, float32 !max - let bin (x: float32) : int = + let inline bin (x: float32) : int = let p = int ((x - min) / (max - min) * float32 nbSamples) if p >= nbSamples then nbSamples - 1 else p @@ -90,7 +90,7 @@ let histogram (values: float32 seq) (nbSamples: int) : Histogram = if v < min then min <- v if v > max then max <- v - let bin (x: float32) : int = + let inline bin (x: float32) : int = let p = int ((x - min) / (max - min) * float32 nbSamples) if p >= nbSamples then nbSamples - 1 else p @@ -201,7 +201,6 @@ let findEdges (img: Image) : Matrix * Image let thresholdHigh, thresholdLow = let sensibilityHigh = 0.1f let sensibilityLow = 0.0f - use magnitudesByte = magnitudes.Convert() let threshold, _, _ = otsu (histogramMat magnitudes 300) threshold + (sensibilityHigh * threshold), threshold - (sensibilityLow * threshold) diff --git a/Parasitemia/ParasitemiaCore/KdTree.fs b/Parasitemia/ParasitemiaCore/KdTree.fs index 94a3921..4513208 100644 --- a/Parasitemia/ParasitemiaCore/KdTree.fs +++ b/Parasitemia/ParasitemiaCore/KdTree.fs @@ -67,8 +67,8 @@ type Tree<'a when 'a :> I2DCoords> = member this.Search (searchRegion: Region) : 'a list = let rec valuesFrom (tree: Tree<'a>) : 'a list = match tree with - | Leaf v -> [v] | Node (_, part1, part2) -> (valuesFrom part1) @ (valuesFrom part2) + | Leaf v -> [v] let rec searchWithRegion (tree: Tree<'a>) (currentRegion: Region) (depth: int) : 'a list = match tree with diff --git a/Parasitemia/ParasitemiaCore/MatchingEllipses.fs b/Parasitemia/ParasitemiaCore/MatchingEllipses.fs index 4cc3d2b..c7a0627 100644 --- a/Parasitemia/ParasitemiaCore/MatchingEllipses.fs +++ b/Parasitemia/ParasitemiaCore/MatchingEllipses.fs @@ -47,7 +47,7 @@ type MatchingEllipses (radius: float32) = let tree = KdTree.Tree.BuildTree (List.ofSeq ellipses) // 2) Compute the matching score of each ellipses. - let windowSize = radius / 2.f + let windowSize = radius / 3.f for e in ellipses do e.Processed <- true let areaE = e.Ellipse.Area diff --git a/Parasitemia/ParasitemiaCore/Types.fs b/Parasitemia/ParasitemiaCore/Types.fs index 7bfbd7f..946c2c7 100644 --- a/Parasitemia/ParasitemiaCore/Types.fs +++ b/Parasitemia/ParasitemiaCore/Types.fs @@ -86,4 +86,4 @@ type MaybeBuilder () = member this.Return (x) = Some x -let maybe = new MaybeBuilder() \ No newline at end of file +let maybe = MaybeBuilder() \ No newline at end of file diff --git a/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj b/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj index 0859274..483888f 100644 --- a/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj +++ b/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj @@ -68,7 +68,6 @@ - -- 2.43.0