From: Greg Burri Date: Mon, 22 Mar 2021 22:33:13 +0000 (+0100) Subject: Add two buttons to select or unselect all image to analyse X-Git-Tag: 1.0.14 X-Git-Url: http://git.euphorik.ch/?a=commitdiff_plain;h=ef07574f9326af515348bfbd8a0cf606ec337c3a;p=master-thesis.git Add two buttons to select or unselect all image to analyse --- diff --git a/Parasitemia/ParasitemiaCore/ParasitemiaCore.fsproj b/Parasitemia/ParasitemiaCore/ParasitemiaCore.fsproj index 700dcbf..2825174 100644 --- a/Parasitemia/ParasitemiaCore/ParasitemiaCore.fsproj +++ b/Parasitemia/ParasitemiaCore/ParasitemiaCore.fsproj @@ -3,9 +3,9 @@ Library net5.0 - 1.0.13 - 1.0.0.13 - 1.0.0.13 + 1.0.14 + 1.0.0.14 + 1.0.0.14 Greg Burri CHUV & HES-SO diff --git a/Parasitemia/ParasitemiaUI/Analysis.fs b/Parasitemia/ParasitemiaUI/Analysis.fs index 43987d1..928c15f 100644 --- a/Parasitemia/ParasitemiaUI/Analysis.fs +++ b/Parasitemia/ParasitemiaUI/Analysis.fs @@ -107,6 +107,18 @@ let showWindow (parent : Window) (state : State.State) : bool = else Some parameters + win.butSelectAll.Click.AddHandler ( + fun obj args -> + for srcImgCtrl in win.stackSourceImagesSelection.Children |> Seq.cast do + srcImgCtrl.chkSelection.IsChecked <- true + ) + + win.butUnselectAll.Click.AddHandler ( + fun obj args -> + for srcImgCtrl in win.stackSourceImagesSelection.Children |> Seq.cast do + srcImgCtrl.chkSelection.IsChecked <- false + ) + win.butClose.Click.AddHandler (fun obj args -> win.Close ()) win.butStart.Click.AddHandler ( @@ -125,6 +137,8 @@ let showWindow (parent : Window) (state : State.State) : bool = MessageBox.Show ("No image selected", "Cannot start analysis", MessageBoxButton.OK, MessageBoxImage.Information) |> ignore else win.stackSourceImagesSelection.IsEnabled <- false + win.butSelectAll.IsEnabled <- false + win.butUnselectAll.IsEnabled <- false analysisPerformed <- false win.butStart.IsEnabled <- false win.textLog.Text <- "" @@ -152,6 +166,8 @@ let showWindow (parent : Window) (state : State.State) : bool = fun () -> win.progress.Value <- if maybeResults.IsSome then 100. else 0. win.stackSourceImagesSelection.IsEnabled <- true + win.butSelectAll.IsEnabled <- true + win.butUnselectAll.IsEnabled <- true win.butStart.IsEnabled <- true win.butClose.Content <- "Close" updateSourceImages () diff --git a/Parasitemia/ParasitemiaUI/GUI.fs b/Parasitemia/ParasitemiaUI/GUI.fs index c85017f..40b3965 100644 --- a/Parasitemia/ParasitemiaUI/GUI.fs +++ b/Parasitemia/ParasitemiaUI/GUI.fs @@ -82,16 +82,23 @@ let run (defaultConfig : Config) (fileToOpen : string option) = statusMessageTimer.Start () let highlightRBC (rbc : RBC) (highlight : bool) = - let strokeThickness = frameStrokeThickness () + let highlightRBCFrame (rbcFrame : RBCFrame) (strokeThickness : float) = + if highlight then + rbcFrame.border.StrokeThickness <- 3. * strokeThickness + if not rbc.infected && not rbc.setManually && not displayHealthy then rbcFrame.Opacity <- 1. + else + rbcFrame.border.StrokeThickness <- strokeThickness + if not rbc.infected && not rbc.setManually && not displayHealthy then rbcFrame.Opacity <- 0. - for rbcFrame in (win.stackRBC.Children |> Seq.cast).Concat(win.canvasCurrentImage.Children |> Seq.cast) do + for rbcFrame in win.stackRBC.Children |> Seq.cast do if (rbcFrame.Tag :?> RBC) = rbc then - if highlight then - rbcFrame.border.StrokeThickness <- 3. * strokeThickness - if not rbc.infected && not rbc.setManually && not displayHealthy then rbcFrame.Opacity <- 1. - else - rbcFrame.border.StrokeThickness <- strokeThickness - if not rbc.infected && not rbc.setManually && not displayHealthy then rbcFrame.Opacity <- 0. + highlightRBCFrame rbcFrame 1. + + let strokeThicknessCanvas = frameStrokeThickness () + + for rbcFrame in win.canvasCurrentImage.Children |> Seq.cast do + if (rbcFrame.Tag :?> RBC) = rbc then + highlightRBCFrame rbcFrame strokeThicknessCanvas let zoomToRBC (rbc : RBC) = win.scrollViewCurrentImage.ScrollToHorizontalOffset (rbc.center.X * currentScale - win.scrollViewCurrentImage.ViewportWidth / 2. + win.borderCurrentImage.BorderThickness.Left) diff --git a/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj b/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj index d6e4ebc..4e02997 100644 --- a/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj +++ b/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj @@ -4,9 +4,9 @@ WinExe net5.0-windows true - 1.0.0.13 - 1.0.0.13 - 1.0.13 + 1.0.0.14 + 1.0.0.14 + 1.0.14 Greg Burri CHUV & HES-SO diff --git a/Parasitemia/ParasitemiaUIControls/AnalysisWindow.xaml b/Parasitemia/ParasitemiaUIControls/AnalysisWindow.xaml index e124cc5..ba5159a 100644 --- a/Parasitemia/ParasitemiaUIControls/AnalysisWindow.xaml +++ b/Parasitemia/ParasitemiaUIControls/AnalysisWindow.xaml @@ -11,18 +11,27 @@ - + + - - + + + + + +