/// The first call returning 'false' will cancel the analysis.
/// The 'int' parameter correspond to the progression from 0 to 100</param>
/// <returns>A list of detected cells or nothing if the process has been cancelled</returns>
/// The first call returning 'false' will cancel the analysis.
/// The 'int' parameter correspond to the progression from 0 to 100</param>
/// <returns>A list of detected cells or nothing if the process has been cancelled</returns>
// To report the progress of this function from 0 to 100.
// Return 'None' if the process must be aborted.
// To report the progress of this function from 0 to 100.
// Return 'None' if the process must be aborted.
- let inline logTimeWithName (text: string) (f: unit -> 'a option) : 'a option = Log.LogWithTime((buildLogWithName text), Severity.USER, f)
+ let inline logTimeWithName (text : string) (f : unit -> 'a option) : 'a option = Log.LogWithTime((buildLogWithName text), Severity.USER, f)
use img_parasites = img_float.[2] // Red.
use img_parasites_filtered = gaussianFilter img_parasites config.LPFStandardDeviationParasite
use img_parasites = img_float.[2] // Red.
use img_parasites_filtered = gaussianFilter img_parasites config.LPFStandardDeviationParasite
let initialAreaOpening = int <| config.RBCRadiusByResolution.Area * config.Parameters.ratioAreaPaleCenter * 1.1f // We do an area opening a little larger to avoid to do a second one in the case the radius found is near the initial one.
do! logTimeWithName "First area opening" (fun () -> areaOpenF img_RBC_filtered initialAreaOpening; report 10)
let initialAreaOpening = int <| config.RBCRadiusByResolution.Area * config.Parameters.ratioAreaPaleCenter * 1.1f // We do an area opening a little larger to avoid to do a second one in the case the radius found is near the initial one.
do! logTimeWithName "First area opening" (fun () -> areaOpenF img_RBC_filtered initialAreaOpening; report 10)
//let! radius = logTimeWithName "Granulometry (morpho)" (fun() -> reportWithVal 10 (Granulometry.findRadiusByClosing img_RBC_filtered range 1. true |> float32))
config.SetRBCRadius <| radius
//let! radius = logTimeWithName "Granulometry (morpho)" (fun() -> reportWithVal 10 (Granulometry.findRadiusByClosing img_RBC_filtered range 1. true |> float32))
config.SetRBCRadius <| radius
/// The first call returning 'false' will cancel the analysis.
/// The 'int' parameter correspond to the progression from 0 to 100</param>
/// <returns>'None' if the process has been cancelled or the list of result as (name * cells), 'name' corresponds to the given name<returns>
/// The first call returning 'false' will cancel the analysis.
/// The 'int' parameter correspond to the progression from 0 to 100</param>
/// <returns>'None' if the process has been cancelled or the list of result as (name * cells), 'name' corresponds to the given name<returns>
-let doMultipleAnalysis (imgs: (string * Config * Image<Bgr, byte>) list) (reportProgress: (int -> bool) option) : (string * Cell list) list option =
- let report (percent: int) : bool =
+let doMultipleAnalysis (imgs : (string * Config * Image<Bgr, byte>) list) (reportProgress : (int -> bool) option) : (string * Cell list) list option =
+ let report (percent : int) : bool =
let progressPerAnalysis = System.Collections.Concurrent.ConcurrentDictionary<string, int>()
let nbImgs = List.length imgs
let progressPerAnalysis = System.Collections.Concurrent.ConcurrentDictionary<string, int>()
let nbImgs = List.length imgs
progressPerAnalysis.AddOrUpdate(id, progress, (fun _ _ -> progress)) |> ignore
report (progressPerAnalysis.Values.Sum() / nbImgs)
progressPerAnalysis.AddOrUpdate(id, progress, (fun _ _ -> progress)) |> ignore
report (progressPerAnalysis.Values.Sum() / nbImgs)