From: Greg Burri Date: Wed, 20 Jan 2016 21:19:04 +0000 (+0100) Subject: * Add logos CHUV and HES-SO. X-Git-Tag: 1.0.11~39 X-Git-Url: http://git.euphorik.ch/?a=commitdiff_plain;h=074d6b0377f51e868deb1c427891c722d0270deb;p=master-thesis.git * Add logos CHUV and HES-SO. * Code documentation. --- diff --git a/Parasitemia/ParasitemiaCore/Classifier.fs b/Parasitemia/ParasitemiaCore/Classifier.fs index c523790..9f4fdd0 100644 --- a/Parasitemia/ParasitemiaCore/Classifier.fs +++ b/Parasitemia/ParasitemiaCore/Classifier.fs @@ -10,7 +10,6 @@ open Emgu.CV.Structure open Types open Utils - type private EllipseFlaggedKd (e: Ellipse) = inherit Ellipse (e.Cx, e.Cy, e.A, e.B, e.Alpha) @@ -20,7 +19,6 @@ type private EllipseFlaggedKd (e: Ellipse) = member this.X = this.Cx member this.Y = this.Cy - let findCells (ellipses: Ellipse list) (parasites: ParasitesMarker.Result) (img: Image) (config: Config.Config) : Cell list = if ellipses.IsEmpty then @@ -130,7 +128,6 @@ let findCells (ellipses: Ellipse list) (parasites: ParasitesMarker.Result) (img: if stdDeviation > globalStdDeviation * config.Parameters.standardDeviationMaxRatio then e.Removed <- true - // 4) Remove ellipses with little area. let minArea = config.RBCRadius.MinArea for e, neighbors in ellipsesWithNeigbors do diff --git a/Parasitemia/ParasitemiaCore/MainAnalysis.fs b/Parasitemia/ParasitemiaCore/MainAnalysis.fs index be72a2b..7b8b066 100644 --- a/Parasitemia/ParasitemiaCore/MainAnalysis.fs +++ b/Parasitemia/ParasitemiaCore/MainAnalysis.fs @@ -16,8 +16,20 @@ open ImgTools open Config open Types +/// +/// Analyze the given image and detect reb blood cell (RBC) in it. +/// +/// The image +/// The name, used during logging +/// The configuration, must not be shared with another analysis +/// An optional function to report progress and/or cancel the process. +/// The first call returning 'false' will cancel the analysis. +/// The 'int' parameter correspond to the progression from 0 to 100 +/// A list of detected cells or nothing if the process has been cancelled let doAnalysis (img: Image) (name: string) (config: Config) (reportProgress: (int -> bool) option) : Cell list option = + // To report the progress of this function from 0 to 100. + // Return 'None' if the process must be aborted. let reportWithVal (percent: int) (value: 'a) : 'a option = match reportProgress with | Some f -> @@ -29,7 +41,7 @@ let doAnalysis (img: Image) (name: string) (config: Config) (reportPr let report (percent: int) : unit option = reportWithVal percent () - let inline buildLogWithName (text: string) = sprintf "(%s) %s" name text + let inline buildLogWithName (text: string) = sprintf "(%s) %s" name text let logWithName mess = Log.User(buildLogWithName mess) let inline logTimeWithName (text: string) (f: unit -> 'a option) : 'a option = Log.LogWithTime((buildLogWithName text), Severity.USER, f) @@ -47,8 +59,6 @@ let doAnalysis (img: Image) (name: string) (config: Config) (reportPr let initialAreaOpening = int <| config.RBCRadiusByResolution.Area * config.Parameters.ratioAreaPaleCenter * 1.2f // We do an area opening a little larger to avoid to do a second one in the case the radius found is near the initial one. do! logTimeWithName "First area opening" (fun () -> ImgTools.areaOpenF filteredGreen initialAreaOpening; report 10) - //do! report 10 - let range = let delta = config.Parameters.granulometryRange * config.RBCRadiusByResolution.Pixel int <| config.RBCRadiusByResolution.Pixel - delta, int <| config.RBCRadiusByResolution.Pixel + delta @@ -138,8 +148,11 @@ let doAnalysis (img: Image) (name: string) (config: Config) (reportPr /// /// Do multiple analyses on the same time. The number of concurrent process depends if the number of the core. /// -/// -/// An optional function to report progress. The process is aborted if the returned value is false +/// The images: (name * configuration * image) +/// An optional function to report progress and/or cancel the process. +/// The first call returning 'false' will cancel the analysis. +/// The 'int' parameter correspond to the progression from 0 to 100 +/// 'None' if the process has been cancelled or the list of result as (name * cells), 'name' corresponds to the given name let doMultipleAnalysis (imgs: (string * Config * Image) list) (reportProgress: (int -> bool) option) : (string * Cell list) list option = let report (percent: int) : bool = match reportProgress with diff --git a/Parasitemia/ParasitemiaUI/AssemblyInfo.fs b/Parasitemia/ParasitemiaUI/AssemblyInfo.fs index 22647c3..16cfbfc 100644 --- a/Parasitemia/ParasitemiaUI/AssemblyInfo.fs +++ b/Parasitemia/ParasitemiaUI/AssemblyInfo.fs @@ -34,8 +34,8 @@ open System.Runtime.InteropServices // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [] -[] -[] +[] +[] do () \ No newline at end of file diff --git a/Parasitemia/ParasitemiaUI/GUI.fs b/Parasitemia/ParasitemiaUI/GUI.fs index 921654a..a71aa96 100644 --- a/Parasitemia/ParasitemiaUI/GUI.fs +++ b/Parasitemia/ParasitemiaUI/GUI.fs @@ -60,7 +60,10 @@ let run (defaultConfig: Config) (fileToOpen: string option) = let scrollRBC: ScrollViewer = ctrl "scrollRBC" let stackRBC: StackPanel = ctrl "stackRBC" + let imgLogos: Border = ctrl "imgLogos" + // Initializations. + let canvasCurrentImageColor = canvasCurrentImage.Background menuHightlightRBC.IsChecked <- displayHealthy // Utils. @@ -126,10 +129,12 @@ let run (defaultConfig: Config) (fileToOpen: string option) = sprintf "%.1f %% (%d / %d)" percent nb nbTotal let updateCurrentImageInformation () = + txtImageInformation1.Inlines.Clear() + txtImageInformation2.Inlines.Clear() + match state.CurrentImage with | Some srcImg -> let parasitemiaStr = percentText (state.ImageParasitemia srcImg) - txtImageInformation1.Inlines.Clear() txtImageInformation1.Inlines.Add(Documents.Run("Parasitemia: ", FontWeight = FontWeights.Bold)) txtImageInformation1.Inlines.Add(parasitemiaStr) txtImageInformation1.Inlines.Add(Documents.LineBreak()) @@ -137,7 +142,6 @@ let run (defaultConfig: Config) (fileToOpen: string option) = txtImageInformation1.Inlines.Add(Documents.Run("Last analysis: ", FontWeight = FontWeights.Bold)) txtImageInformation1.Inlines.Add(Documents.Run(if srcImg.dateLastAnalysis.Ticks = 0L then "" else srcImg.dateLastAnalysis.ToLocalTime().ToString())) - txtImageInformation2.Inlines.Clear() let alteredStr = percentText (state.ImageNbAltered srcImg) txtImageInformation2.Inlines.Add(Documents.Run("Number of erytrocytes manually altered: ", FontWeight = FontWeights.Bold)) txtImageInformation2.Inlines.Add(Documents.Run(alteredStr)) @@ -310,6 +314,8 @@ let run (defaultConfig: Config) (fileToOpen: string option) = let updateCurrentImage () = match state.CurrentImage with | Some srcImg -> + imgLogos.Visibility <- Visibility.Collapsed + // Highlight the preview. stackPreviews.Children |> Seq.cast @@ -321,11 +327,13 @@ let run (defaultConfig: Config) (fileToOpen: string option) = updateRBCFramesCurrent () updateRBCFramesPreview () - updateCurrentImageInformation () | None -> + imgLogos.Visibility <- Visibility.Visible stackRBC.Children.Clear() canvasCurrentImage.Children.Clear() - canvasCurrentImage.Background <- Brushes.Black + canvasCurrentImage.Background <- canvasCurrentImageColor + + updateCurrentImageInformation () let setCurrentImage (srcImg: SourceImage) = if state.CurrentImage.IsNone || state.CurrentImage.Value <> srcImg diff --git a/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj b/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj index be0b1d6..483888f 100644 --- a/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj +++ b/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj @@ -65,6 +65,8 @@ + + diff --git a/Parasitemia/ParasitemiaUI/Resources/chuv_logo.png b/Parasitemia/ParasitemiaUI/Resources/chuv_logo.png new file mode 100644 index 0000000..e062ad8 Binary files /dev/null and b/Parasitemia/ParasitemiaUI/Resources/chuv_logo.png differ diff --git a/Parasitemia/ParasitemiaUI/Resources/hes-so_logo.png b/Parasitemia/ParasitemiaUI/Resources/hes-so_logo.png new file mode 100644 index 0000000..7900495 Binary files /dev/null and b/Parasitemia/ParasitemiaUI/Resources/hes-so_logo.png differ diff --git a/Parasitemia/ParasitemiaUI/XAML/MainWindow.xaml b/Parasitemia/ParasitemiaUI/XAML/MainWindow.xaml index d8c1fc8..2b43c86 100644 --- a/Parasitemia/ParasitemiaUI/XAML/MainWindow.xaml +++ b/Parasitemia/ParasitemiaUI/XAML/MainWindow.xaml @@ -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="700" Width="1000" MinHeight="200" MinWidth="300" Title="Parasitemia" Icon="pack://application:,,,/Resources/icon.ico" ResizeMode="CanResizeWithGrip"> + x:Name="MainWindow" Height="700" Width="1000" MinHeight="300" MinWidth="400" Title="Parasitemia" Icon="pack://application:,,,/Resources/icon.ico" ResizeMode="CanResizeWithGrip"> @@ -41,7 +41,7 @@ - + @@ -59,7 +59,7 @@ - + @@ -70,11 +70,23 @@ - + + + + + + + + + + + + +