From d247f3a07ca3c7b192d8c2381ea85ba731fcc359 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Mon, 21 Dec 2020 08:33:10 +0100 Subject: [PATCH] Remove useless 'yield' --- Parasitemia/ParasitemiaCore/Classifier.fs | 16 ++++++++-------- Parasitemia/ParasitemiaUI/Analysis.fs | 6 +++--- Parasitemia/ParasitemiaUI/PiaZ.fs | 2 +- .../Tests/ParasitemiaCore.Tests/KdTreeTests.fs | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Parasitemia/ParasitemiaCore/Classifier.fs b/Parasitemia/ParasitemiaCore/Classifier.fs index 9b247f4..a2d9e4f 100644 --- a/Parasitemia/ParasitemiaCore/Classifier.fs +++ b/Parasitemia/ParasitemiaCore/Classifier.fs @@ -70,16 +70,16 @@ let findCells (ellipses : Ellipse list) (parasites : ParasitesMarker.Result) (wi // Yield 'false' when the point is owned by another ellipse. if case1 then - yield sign delta <> sign delta' || Utils.squaredDistanceTwoPoints c p' > Utils.squaredDistanceTwoPoints c p + sign delta <> sign delta' || Utils.squaredDistanceTwoPoints c p' > Utils.squaredDistanceTwoPoints c p else - yield sign delta = sign delta' && Utils.squaredDistanceTwoPoints c p' < Utils.squaredDistanceTwoPoints c p + sign delta = sign delta' && Utils.squaredDistanceTwoPoints c p' < Utils.squaredDistanceTwoPoints c p else - yield case1 + case1 elif e.State = CellState.Peculiar then // A peculiar always win against a RBC. - yield true + true else - yield not <| e'.Contains p.X p.Y + not <| e'.Contains p.X p.Y } |> Seq.forall id @@ -121,7 +121,7 @@ let findCells (ellipses : Ellipse list) (parasites : ParasitesMarker.Result) (wi let globalStdDeviation = MathNet.Numerics.Statistics.Statistics.PopulationStandardDeviation (seq { for y in 0 .. h - 1 do for x in 0 .. w - 1 do - yield float imgData.[y, x, 0] }) + float imgData.[y, x, 0] }) for e in ellipses do if not e.Removed then @@ -132,7 +132,7 @@ let findCells (ellipses : Ellipse list) (parasites : ParasitesMarker.Result) (wi for y in (if minY < 0 then 0 else minY) .. (if maxY >= h then h - 1 else maxY) do for x in (if minX < 0 then 0 else minX) .. (if maxX >= w then w - 1 else maxX) do if shrinkedE.Contains (float32 x) (float32 y) then - yield float imgData.[y, x, 0] }) + float imgData.[y, x, 0] }) if stdDeviation > globalStdDeviation * config.Parameters.standardDeviationMaxRatio then e.Removed <- true *) @@ -218,7 +218,7 @@ let findCells (ellipses : Ellipse list) (parasites : ParasitesMarker.Result) (wi seq { for parasitePixel in parasitePixels do if nucleusPixels.Exists (fun p -> pown (p.X - parasitePixel.X) 2 + pown (p.Y - parasitePixel.Y) 2 <= diameterParasiteSquared) then - yield 1 + 1 } |> Seq.sum else 0 diff --git a/Parasitemia/ParasitemiaUI/Analysis.fs b/Parasitemia/ParasitemiaUI/Analysis.fs index 485ddfd..9a6047e 100644 --- a/Parasitemia/ParasitemiaUI/Analysis.fs +++ b/Parasitemia/ParasitemiaUI/Analysis.fs @@ -103,10 +103,10 @@ let showWindow (parent : Window) (state : State.State) : bool = let isChecked = srcImgCtrl.chkSelection.IsChecked match parseAndValidatePPI srcImgCtrl.txtResolution.Text with | Some resolution -> - yield Some (srcImg, isChecked.HasValue && isChecked.Value, { srcImg.Config.Parameters with resolution = resolution * 1. }) + Some (srcImg, isChecked.HasValue && isChecked.Value, { srcImg.Config.Parameters with resolution = resolution * 1. }) | None -> MessageBox.Show (sprintf "No resolution defined for the image number %d" srcImg.Num, "No resolution defined", MessageBoxButton.OK, MessageBoxImage.Information) |> ignore - yield None + None } |> Seq.takeWhile (fun e -> e.IsSome) |> Seq.map (fun e -> e.Value) |> List.ofSeq if parameters.Count () <> sourceImagesControls.Count () then @@ -125,7 +125,7 @@ let showWindow (parent : Window) (state : State.State) : bool = for srcImg, selected, parameters in imagesParameters do srcImg.Config.Parameters <- parameters // Save parameters. if selected then - yield string srcImg.RomanNum, srcImg.Config, srcImg.Img + string srcImg.RomanNum, srcImg.Config, srcImg.Img ] if imagesToProcess.IsEmpty then diff --git a/Parasitemia/ParasitemiaUI/PiaZ.fs b/Parasitemia/ParasitemiaUI/PiaZ.fs index df72212..2220953 100644 --- a/Parasitemia/ParasitemiaUI/PiaZ.fs +++ b/Parasitemia/ParasitemiaUI/PiaZ.fs @@ -133,6 +133,6 @@ let load (filePath : string) (defaultConfig : ParasitemiaCore.Config.Config) : D config.SetRBCRadius imgInfo.RBCRadius - yield SourceImage (imgNum, imgInfo.name, config, imgInfo.dateLastAnalysis, img, imgInfo.rbcs, HealthyRBCBrightness = imgInfo.healthyRBCBrightness, InfectedRBCBrightness = imgInfo.infectedRBCBrightness) + SourceImage (imgNum, imgInfo.name, config, imgInfo.dateLastAnalysis, img, imgInfo.rbcs, HealthyRBCBrightness = imgInfo.healthyRBCBrightness, InfectedRBCBrightness = imgInfo.infectedRBCBrightness) ] } \ No newline at end of file diff --git a/Parasitemia/Tests/ParasitemiaCore.Tests/KdTreeTests.fs b/Parasitemia/Tests/ParasitemiaCore.Tests/KdTreeTests.fs index 614640d..ec66fa0 100644 --- a/Parasitemia/Tests/ParasitemiaCore.Tests/KdTreeTests.fs +++ b/Parasitemia/Tests/ParasitemiaCore.Tests/KdTreeTests.fs @@ -83,7 +83,7 @@ type KdTreeTests (output : ITestOutputHelper) = for i = 1 to nbPoints do let x = nextNumber min max let y = nextNumber min max - yield Point (x, y) + Point (x, y) ] let sw = System.Diagnostics.Stopwatch () -- 2.45.2