예제 #1
0
        private void createGraphBTN_Click(object sender, EventArgs e)
        {
            if (!ReadyToCreateGraph(true))
            {
                return;
            }

            createGraphBTN.Enabled = false;

            var rScriptPath = Directory.GetCurrentDirectory() + @"\Rscript.r";

            var rScriptExePath = Environment.Is64BitOperatingSystem
                ? Directory.GetCurrentDirectory() + @"\R\R-3.3.1\bin\x64\RScript.exe"
                : Directory.GetCurrentDirectory() + @"\R\R-3.3.1\bin\x86\RScript.exe";

            var scriptSchema = new ScriptStartInfo(rScriptPath, rScriptExePath)
            {
                Args           = "--verbose",
                OnDataReceived = data => { WriteOutput(data, Color.Blue); },
                OnException    = exception => { WriteOutput(exception.Message + exception.InnerException?.Message, Color.Red); },
                OnExit         = delegate {
                    Invoke((Action)(() => {
                        WriteOutput("Graph generation complete.", Color.Blue);
                        createGraphBTN.Enabled = true;
                    }));
                }
            };

            ScriptDaemon.ExecuteScript(this, scriptSchema, false);
        }
예제 #2
0
        public async Task Run(AnalyzeitForm owningForm)
        {
            var stepOne = new ScriptStartInfo(_stepOnePath, _pyExePath, onDataReceived: owningForm.OnScriptDataReceived);
            await Task.Run(() => ScriptDaemon.ExecuteScript(owningForm, stepOne, true));

            var test     = csv_calculateStandardDeviationfromColum(_scriptDir + _outputFilenameStep1, 1, true);
            var testMean = csv_calculateMeanfromColumn(_scriptDir + _outputFilenameStep1, 1, true);

            var test2     = csv_calculateStandardDeviationfromColum(_scriptDir + _outputFilenameStep1, 2, true);
            var test2Mean = csv_calculateMeanfromColumn(_scriptDir + _outputFilenameStep1, 2, true);

            owningForm.WriteLine("Standard dev - Max Pixels : " + test, Color.Blue);
            owningForm.WriteLine("Mean - Max Pixels : " + testMean, Color.Blue);
            owningForm.WriteLine("Standard dev - otsu threshold: " + test2, Color.Blue);
            owningForm.WriteLine("Mean - otsu threshold: " + test2Mean, Color.Blue);
        }
예제 #3
0
        private void createGraphBTN_Click(object sender, EventArgs e)
        {
            if (!Ready(true))
            {
                return;
            }

            createGraphBTN.Enabled = false;

            var rScriptPath    = _settingsDirectory + @"Rscript.r";
            var rScriptExePath = Environment.Is64BitOperatingSystem
                ? _settingsDirectory + @"R\R-3.3.1\bin\x64\RScript.exe"
                : _settingsDirectory + @"R\R-3.3.1\bin\i386\RScript.exe";

            var scriptSchema = new ScriptStartInfo(rScriptPath, rScriptExePath)
            {
                Args           = "--verbose",
                OnDataReceived = data => {
                    var color = Color.Blue;
                    if (data != null && data.StartsWith("%"))
                    {
                        color = getColor(data.Substring(1, 1));
                        data  = data.Substring(2);
                    }
                    WriteOutput(data, color);
                },
                OnException = exception => { WriteOutput(exception.Message + exception.InnerException?.Message + rScriptPath + rScriptExePath, Color.Red); },
                OnExit      = delegate {
                    Invoke((Action)(() => {
                        WriteOutput("Graph generation complete.", Color.Blue);
                        createGraphBTN.Enabled = true;
                    }));
                }
            };

            ScriptDaemon.ExecuteScript(this, scriptSchema, false);
        }