projects
/
master-thesis.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add an about window.
[master-thesis.git]
/
Parasitemia
/
Parasitemia
/
GUI
/
GUI.fs
diff --git
a/Parasitemia/Parasitemia/GUI/GUI.fs
b/Parasitemia/Parasitemia/GUI/GUI.fs
index
b0af4cc
..
950afc9
100644
(file)
--- a/
Parasitemia/Parasitemia/GUI/GUI.fs
+++ b/
Parasitemia/Parasitemia/GUI/GUI.fs
@@
-16,11
+16,10
@@
open Emgu.CV.WPF
open Config
open Types
open Config
open Types
-let run (defaultConfig: Config) =
+let run (defaultConfig: Config)
(fileToOpen: string option)
=
let app = new Application()
let mainWindow = Views.MainWindow()
let app = new Application()
let mainWindow = Views.MainWindow()
- let ctrl (name: string): 'a =
- mainWindow.Root.FindName(name) :?> 'a
+ let ctrl (name: string): 'a = mainWindow.Root.FindName(name) :?> 'a
let colorRBCHealthy = Brushes.YellowGreen
let colorRBCInfected = Brushes.Red
let colorRBCHealthy = Brushes.YellowGreen
let colorRBCInfected = Brushes.Red
@@
-34,8
+33,11
@@
let run (defaultConfig: Config) =
let menuLoadFile: MenuItem = ctrl "menuOpen"
let menuNewFile: MenuItem = ctrl "menuNew"
let menuAddSourceImage: MenuItem = ctrl "menuAddSourceImage"
let menuLoadFile: MenuItem = ctrl "menuOpen"
let menuNewFile: MenuItem = ctrl "menuNew"
let menuAddSourceImage: MenuItem = ctrl "menuAddSourceImage"
+ let menuAnalysis: MenuItem = ctrl "menuAnalysis"
let menuStartAnalysis: MenuItem = ctrl "menuStartAnalysis"
let menuStartAnalysis: MenuItem = ctrl "menuStartAnalysis"
+ let menuView: MenuItem = ctrl "menuView"
let menuHightlightRBC: MenuItem = ctrl "menuHightlightRBC"
let menuHightlightRBC: MenuItem = ctrl "menuHightlightRBC"
+ let menuAbout: MenuItem = ctrl "menuAbout"
let txtPatient: TextBox = ctrl "txtPatient"
let txtGlobalParasitemia: TextBox = ctrl "txtGlobalParasitemia"
let txtPatient: TextBox = ctrl "txtPatient"
let txtGlobalParasitemia: TextBox = ctrl "txtGlobalParasitemia"
@@
-114,7
+116,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.LineBreak())
txtImageInformation.Inlines.Add(Documents.Run("Average erytrocyte diameter: ", FontWeight = FontWeights.Bold))
- txtImageInformation.Inlines.Add(Documents.Run(srcImg.config.
FormattedRadius
))
+ txtImageInformation.Inlines.Add(Documents.Run(srcImg.config.
RBCRadius.ToString()
))
txtImageInformation.Inlines.Add(Documents.LineBreak())
txtImageInformation.Inlines.Add(Documents.Run("Last analysis: ", FontWeight = FontWeights.Bold))
txtImageInformation.Inlines.Add(Documents.LineBreak())
txtImageInformation.Inlines.Add(Documents.Run("Last analysis: ", FontWeight = FontWeights.Bold))
@@
-334,6
+336,12
@@
let run (defaultConfig: Config) =
updatePreviews ()
updateGlobalParasitemia ()
updatePreviews ()
updateGlobalParasitemia ()
+ let loadFile (filepath: string) =
+ askSaveCurrent ()
+ state.FilePath <- filepath
+ state.Load()
+ updateGUI ()
+
txtPatient.LostFocus.AddHandler(fun obj args -> state.PatientID <- txtPatient.Text)
menuExit.Click.AddHandler(fun obj args ->
txtPatient.LostFocus.AddHandler(fun obj args -> state.PatientID <- txtPatient.Text)
menuExit.Click.AddHandler(fun obj args ->
@@
-347,11
+355,7
@@
let run (defaultConfig: Config) =
let dialog = OpenFileDialog(Filter = PiaZ.filter)
let res = dialog.ShowDialog()
if res.HasValue && res.Value
let dialog = OpenFileDialog(Filter = PiaZ.filter)
let res = dialog.ShowDialog()
if res.HasValue && res.Value
- then
- askSaveCurrent ()
- state.FilePath <- dialog.FileName
- state.Load()
- updateGUI ())
+ then loadFile dialog.FileName)
menuNewFile.Click.AddHandler(fun obj args ->
askSaveCurrent ()
menuNewFile.Click.AddHandler(fun obj args ->
askSaveCurrent ()
@@
-359,17
+363,24
@@
let run (defaultConfig: Config) =
updateGUI())
menuAddSourceImage.Click.AddHandler(fun obj args ->
updateGUI())
menuAddSourceImage.Click.AddHandler(fun obj args ->
- let dialog = OpenFileDialog(Filter = "Image Files|*.png;*.jpg;*.tif;*.tiff")
+ let dialog = OpenFileDialog(Filter = "Image Files|*.png;*.jpg;*.tif;*.tiff"
, Multiselect = true
)
let res = dialog.ShowDialog()
if res.HasValue && res.Value
then
let res = dialog.ShowDialog()
if res.HasValue && res.Value
then
- let srcImg = state.AddSourceImage dialog.FileName defaultConfig
- addPreview srcImg
+ let noSourceImage = state.SourceImages.Count() = 0
+
+ for filename in dialog.FileNames do
+ let srcImg = state.AddSourceImage filename defaultConfig
+ addPreview srcImg
+
updateGlobalParasitemia ()
updateGlobalParasitemia ()
- if state.SourceImages.Count() = 1
+
+ if noSourceImage
then
updateCurrentImage ())
then
updateCurrentImage ())
+ menuAnalysis.SubmenuOpened.AddHandler(fun obj args -> menuStartAnalysis.IsEnabled <- state.SourceImages.Count() > 0)
+
menuStartAnalysis.Click.AddHandler(fun obj args ->
if Analysis.showWindow mainWindow.Root state
then
menuStartAnalysis.Click.AddHandler(fun obj args ->
if Analysis.showWindow mainWindow.Root state
then
@@
-381,6
+392,8
@@
let run (defaultConfig: Config) =
updateRBCFramesPreview ()
updateRBCFramesCurrent ())
updateRBCFramesPreview ()
updateRBCFramesCurrent ())
+ menuAbout.Click.AddHandler(fun obj args -> About.showWindow mainWindow.Root)
+
// Zoom on the current image.
let adjustCurrentImageBorders (deltaX: float) (deltaY: float) =
borderCurrentImage.BorderThickness <-
// Zoom on the current image.
let adjustCurrentImageBorders (deltaX: float) (deltaY: float) =
borderCurrentImage.BorderThickness <-
@@
-467,4
+480,9
@@
let run (defaultConfig: Config) =
scrollViewCurrentImage.ScrollChanged.AddHandler(fun obj args -> updateViewportPreview ())
mainWindow.Root.Show()
scrollViewCurrentImage.ScrollChanged.AddHandler(fun obj args -> updateViewportPreview ())
mainWindow.Root.Show()
+
+ match fileToOpen with
+ | Some filepath -> loadFile filepath
+ | None -> ()
+
app.Run()
\ No newline at end of file
app.Run()
\ No newline at end of file