private void MDS_Click(object sender, EventArgs e) { label1.Text = "Start MDS"; label1.Update(); DialogResult result = OpenFileImageDialog(); List <string> paths = new List <string>(); if (result == DialogResult.OK) // Test result. { //CppWrapper.CppHistogramWrapper histo = new CppWrapper.CppHistogramWrapper(); CppWrapper.CppDistPixelWrapper dist = new CppWrapper.CppDistPixelWrapper(); dist.Clear(); paths.Clear(); int counter = 0; foreach (String file in openFileDialog1.FileNames) { Console.WriteLine(file); string files = openFileDialog1.InitialDirectory + file; paths.Add(files); counter++; } dist.addPath(paths.ToArray(), 0); double[,] array = dist.GetDistances(); CppWrapper.CppMDSWrapper mMDS = new CppWrapper.CppMDSWrapper(array, counter); double[,] arrayMDS = mMDS.GetMDS(); Chart chart = new Chart(); chart = chart1; chart.Series[0].Points.Clear(); chart.Series[2].Points.Clear(); for (int i = 0; i < counter; i++) { string name = paths[i].Split('\\').Last(); chart.Series[0].Points.AddXY(Math.Round(arrayMDS[i, 0], 5), Math.Round(arrayMDS[i, 1], 5)); chart.Series[0].Points[i].LegendToolTip = name; chart.Series[0].Points[i].Tag = paths[i]; chart.Series[0].Points[i].ToolTip = name + "\n X= " + arrayMDS[i, 0] + " Y = " + arrayMDS[i, 1]; } } label1.Text = "Finished MDS"; label1.Update(); }
private void MDS_Click(object sender, EventArgs e) { for (int i = 0; i < clicked.Length; i++) { clicked[i] = false; } DialogResult result = OpenFileImageDialog(); List <string> paths = new List <string>(); if (result == DialogResult.OK) // Test result. { //CppWrapper.CppHistogramWrapper histo = new CppWrapper.CppHistogramWrapper(); CppWrapper.CppDistPixelWrapper dist = new CppWrapper.CppDistPixelWrapper(); for (int k = 0; k < 3; k++) { dist.Clear(); paths.Clear(); int counter = 0; foreach (String file in openFileDialog1.FileNames) { string files = openFileDialog1.InitialDirectory + file; paths.Add(files); counter++; } dist.addPath(paths.ToArray(), k); double[,] array = dist.GetDistances(); //Console.WriteLine("matriz de distancias\n"); //for (int i = 0; i < counter; i++) //{ // for (int j = 0; j < counter; j++) // { // Console.Write(" " + array[i, j]); // } // Console.Write("\n"); //} CppWrapper.CppMDSWrapper mMDS = new CppWrapper.CppMDSWrapper(array, counter); double[,] arrayMDS = mMDS.GetMDS(); //TO DO - refinar! Chart chart = new Chart(); switch (k) { case 0: chart = chart1; chart.Series.RemoveAt(0); chart.Series.Add("MDS HUE"); break; case 1: chart = chart2; chart.Series.RemoveAt(0); chart.Series.Add("MDS Saturation"); break; case 2: chart = chart4; chart.Series.RemoveAt(0); chart.Series.Add("MDS Values"); break; } //chart.ChartAreas[0].Area3DStyle.Enable3D = true; //chart.ChartAreas[0].AxisX.Minimum = -1; //chart.ChartAreas[0].AxisX.Maximum = 1; for (int i = 0; i < counter; i++) { string name = paths[i].Split('\\').Last(); chart.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; chart.Series[0].Points.AddXY(Math.Round(arrayMDS[i, 0], 5), Math.Round(arrayMDS[i, 1], 5)); chart.Series[0].Points[i].LegendToolTip = name; chart.Series[0].Points[i].ToolTip = name + "\n X= " + arrayMDS[i, 0] + " Y = " + arrayMDS[i, 1]; } } } }