X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FGUI.fs;fp=Parasitemia%2FParasitemiaUI%2FGUI.fs;h=c85017fa1fd581c1eb9ae369f52c6597fffeaedc;hp=74aba278a90043356b76910dfd14d4db3b87e60b;hb=5d1a08f1b121d660228b08d9f931edaed619fdb9;hpb=be048d85a1519bd45f516a88720a629d693a2be2 diff --git a/Parasitemia/ParasitemiaUI/GUI.fs b/Parasitemia/ParasitemiaUI/GUI.fs index 74aba27..c85017f 100644 --- a/Parasitemia/ParasitemiaUI/GUI.fs +++ b/Parasitemia/ParasitemiaUI/GUI.fs @@ -50,11 +50,11 @@ let run (defaultConfig : Config) (fileToOpen : string option) = frame.manuallyAdded.Fill <- color frame.border.Stroke <- color - let frameStrokeThickness (averageRBCSize : float) = - max 1. (averageRBCSize / 60.) + let frameStrokeThickness () = + state.CurrentImage |> Option.map (fun img -> max 1. (img.AverageRBCSize / 100.)) |> Option.defaultValue 1. - let frameFontSize (averageRBCSize : float) = - max 1. (averageRBCSize / 6.) + let frameFontSize () = + state.CurrentImage |> Option.map (fun img -> max 1. (img.AverageRBCSize / 6.)) |> Option.defaultValue 1. let createRBCFrameFromExisting (srcImg : SourceImage) (rbc : RBC) (frame : RBCFrame) (frameThickness : float) (fontSize : float) (isTextBelow : bool) : RBCFrame = frame.Visibility <- Visibility.Visible @@ -82,16 +82,15 @@ let run (defaultConfig : Config) (fileToOpen : string option) = statusMessageTimer.Start () let highlightRBC (rbc : RBC) (highlight : bool) = - // let rbc = frame.Tag :?> RBC - // Find the two frames in previews and current image. + let strokeThickness = frameStrokeThickness () 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 + rbcFrame.border.StrokeThickness <- 3. * strokeThickness if not rbc.infected && not rbc.setManually && not displayHealthy then rbcFrame.Opacity <- 1. else - rbcFrame.border.StrokeThickness <- rbcFrame.border.StrokeThickness / 3. + rbcFrame.border.StrokeThickness <- strokeThickness if not rbc.infected && not rbc.setManually && not displayHealthy then rbcFrame.Opacity <- 0. let zoomToRBC (rbc : RBC) = @@ -232,8 +231,8 @@ let run (defaultConfig : Config) (fileToOpen : string option) = match state.CurrentImage with | Some srcImg -> let mutable currentCanvas = 0 - let strokeThickness = frameStrokeThickness srcImg.AverageRBCSize - let fontSize = frameFontSize srcImg.AverageRBCSize + let strokeThickness = frameStrokeThickness () + let fontSize = frameFontSize () for rbc in srcImg.RBCs do let frame = if currentCanvas < win.canvasCurrentImage.Children.Count then