From: Greg Burri Date: Mon, 22 Mar 2021 12:59:34 +0000 (+0100) Subject: Highlight RBC simultaneous in the preview and in the current image X-Git-Tag: 1.0.13~1 X-Git-Url: http://git.euphorik.ch/?a=commitdiff_plain;h=be048d85a1519bd45f516a88720a629d693a2be2;p=master-thesis.git Highlight RBC simultaneous in the preview and in the current image --- diff --git a/Parasitemia/ParasitemiaUI/GUI.fs b/Parasitemia/ParasitemiaUI/GUI.fs index 89f38e3..74aba27 100644 --- a/Parasitemia/ParasitemiaUI/GUI.fs +++ b/Parasitemia/ParasitemiaUI/GUI.fs @@ -81,14 +81,18 @@ let run (defaultConfig : Config) (fileToOpen : string option) = statusMessageTimer.Stop () statusMessageTimer.Start () - let highlightRBCFrame (frame : RBCFrame) (highlight : bool) = - let rbc = frame.Tag :?> RBC - if highlight then - frame.border.StrokeThickness <- 3. * frame.border.StrokeThickness - if not rbc.infected && not rbc.setManually && not displayHealthy then frame.Opacity <- 1. - else - frame.border.StrokeThickness <- frame.border.StrokeThickness / 3. - if not rbc.infected && not rbc.setManually && not displayHealthy then frame.Opacity <- 0. + let highlightRBC (rbc : RBC) (highlight : bool) = + // let rbc = frame.Tag :?> RBC + // Find the two frames in previews and current image. + + for rbcFrame in (win.stackRBC.Children |> Seq.cast).Concat(win.canvasCurrentImage.Children |> Seq.cast) do + if (rbcFrame.Tag :?> RBC) = rbc then + if highlight then + rbcFrame.border.StrokeThickness <- 3. * rbcFrame.border.StrokeThickness + if not rbc.infected && not rbc.setManually && not displayHealthy then rbcFrame.Opacity <- 1. + else + rbcFrame.border.StrokeThickness <- rbcFrame.border.StrokeThickness / 3. + if not rbc.infected && not rbc.setManually && not displayHealthy then rbcFrame.Opacity <- 0. let zoomToRBC (rbc : RBC) = win.scrollViewCurrentImage.ScrollToHorizontalOffset (rbc.center.X * currentScale - win.scrollViewCurrentImage.ViewportWidth / 2. + win.borderCurrentImage.BorderThickness.Left) @@ -194,9 +198,9 @@ let run (defaultConfig : Config) (fileToOpen : string option) = frame.menuRBCSetAsHealthy.Visibility <- Visibility.Collapsed frame.menuRBCSetAsInfected.Visibility <- Visibility.Visible ) - frame.ContextMenuClosing.AddHandler (fun obj args -> if not frame.IsMouseOver then highlightRBCFrame frame false ) - frame.MouseEnter.AddHandler (fun obj args -> highlightRBCFrame frame true) - frame.MouseLeave.AddHandler (fun obj args -> if not frame.grid.ContextMenu.IsOpen then highlightRBCFrame frame false) + frame.ContextMenuClosing.AddHandler (fun obj args -> if not frame.IsMouseOver then highlightRBC (frame.Tag :?> RBC) false ) + frame.MouseEnter.AddHandler (fun obj args -> highlightRBC (frame.Tag :?> RBC) true) + frame.MouseLeave.AddHandler (fun obj args -> if not frame.grid.ContextMenu.IsOpen then highlightRBC (frame.Tag :?> RBC) false) frame and updateRBCFramesPreview () =