Use two radius in the configuration, one computed with the image resolution and one...
[master-thesis.git] / Parasitemia / Parasitemia / GUI / GUI.fs
index 62670e6..65c3cdc 100644 (file)
@@ -61,7 +61,6 @@ let run (defaultConfig: Config) =
         let y = rbc.center.Y - rbcHeight / 2. |> Utils.roundInt
         let w = Utils.roundInt rbcWidth
         let h = Utils.roundInt rbcHeight
-        //Utils.dprintfn "w: %A, h: %A, cx: %A, cy: %A, img.w: %A, img.h: %A" w h x y img.Width img.Height
         img.GetSubRect(System.Drawing.Rectangle(System.Drawing.Point((if x < 0 then 0 else x), (if y < 0 then 0 else y)),
                                                 System.Drawing.Size((if x + w >= img.Width then img.Width - x else w),
                                                                     (if y + h >= img.Height then img.Height - y else h))))
@@ -115,8 +114,7 @@ let run (defaultConfig: Config) =
             txtImageInformation.Inlines.Add(Documents.LineBreak())
 
             txtImageInformation.Inlines.Add(Documents.Run("Average erytrocyte diameter: ", FontWeight = FontWeights.Bold))
-            txtImageInformation.Inlines.Add(Documents.Run(string (Utils.roundInt <| 2. * srcImg.rbcRadius)))
-            txtImageInformation.Inlines.Add(Documents.Run(" px"))
+            txtImageInformation.Inlines.Add(Documents.Run(srcImg.config.RBCRadius.ToString()))
             txtImageInformation.Inlines.Add(Documents.LineBreak())
 
             txtImageInformation.Inlines.Add(Documents.Run("Last analysis: ", FontWeight = FontWeights.Bold))
@@ -325,7 +323,6 @@ let run (defaultConfig: Config) =
             then
                 imgCtrl.ReleaseMouseCapture())
 
-
     let updatePreviews () =
         stackPreviews.Children.Clear ()
         for srcImg in state.SourceImages do
@@ -337,7 +334,7 @@ let run (defaultConfig: Config) =
         updatePreviews ()
         updateGlobalParasitemia ()
 
-    txtPatient.TextChanged.AddHandler(fun obj args -> state.PatientID <- txtPatient.Text)
+    txtPatient.LostFocus.AddHandler(fun obj args -> state.PatientID <- txtPatient.Text)
 
     menuExit.Click.AddHandler(fun obj args ->
         askSaveCurrent ()
@@ -366,7 +363,7 @@ let run (defaultConfig: Config) =
         let res = dialog.ShowDialog()
         if res.HasValue && res.Value
         then
-            let srcImg = state.AddSourceImage(dialog.FileName)
+            let srcImg = state.AddSourceImage dialog.FileName defaultConfig
             addPreview srcImg
             updateGlobalParasitemia ()
             if state.SourceImages.Count() = 1
@@ -374,7 +371,7 @@ let run (defaultConfig: Config) =
                 updateCurrentImage ())
 
     menuStartAnalysis.Click.AddHandler(fun obj args ->
-        if Analysis.showWindow mainWindow.Root state defaultConfig
+        if Analysis.showWindow mainWindow.Root state
         then
             updateGlobalParasitemia ()
             updateCurrentImage ())