- win.butClose.Click.AddHandler(fun obj args -> win.Close())
-
- win.butStart.Click.AddHandler(fun obj args ->
- match getInputImagesParameters () with
- | Some imagesParameters ->
- let imagesToProcess =
- [
- for srcImg, selected, parameters in imagesParameters do
- srcImg.config.Parameters <- parameters // Save parameters.
- if selected then
- yield srcImg.num.ToString(), srcImg.config, srcImg.img
- ]
-
- if imagesToProcess.IsEmpty then
- MessageBox.Show("No image selected", "Cannot start analysis", MessageBoxButton.OK, MessageBoxImage.Information) |> ignore
- else
- win.stackSourceImagesSelection.IsEnabled <- false
- analysisPerformed <- false
- win.butStart.IsEnabled <- false
- win.butClose.Content <- "Abort"
-
- async {
- let maybeResults =
- ParasitemiaCore.Analysis.doMultipleAnalysis
- imagesToProcess
- (Some (fun progress -> win.Dispatcher.Invoke(fun () -> win.progress.Value <- float progress); not analysisCancelled))
-
- lock monitor (
- fun() ->
- match maybeResults with
- | Some results ->
- for id, cells in results do
- state.SetResult (int id) cells
- Logger.Log.Info "All analyses terminated successfully"
- atLeastOneAnalysisPerformed <- true
- analysisPerformed <- true
- | None ->
- Logger.Log.Info "Analysis aborted"
-
- win.Dispatcher.Invoke(fun () ->
- win.progress.Value <- if maybeResults.IsSome then 100. else 0.
- win.stackSourceImagesSelection.IsEnabled <- true
- win.butStart.IsEnabled <- true
- win.butClose.Content <- "Close"
- updateSourceImages ()
- )
- )
- } |> Async.Start
- | _ -> ()
+ win.butClose.Click.AddHandler (fun obj args -> win.Close ())
+
+ win.butStart.Click.AddHandler (
+ fun obj args ->
+ match getInputImagesParameters () with
+ | Some imagesParameters ->
+ let imagesToProcess =
+ [
+ for srcImg, selected, parameters in imagesParameters do
+ srcImg.config.Parameters <- parameters // Save parameters.
+ if selected then
+ yield string srcImg.num, srcImg.config, srcImg.img
+ ]
+
+ if imagesToProcess.IsEmpty then
+ MessageBox.Show ("No image selected", "Cannot start analysis", MessageBoxButton.OK, MessageBoxImage.Information) |> ignore
+ else
+ win.stackSourceImagesSelection.IsEnabled <- false
+ analysisPerformed <- false
+ win.butStart.IsEnabled <- false
+ win.butClose.Content <- "Abort"
+
+ async {
+ let maybeResults =
+ ParasitemiaCore.Analysis.doMultipleAnalysis
+ imagesToProcess
+ (Some (fun progress -> win.Dispatcher.Invoke (fun () -> win.progress.Value <- float progress); not analysisCancelled))
+
+ lock monitor (
+ fun () ->
+ match maybeResults with
+ | Some results ->
+ for id, cells in results do
+ state.SetResult (int id) cells
+ Logger.Log.Info "All analyses terminated successfully"
+ atLeastOneAnalysisPerformed <- true
+ analysisPerformed <- true
+ | None ->
+ Logger.Log.Info "Analysis aborted"
+
+ win.Dispatcher.Invoke (
+ fun () ->
+ win.progress.Value <- if maybeResults.IsSome then 100. else 0.
+ win.stackSourceImagesSelection.IsEnabled <- true
+ win.butStart.IsEnabled <- true
+ win.butClose.Content <- "Close"
+ updateSourceImages ()
+ )
+ )
+ } |> Async.Start
+ | _ -> ()