From: Greg Burri Date: Sat, 21 Oct 2017 12:00:39 +0000 (+0200) Subject: FIX #277 X-Git-Tag: 1.0.13~17^2 X-Git-Url: http://git.euphorik.ch/?a=commitdiff_plain;h=77cb62e17c3e8e7de65b8dab6769be84ca794b92;p=master-thesis.git FIX #277 Add some information in the GUI to see the possible command arguments. --- diff --git a/Parasitemia/ParasitemiaCore/ParasitemiaCore.fsproj b/Parasitemia/ParasitemiaCore/ParasitemiaCore.fsproj index c841f71..f6262e2 100644 --- a/Parasitemia/ParasitemiaCore/ParasitemiaCore.fsproj +++ b/Parasitemia/ParasitemiaCore/ParasitemiaCore.fsproj @@ -91,13 +91,13 @@ True - ..\packages\FSharp.Core.4.2.1\lib\net45\FSharp.Core.dll + ..\packages\FSharp.Core.4.2.3\lib\net45\FSharp.Core.dll - ..\packages\MathNet.Numerics.3.19.0\lib\net40\MathNet.Numerics.dll + ..\packages\MathNet.Numerics.3.20.0\lib\net40\MathNet.Numerics.dll - ..\packages\MathNet.Numerics.FSharp.3.19.0\lib\net40\MathNet.Numerics.FSharp.dll + ..\packages\MathNet.Numerics.FSharp.3.20.0\lib\net40\MathNet.Numerics.FSharp.dll @@ -111,7 +111,7 @@ - ..\packages\System.ValueTuple.4.3.1\lib\netstandard1.0\System.ValueTuple.dll + ..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll diff --git a/Parasitemia/ParasitemiaCore/packages.config b/Parasitemia/ParasitemiaCore/packages.config index d0073d5..87c6b51 100644 --- a/Parasitemia/ParasitemiaCore/packages.config +++ b/Parasitemia/ParasitemiaCore/packages.config @@ -2,11 +2,11 @@ - - - + + + - + \ No newline at end of file diff --git a/Parasitemia/ParasitemiaUI/CommandLineArguments.fs b/Parasitemia/ParasitemiaUI/CommandLineArguments.fs new file mode 100644 index 0000000..8025ebf --- /dev/null +++ b/Parasitemia/ParasitemiaUI/CommandLineArguments.fs @@ -0,0 +1,20 @@ +module ParasitemiaUI.CommandLineArguments + +open System +open System.Windows +open System.Windows.Controls +open System.Diagnostics + +let showWindow (parent : Window) = + let win = Views.CommandLineArgumentsWindow () + win.Owner <- parent + + win.Left <- (if parent.WindowState = WindowState.Maximized then 0. else parent.Left) + parent.ActualWidth / 2. - win.Width / 2. + win.Top <- (if parent.WindowState = WindowState.Maximized then 0. else parent.Top) + parent.ActualHeight / 2. - win.Height / 2. + + win.txtCommandLineArguments.Text <- Utils.argsHelp + + win.butClose.Click.AddHandler (fun obj args -> win.Close ()) + + win.ShowDialog () |> ignore + diff --git a/Parasitemia/ParasitemiaUI/GUI.fs b/Parasitemia/ParasitemiaUI/GUI.fs index 4eee1e5..d78c202 100644 --- a/Parasitemia/ParasitemiaUI/GUI.fs +++ b/Parasitemia/ParasitemiaUI/GUI.fs @@ -484,6 +484,8 @@ let run (defaultConfig : Config) (fileToOpen : string option) = win.menuAbout.Click.AddHandler (fun obj args -> About.showWindow win) + win.menuCommandLineArguments.Click.AddHandler (fun obj args -> CommandLineArguments.showWindow win) + win.Closing.AddHandler (fun obj args -> askSaveCurrent ()) // Zoom on the current image. diff --git a/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj b/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj index b9ad387..429ceaa 100644 --- a/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj +++ b/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj @@ -80,6 +80,8 @@ + + @@ -92,6 +94,7 @@ + @@ -111,7 +114,7 @@ ..\packages\EmguCV.3.1.0.1\lib\net30\Emgu.CV.World.dll - ..\packages\FSharp.Core.4.2.1\lib\net45\FSharp.Core.dll + ..\packages\FSharp.Core.4.2.3\lib\net45\FSharp.Core.dll ..\packages\FSharp.ViewModule.Core.1.0.7.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\FSharp.ViewModule.dll @@ -144,7 +147,7 @@ - ..\packages\System.ValueTuple.4.3.1\lib\netstandard1.0\System.ValueTuple.dll + ..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll diff --git a/Parasitemia/ParasitemiaUI/Program.fs b/Parasitemia/ParasitemiaUI/Program.fs index 87e1c26..63bd963 100644 --- a/Parasitemia/ParasitemiaUI/Program.fs +++ b/Parasitemia/ParasitemiaUI/Program.fs @@ -20,7 +20,7 @@ type RunningMode = | CmdLine of Input * string // A file or a directory to process and the output directory. | Window of string option // An optional path to a file to open can be given in window mode. -type Arguments = RunningMode * bool +type Arguments = RunningMode * bool // bool : true if in debug mode. let parseArgs (args : string[]) : Arguments = @@ -40,18 +40,7 @@ let parseArgs (args : string[]) : Arguments = runningMode, Array.exists ((=) "--debug") args let showArgsHelp () = - printfn "Usage of Parasitemia :" - printfn "Non-interactive mode:" - printfn " %s (--folder |--file ) --output [--debug]" System.AppDomain.CurrentDomain.FriendlyName - printfn " --folder : an input folder containing images to analyze" - printfn " --file : an image file to be analyzed" - printfn " --output : a folder to put the results" - printfn " --debug : output more information like intermediate images if set" - - printfn "Interactive mode:" - printfn " %s [] [--debug]" System.AppDomain.CurrentDomain.FriendlyName - printfn " : a PIAZ file to automatically open at startup" - printfn " --debug : output information like intermediate images if set in the current directory" + Console.WriteLine Utils.argsHelp [] extern bool AttachConsole (int dwProcessId) @@ -93,7 +82,7 @@ let main args = use resultFile = new StreamWriter (new FileStream (Path.Combine (output, "results.txt"), FileMode.Append, FileAccess.Write)) - let images = [ for file in files -> Path.GetFileNameWithoutExtension (FileInfo(file).Name), config.Copy(), new Image (file) ] + let images = [ for file in files -> Path.GetFileNameWithoutExtension (FileInfo(file).Name), config.Copy (), new Image (file) ] Log.LogWithTime Severity.INFO ( fun () -> @@ -109,7 +98,7 @@ let main args = Some () ) "Whole analyze" |> ignore - Log.RmListener (listener) + Log.RmListener listener 0 | Window fileToOpen -> diff --git a/Parasitemia/ParasitemiaUI/Utils.fs b/Parasitemia/ParasitemiaUI/Utils.fs index 8635bcd..810494e 100644 --- a/Parasitemia/ParasitemiaUI/Utils.fs +++ b/Parasitemia/ParasitemiaUI/Utils.fs @@ -61,3 +61,18 @@ let sensorSizes : SensorSize list = | _ex -> saveSensorSizesToFile defaultSensorSizes defaultSensorSizes + +let argsHelp = + let programName = System.AppDomain.CurrentDomain.FriendlyName + "Usage of Parasitemia:\n" + + "Non-interactive mode:\n" + + (sprintf " %s (--folder |--file ) --output [--debug]\n" programName) + + " --folder : an input folder containing images to analyze\n" + + " --file : an image file to be analyzed\n" + + " --output : a folder to put the results\n" + + " --debug : output more information like intermediate images (it takes more CPU and memory)\n" + + + "Interactive mode:\n" + + (sprintf " %s [] [--debug]\n" programName) + + " : a PIAZ file to automatically open at startup\n" + + " --debug : output information like intermediate images in the current directory (it takes more CPU and memory)" \ No newline at end of file diff --git a/Parasitemia/ParasitemiaUI/XAML/CommandLineArgumentsWindow.xaml b/Parasitemia/ParasitemiaUI/XAML/CommandLineArgumentsWindow.xaml new file mode 100644 index 0000000..8952ea3 --- /dev/null +++ b/Parasitemia/ParasitemiaUI/XAML/CommandLineArgumentsWindow.xaml @@ -0,0 +1,17 @@ + + + + + + + + Parasitemia can be launched via a command line, here are the possible arguments + +