From f4e3404aaa28beedc9040c0b924c3a8162472b43 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Fri, 20 Oct 2017 13:58:12 +0200 Subject: [PATCH] FIX #279 A warning is displayed when the RBC diameter found do not match the image resolution. --- Parasitemia/ParasitemiaCore/Analysis.fs | 10 +++++++++- Parasitemia/ParasitemiaUI/Analysis.fs | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Parasitemia/ParasitemiaCore/Analysis.fs b/Parasitemia/ParasitemiaCore/Analysis.fs index 19a92fe..ed908e2 100644 --- a/Parasitemia/ParasitemiaCore/Analysis.fs +++ b/Parasitemia/ParasitemiaCore/Analysis.fs @@ -17,6 +17,8 @@ open ImgTools open Config open Types +let warningRatioDifferenceRBCDiameter = 1.2 + /// /// Analyze the given image and detect reb blood cell (RBC) in it. /// @@ -104,6 +106,12 @@ let doAnalysis (img : Image) (name : string) (config : Config) (repor let! cells = logTimeWithName "Classifier" (fun () -> reportWithVal 100 (Classifier.findCells prunedEllipses parasites img.Width img.Height config)) + do + if config.RBCRadiusByResolution.μm / config.RBCRadius.μm > warningRatioDifferenceRBCDiameter then + logWithName (sprintf "Warning: erythrocyte diameter found is too low compared to the nominal erythrocyte diameter, maybe the PPI image resolution is lesser than %.0f ppi" config.Parameters.resolution) + elif config.RBCRadius.μm / config.RBCRadiusByResolution.μm > warningRatioDifferenceRBCDiameter then + logWithName (sprintf "Warning: erythrocyte diameter found is too high compared to the nominal erythrocyte diameter, maybe the PPI image resolution is higher than %.0f" config.Parameters.resolution) + logWithName "Analysis finished" do @@ -153,7 +161,7 @@ let doAnalysis (img : Image) (name : string) (config : Config) (repor IO.saveImg img_float.[0] (buildFileName " - source - blue.png") | _ -> () - return + return { Cells = cells RBCSize_μm = config.RBCRadius.μm diff --git a/Parasitemia/ParasitemiaUI/Analysis.fs b/Parasitemia/ParasitemiaUI/Analysis.fs index 4fa5290..13ce48b 100644 --- a/Parasitemia/ParasitemiaUI/Analysis.fs +++ b/Parasitemia/ParasitemiaUI/Analysis.fs @@ -134,6 +134,7 @@ let showWindow (parent : Window) (state : State.State) : bool = win.stackSourceImagesSelection.IsEnabled <- false analysisPerformed <- false win.butStart.IsEnabled <- false + win.textLog.Text <- "" win.butClose.Content <- "Abort" async { -- 2.43.0