FIX #279
authorGreg Burri <greg.burri@gmail.com>
Fri, 20 Oct 2017 11:58:12 +0000 (13:58 +0200)
committerGreg Burri <greg.burri@gmail.com>
Fri, 20 Oct 2017 11:58:12 +0000 (13:58 +0200)
A warning is displayed when the RBC diameter found do not match the image resolution.

Parasitemia/ParasitemiaCore/Analysis.fs
Parasitemia/ParasitemiaUI/Analysis.fs

index 19a92fe..ed908e2 100644 (file)
@@ -17,6 +17,8 @@ open ImgTools
 open Config
 open Types
 
 open Config
 open Types
 
+let warningRatioDifferenceRBCDiameter = 1.2
+
 /// <summary>
 /// Analyze the given image and detect reb blood cell (RBC) in it.
 /// </summary>
 /// <summary>
 /// Analyze the given image and detect reb blood cell (RBC) in it.
 /// </summary>
@@ -104,6 +106,12 @@ let doAnalysis (img : Image<Bgr, byte>) (name : string) (config : Config) (repor
 
         let! cells = logTimeWithName "Classifier" (fun () -> reportWithVal 100 (Classifier.findCells prunedEllipses parasites img.Width img.Height config))
 
 
         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
         logWithName "Analysis finished"
 
         do
@@ -153,7 +161,7 @@ let doAnalysis (img : Image<Bgr, byte>) (name : string) (config : Config) (repor
                 IO.saveImg img_float.[0] (buildFileName " - source - blue.png")
             | _ -> ()
 
                 IO.saveImg img_float.[0] (buildFileName " - source - blue.png")
             | _ -> ()
 
-        return 
+        return
             {
                 Cells = cells
                 RBCSize_μm = config.RBCRadius.μm
             {
                 Cells = cells
                 RBCSize_μm = config.RBCRadius.μm
index 4fa5290..13ce48b 100644 (file)
@@ -134,6 +134,7 @@ let showWindow (parent : Window) (state : State.State) : bool =
                     win.stackSourceImagesSelection.IsEnabled <- false
                     analysisPerformed <- false
                     win.butStart.IsEnabled <- false
                     win.stackSourceImagesSelection.IsEnabled <- false
                     analysisPerformed <- false
                     win.butStart.IsEnabled <- false
+                    win.textLog.Text <- ""
                     win.butClose.Content <- "Abort"
 
                     async {
                     win.butClose.Content <- "Abort"
 
                     async {