open System.Runtime.CompilerServices
open System.Runtime.InteropServices
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[<assembly: AssemblyTitle("Parasitemia")>]
[<assembly: AssemblyDescription("")>]
[<assembly: AssemblyConfiguration("")>]
-[<assembly: AssemblyCompany("")>]
+[<assembly: AssemblyCompany("HES-SO / CHUV / Grégory Burri")>]
[<assembly: AssemblyProduct("Parasitemia")>]
-[<assembly: AssemblyCopyright("Copyright © 2015")>]
+[<assembly: AssemblyCopyright("Copyright © 2015-2016")>]
[<assembly: AssemblyTrademark("")>]
[<assembly: AssemblyCulture("")>]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[<assembly: ComVisible(false)>]
[<assembly: Guid("70838e65-f211-44fc-b28f-0ed1ca6e850f")>]
// Version information for an assembly consists of the following four values:
-//
+//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
+//
+// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [<assembly: AssemblyVersion("1.0.*")>]
[<assembly: AssemblyVersion("1.0.0.0")>]
--- /dev/null
+module Parasitemia.GUI.About
+
+open System
+open System.Windows
+open System.Windows.Media
+open System.Windows.Markup
+open System.Windows.Shapes
+open System.Windows.Controls
+open System.Diagnostics
+
+let showWindow (parent: Window) =
+ let window = Views.AboutWindow()
+ window.Root.Owner <- parent
+ window.Root.Left <- parent.Left + parent.ActualWidth / 2. - window.Root.Width / 2.
+ window.Root.Top <- parent.Top + parent.ActualHeight / 2. - window.Root.Height / 2.
+
+ let ctrl (name: string): 'a = window.Root.FindName(name) :?> 'a
+
+ let butClose: Button = ctrl "butClose"
+ let txtAbout: TextBlock = ctrl "txtAbout"
+
+ let version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version
+ let txtVersion = sprintf "%d.%d.%d" version.Major version.Minor version.Revision
+ txtAbout.Inlines.FirstInline.ElementEnd.InsertTextInRun(txtVersion)
+
+#if DEBUG
+ txtAbout.Inlines.FirstInline.ElementEnd.InsertTextInRun(" - DEBUG")
+#endif
+
+ butClose.Click.AddHandler(fun obj args -> window.Root.Close())
+
+ window.Root.ShowDialog() |> ignore
+
--- /dev/null
+<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ mc:Ignorable="d"
+ x:Name="AboutWindow" Height="200.969" Width="282.313" MinHeight="100" MinWidth="100" Title="About" Icon="pack://application:,,,/Resources/icon.ico">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition/>
+ </Grid.RowDefinitions>
+ <Image HorizontalAlignment="Left" Height="64" VerticalAlignment="Top" Width="64" Margin="6" Source="pack://application:,,,/Resources/icon.ico"/>
+ <TextBlock x:Name="txtAbout" HorizontalAlignment="Left" Margin="6" Grid.Row="1" TextWrapping="Wrap">
+ <Bold>Parasitemia </Bold>
+ <LineBreak />
+ <Hyperlink NavigateUri="http://www.hes-so.ch">HES-SO</Hyperlink> /
+ <Hyperlink NavigateUri="http://www.chuv.ch/">CHUV</Hyperlink>
+ <LineBreak />
+ Grégory Burri
+ </TextBlock>
+ <Button x:Name="butClose" Content="Close" HorizontalAlignment="Right" Margin="3" VerticalAlignment="Bottom" Width="75" Grid.Row="2" Height="20"/>
+ </Grid>
+</Window>
\ No newline at end of file
--- /dev/null
+namespace Parasitemia.GUI.Views
+
+open FsXaml
+
+type AboutWindow = XAML<"GUI/AboutWindow.xaml">
+
window.Root.Left <- parent.Left + parent.ActualWidth / 2. - window.Root.Width / 2.
window.Root.Top <- parent.Top + parent.ActualHeight / 2. - window.Root.Height / 2.
- let ctrl (name: string): 'a =
- window.Root.FindName(name) :?> 'a
+ let ctrl (name: string): 'a = window.Root.FindName(name) :?> 'a
let butClose: Button = ctrl "butClose"
let butStart: Button = ctrl "butStart"
let run (defaultConfig: Config) (fileToOpen: string option) =
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 menuStartAnalysis: MenuItem = ctrl "menuStartAnalysis"
let menuView: MenuItem = ctrl "menuView"
let menuHightlightRBC: MenuItem = ctrl "menuHightlightRBC"
+ let menuAbout: MenuItem = ctrl "menuAbout"
let txtPatient: TextBox = ctrl "txtPatient"
let txtGlobalParasitemia: TextBox = ctrl "txtGlobalParasitemia"
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 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 ()
- if state.SourceImages.Count() = 1
+
+ if noSourceImage
then
updateCurrentImage ())
-
menuAnalysis.SubmenuOpened.AddHandler(fun obj args -> menuStartAnalysis.IsEnabled <- state.SourceImages.Count() > 0)
menuStartAnalysis.Click.AddHandler(fun obj args ->
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 <-
<MenuItem x:Name="menuView" Header="_View">
<MenuItem x:Name="menuHightlightRBC" Header="_Highlight healthy erytrocytes" IsCheckable="True" />
</MenuItem>
+ <MenuItem x:Name="menuHelp" Header="_Help">
+ <MenuItem x:Name="menuAbout" Header="_About" />
+ </MenuItem>
</Menu>
<Grid x:Name="gridMain">
<Grid.RowDefinitions>
<Compile Include="GUI\RBCFrame.xaml.fs" />
<Resource Include="GUI\AnalysisWindow.xaml" />
<Compile Include="GUI\AnalysisWindow.xaml.fs" />
+ <Resource Include="GUI\AboutWindow.xaml" />
+ <Compile Include="GUI\AboutWindow.xaml.fs" />
<Resource Include="GUI\MainWindow.xaml" />
<Compile Include="GUI\MainWindow.xaml.fs" />
<Compile Include="GUI\Types.fs" />
<Compile Include="GUI\PiaZ.fs" />
<Compile Include="GUI\State.fs" />
+ <Compile Include="GUI\About.fs" />
<Compile Include="GUI\Analysis.fs" />
<Compile Include="GUI\GUI.fs" />
<Compile Include="Program.fs" />