X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=Parasitemia%2FParasitemiaCore%2FMatchingEllipses.fs;h=67c2fb1634785b2e8da8d30af383c9a9fe412618;hb=ef07574f9326af515348bfbd8a0cf606ec337c3a;hp=13fd556b0f44f3e8af250fafc4f1c441c6f36cd2;hpb=b87b35b922551f122228df1fd9c530bbb807935a;p=master-thesis.git diff --git a/Parasitemia/ParasitemiaCore/MatchingEllipses.fs b/Parasitemia/ParasitemiaCore/MatchingEllipses.fs index 13fd556..67c2fb1 100644 --- a/Parasitemia/ParasitemiaCore/MatchingEllipses.fs +++ b/Parasitemia/ParasitemiaCore/MatchingEllipses.fs @@ -1,9 +1,6 @@ module ParasitemiaCore.MatchingEllipses -open System open System.Drawing -open System.Linq -open System.Collections open System.Collections.Generic open Types @@ -34,10 +31,10 @@ type private EllipseScoreFlaggedKd (matchingScore : float32, e : Ellipse) = member this.Y = this.Ellipse.Cy type MatchingEllipses (radius : float32) = - let ellipses = List() + let ellipses = List () member this.Add (e : Ellipse) = - ellipses.Add(EllipseScoreFlaggedKd(0.f, e)) + ellipses.Add (EllipseScoreFlaggedKd (0.f, e)) member this.Ellipses : Ellipse list = List.ofSeq ellipses |> List.map (fun e -> e.Ellipse) @@ -69,8 +66,8 @@ type MatchingEllipses (radius : float32) = // Because of approximation error, see https://github.com/chraibi/EEOver/issues/4 when overlapArea - areaE < 1.f && overlapArea - areaOther < 1.f -> let matchingScore = (2.f * overlapArea / (areaE + areaOther)) ** matchingScorePower - other.AddMatchingScore(matchingScore) - e.AddMatchingScore(matchingScore) + other.AddMatchingScore matchingScore + e.AddMatchingScore matchingScore | _ -> () // 3) Remove ellipses whose center is near the center of another ellipse with a better score. @@ -89,7 +86,7 @@ type MatchingEllipses (radius : float32) = for other in tree.Search window do if not other.Removed && e.MatchingScore > other.MatchingScore then // Case where ellipses are too close. - if distanceTwoPoints (PointF(e.Ellipse.Cx, e.Ellipse.Cy)) (PointF(other.Ellipse.Cx, other.Ellipse.Cy)) < minimumDistanceFromCenterRadiusFactor * e.Ellipse.B then + if distanceTwoPoints (PointF (e.Ellipse.Cx, e.Ellipse.Cy)) (PointF (other.Ellipse.Cx, other.Ellipse.Cy)) < minimumDistanceFromCenterRadiusFactor * e.Ellipse.B then other.Removed <- true else // Case where ellipses are overlapped. @@ -101,6 +98,6 @@ type MatchingEllipses (radius : float32) = ellipses |> List.ofSeq |> List.filter (fun e -> not e.Removed) - |> List.sortWith (fun e1 e2 -> e2.MatchingScore.CompareTo(e1.MatchingScore)) + |> List.sortWith (fun e1 e2 -> e2.MatchingScore.CompareTo e1.MatchingScore) |> List.map (fun e -> e.Ellipse)