- let imagesToProcess = [
- for imageSelection in stackImagesSourceSelection.Children |> Seq.cast<Views.ImageSourceSelection> do
- let chk = imageSelection.chkSelection.IsChecked
- if chk.HasValue && chk.Value
- then
- let srcImg = imageSelection.Tag :?> SourceImage
- 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
- analysisPerformed <- false
- butStart.IsEnabled <- false
- butClose.Content <- "Abort"
- async {
- let results =
- ParasitemiaCore.Analysis.doMultipleAnalysis
- imagesToProcess
- (Some (fun progress -> window.Root.Dispatcher.Invoke(fun () -> progressBar.Value <- float progress)))
-
- lock monitor (
- fun() ->
- if not analysisCancelled
- then
- for id, cells in results do
- state.SetResult (int id) cells
-
- window.Root.Dispatcher.Invoke(fun () ->
- butStart.IsEnabled <- true
- butClose.Content <- "Close"
- updateSourceImages ())
-
- Logger.Log.User("All analyses terminated successfully")
- atLeastOneAnalysisPerformed <- true
- analysisPerformed <- true)
- } |> Async.Start)
+ 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
+ analysisPerformed <- false
+ butStart.IsEnabled <- false
+ butClose.Content <- "Abort"
+ async {
+ let results =
+ ParasitemiaCore.Analysis.doMultipleAnalysis
+ imagesToProcess
+ (Some (fun progress -> window.Root.Dispatcher.Invoke(fun () -> progressBar.Value <- float progress)))
+
+ lock monitor (
+ fun() ->
+ if not analysisCancelled
+ then
+ for id, cells in results do
+ state.SetResult (int id) cells
+
+ window.Root.Dispatcher.Invoke(fun () ->
+ butStart.IsEnabled <- true
+ butClose.Content <- "Close"
+ updateSourceImages ())
+
+ Logger.Log.User("All analyses terminated successfully")
+ atLeastOneAnalysisPerformed <- true
+ analysisPerformed <- true)
+ } |> Async.Start
+ | _ -> ())