Add two buttons to select or unselect all image to analyse 1.0.14
authorGreg Burri <greg.burri@gmail.com>
Mon, 22 Mar 2021 22:33:13 +0000 (23:33 +0100)
committerGreg Burri <greg.burri@gmail.com>
Mon, 22 Mar 2021 22:33:13 +0000 (23:33 +0100)
Parasitemia/ParasitemiaCore/ParasitemiaCore.fsproj
Parasitemia/ParasitemiaUI/Analysis.fs
Parasitemia/ParasitemiaUI/GUI.fs
Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj
Parasitemia/ParasitemiaUIControls/AnalysisWindow.xaml

index 700dcbf..2825174 100644 (file)
@@ -3,9 +3,9 @@
   <PropertyGroup>
     <OutputType>Library</OutputType>
     <TargetFramework>net5.0</TargetFramework>
-    <Version>1.0.13</Version>
-    <AssemblyVersion>1.0.0.13</AssemblyVersion>
-    <FileVersion>1.0.0.13</FileVersion>
+    <Version>1.0.14</Version>
+    <AssemblyVersion>1.0.0.14</AssemblyVersion>
+    <FileVersion>1.0.0.14</FileVersion>
     <Authors>Greg Burri</Authors>
     <Product />
     <Company>CHUV &amp; HES-SO</Company>
index 43987d1..928c15f 100644 (file)
@@ -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<ImageSourceSelection> do
+                srcImgCtrl.chkSelection.IsChecked <- true
+    )
+
+    win.butUnselectAll.Click.AddHandler (
+        fun obj args ->
+            for srcImgCtrl in win.stackSourceImagesSelection.Children |> Seq.cast<ImageSourceSelection> 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 ()
index c85017f..40b3965 100644 (file)
@@ -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<RBCFrame>).Concat(win.canvasCurrentImage.Children |> Seq.cast<RBCFrame>) do
+        for rbcFrame in win.stackRBC.Children |> Seq.cast<RBCFrame> 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<RBCFrame> 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)
index d6e4ebc..4e02997 100644 (file)
@@ -4,9 +4,9 @@
     <OutputType>WinExe</OutputType>
     <TargetFramework>net5.0-windows</TargetFramework>
     <UseWPF>true</UseWPF>
-    <AssemblyVersion>1.0.0.13</AssemblyVersion>
-    <FileVersion>1.0.0.13</FileVersion>
-    <Version>1.0.13</Version>
+    <AssemblyVersion>1.0.0.14</AssemblyVersion>
+    <FileVersion>1.0.0.14</FileVersion>
+    <Version>1.0.14</Version>
     <Authors>Greg Burri</Authors>
     <Company>CHUV &amp; HES-SO</Company>
     <Win32Resource></Win32Resource>
index e124cc5..ba5159a 100644 (file)
     <Grid>
         <Grid.RowDefinitions>
             <RowDefinition Height="50*"/>
-            <RowDefinition Height="30"/>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="Auto"/>
             <RowDefinition Height="20*"/>
             <RowDefinition Height="Auto"/>
         </Grid.RowDefinitions>
         <ScrollViewer x:Name="scrollImagesSourceSelection" x:FieldModifier="public" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden" Grid.Row="0" Margin="3" >
             <StackPanel x:Name="stackSourceImagesSelection" x:FieldModifier="public" />
         </ScrollViewer>
-        <ProgressBar x:Name="progress" x:FieldModifier="public" Grid.Row="1" Margin="3" Minimum="0" Maximum="100" />
-        <ScrollViewer x:Name="scrollLog" x:FieldModifier="public" Grid.Row="2" Margin="3" HorizontalScrollBarVisibility="Auto">
+        <Grid Grid.Row="1">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition />
+                <ColumnDefinition />
+            </Grid.ColumnDefinitions>
+            <Button x:Name="butSelectAll" x:FieldModifier="public" Content="Select all" Grid.Column="0" Margin="3" />
+            <Button x:Name="butUnselectAll" x:FieldModifier="public" Content="Unselect all" Grid.Column="1" Margin="3" />
+        </Grid>
+        <ProgressBar x:Name="progress" x:FieldModifier="public" Grid.Row="2" Margin="3" Minimum="0" Maximum="100" Height="20" />
+        <ScrollViewer x:Name="scrollLog" x:FieldModifier="public" Grid.Row="3" Margin="3" HorizontalScrollBarVisibility="Auto">
             <TextBlock x:Name="textLog" x:FieldModifier="public" />
         </ScrollViewer>
-        <Grid Grid.Row="3">
+        <Grid Grid.Row="4">
             <Grid.ColumnDefinitions>
                 <ColumnDefinition/>
                 <ColumnDefinition/>