X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemiaCore%2FAnalysis.fs;h=1ba273c0c0bc278de9c0dcc393e14b81f51e373c;hp=19a92fef82e58ab72a1ad2449044c64986b3a861;hb=3c21c6ec590381439a615597342454b4298a8b5c;hpb=d3f9cd7b16d25f49bd8d06394b0f1d4040809fbd diff --git a/Parasitemia/ParasitemiaCore/Analysis.fs b/Parasitemia/ParasitemiaCore/Analysis.fs index 19a92fe..1ba273c 100644 --- a/Parasitemia/ParasitemiaCore/Analysis.fs +++ b/Parasitemia/ParasitemiaCore/Analysis.fs @@ -2,7 +2,6 @@ open System open System.Linq -open System.Drawing open FSharp.Collections.ParallelSeq @@ -17,6 +16,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 +105,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 +160,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 @@ -164,13 +171,13 @@ let doAnalysis (img : Image) (name : string) (config : Config) (repor } /// -/// Do multiple analyses on the same time. The number of concurrent process depends if the number of the core. +/// Do multiple analyses on the same time. The number of concurrent process depends on the number of the core. /// /// The images: (name * configuration * image) /// An optional function to report progress and/or cancel the process. /// The first call returning 'false' will cancel the analysis. /// The 'int' parameter correspond to the progression from 0 to 100 -/// 'None' if the process has been cancelled or the list of result as (name * cells), 'name' corresponds to the given name +/// 'None' if the process has been cancelled or the list of result as (name * cells), 'name' corresponds to the given name let doMultipleAnalysis (imgs : (string * Config * Image) list) (reportProgress : (int -> bool) option) : (string * AnalysisResult) list option = let report (percent : int) : bool = match reportProgress with