Add two buttons to select or unselect all image to analyse
[master-thesis.git] / Parasitemia / ParasitemiaUI / GUI.fs
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)