Set an application icon.
authorGreg Burri <greg.burri@gmail.com>
Fri, 15 Jan 2016 10:39:42 +0000 (11:39 +0100)
committerGreg Burri <greg.burri@gmail.com>
Fri, 15 Jan 2016 10:39:42 +0000 (11:39 +0100)
Parasitemia/Parasitemia/Config.fs
Parasitemia/Parasitemia/GUI/Analysis.fs
Parasitemia/Parasitemia/GUI/ImageSourceSelection.xaml
Parasitemia/Parasitemia/GUI/MainWindow.xaml
Parasitemia/Parasitemia/GUI/PiaZ.fs
Parasitemia/Parasitemia/Parasitemia.fsproj
Parasitemia/Parasitemia/Resources/icon.ico [new file with mode: 0644]
Parasitemia/Parasitemia/Resources/logo_256.png [deleted file]
Parasitemia/Parasitemia/resources.rc [new file with mode: 0644]
Parasitemia/Parasitemia/resources.res [new file with mode: 0644]

index 0916408..cd8f659 100644 (file)
@@ -42,7 +42,7 @@ type Parameters = {
 
 let defaultParameters = {
     rbcDiameter = 8.<μm>
-    resolution = 200.e3<ppi> // Correspond to 50X.
+    resolution = 220.e3<ppi> // Correspond to 50X.
 
     ratioAreaPaleCenter = 1.f / 3.f // The ratio between an RBC area and the area of the its pale center.
 
index 6ae1e20..0c79d79 100644 (file)
@@ -70,8 +70,8 @@ let showWindow (parent: Window) (state: State.State) : bool =
             imageSourceSelection.lblDateLastAnalysis.Content <- if srcImg.dateLastAnalysis.Ticks = 0L then "<Never>" else srcImg.dateLastAnalysis.ToString()
 
             imageSourceSelection.txtResolution.Text <- srcImg.config.Parameters.resolution.ToString()
-            imageSourceSelection.menuZoom50X.Click.AddHandler(fun obj args -> imageSourceSelection.txtResolution.Text <- "200000"; updateResolution ())
-            imageSourceSelection.menuZoom100X.Click.AddHandler(fun obj args -> imageSourceSelection.txtResolution.Text <- "400000"; updateResolution ())
+            imageSourceSelection.menuZoom50X.Click.AddHandler(fun obj args -> imageSourceSelection.txtResolution.Text <- "230000"; updateResolution ())
+            imageSourceSelection.menuZoom100X.Click.AddHandler(fun obj args -> imageSourceSelection.txtResolution.Text <- "460000"; updateResolution ())
 
             imageSourceSelection.txtResolution.PreviewTextInput.AddHandler(fun obj args ->
                 let text = imageSourceSelection.txtResolution.Text + args.Text
index 4fcde66..62a97f5 100644 (file)
@@ -44,8 +44,8 @@
             <Button x:Name="butDefaultResolutions" Content="Defaults" Grid.Column="1" Margin="3">
                <Button.ContextMenu>
                   <ContextMenu>
-                     <MenuItem x:Name="menuZoom50X" Header="_200'000 PPI (50X)"  />
-                     <MenuItem x:Name="menuZoom100X" Header="_400'000 PPI (100X)" />
+                     <MenuItem x:Name="menuZoom50X" Header="_230'000 PPI (50X)"  />
+                     <MenuItem x:Name="menuZoom100X" Header="_460'000 PPI (100X)" />
                   </ContextMenu>
                </Button.ContextMenu>
                <Button.Style>
index 9fa8316..314b9dd 100644 (file)
@@ -3,7 +3,7 @@
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         mc:Ignorable="d"
-        x:Name="MainWindow" Height="681.888" Width="787.61" MinHeight="200" MinWidth="300" Title="Parasitemia" Icon="pack://application:,,,/Resources/logo_256.png">
+        x:Name="MainWindow" Height="681.888" Width="787.61" MinHeight="200" MinWidth="300" Title="Parasitemia" Icon="pack://application:,,,/Resources/icon.ico">
    <DockPanel x:Name="dockPanelMain" LastChildFill="True">
       <Menu DockPanel.Dock="Top">
          <MenuItem Header="_File">
index 22359e9..d551b8d 100644 (file)
@@ -25,6 +25,7 @@ type JSONInformation = {
 // Information associated to each images.
 type JSONSourceImage = {
     num: int
+    RBCRadius: float32 // The RBC Radius found by granulometry.
     parameters: Config.Parameters
     dateLastAnalysis: DateTime
     rbcs: RBC List
@@ -57,7 +58,7 @@ let save (filePath: string) (data: FileData) =
 
         let imgJSONEntry = file.CreateEntry(imgFilename + ".json", CompressionLevel.Fastest)
         use imgJSONFileWriter = new StreamWriter(imgJSONEntry.Open())
-        imgJSONFileWriter.Write(JsonConvert.SerializeObject({ num = srcImg.num; parameters = srcImg.config.Parameters; dateLastAnalysis = srcImg.dateLastAnalysis; rbcs = srcImg.rbcs }))
+        imgJSONFileWriter.Write(JsonConvert.SerializeObject({ num = srcImg.num; RBCRadius = srcImg.config.RBCRadius.Pixel; parameters = srcImg.config.Parameters; dateLastAnalysis = srcImg.dateLastAnalysis; rbcs = srcImg.rbcs }))
 
 
 let load (filePath: string) : FileData =
@@ -77,8 +78,10 @@ let load (filePath: string) : FileData =
                         let imgEntry = file.GetEntry(imgEntry.Name + ".json")
                         use imgEntryFileReader = new StreamReader(imgEntry.Open())
                         let imgInfo = JsonConvert.DeserializeObject<JSONSourceImage>(imgEntryFileReader.ReadToEnd())
+                        let config = Config.Config(imgInfo.parameters)
+                        config.SetRBCRadius imgInfo.RBCRadius
                         yield { num = imgNum
-                                config = Config.Config(imgInfo.parameters)
+                                config = config
                                 dateLastAnalysis = imgInfo.dateLastAnalysis
                                 img = img
                                 rbcs = imgInfo.rbcs } ] }
\ No newline at end of file
index ed05b74..bb9ea52 100644 (file)
@@ -16,6 +16,7 @@
     <NuGetPackageImportStamp>
     </NuGetPackageImportStamp>
     <TargetFrameworkProfile />
+    <Win32Resource>resources.res</Win32Resource>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <Compile Include="Program.fs" />
     <None Include="App.config" />
     <Content Include="packages.config" />
-    <Resource Include="Resources\logo_256.png" />
+    <Resource Include="Resources\icon.ico" />
   </ItemGroup>
   <ItemGroup>
     <Reference Include="Castle.Core">
diff --git a/Parasitemia/Parasitemia/Resources/icon.ico b/Parasitemia/Parasitemia/Resources/icon.ico
new file mode 100644 (file)
index 0000000..147e3a8
Binary files /dev/null and b/Parasitemia/Parasitemia/Resources/icon.ico differ
diff --git a/Parasitemia/Parasitemia/Resources/logo_256.png b/Parasitemia/Parasitemia/Resources/logo_256.png
deleted file mode 100644 (file)
index 857a793..0000000
Binary files a/Parasitemia/Parasitemia/Resources/logo_256.png and /dev/null differ
diff --git a/Parasitemia/Parasitemia/resources.rc b/Parasitemia/Parasitemia/resources.rc
new file mode 100644 (file)
index 0000000..a9c6f16
--- /dev/null
@@ -0,0 +1 @@
+1 ICON "resources\icon.ico"
\ No newline at end of file
diff --git a/Parasitemia/Parasitemia/resources.res b/Parasitemia/Parasitemia/resources.res
new file mode 100644 (file)
index 0000000..14cf8fa
Binary files /dev/null and b/Parasitemia/Parasitemia/resources.res differ