private void btn_load_Click(object sender, EventArgs e) { ExperimentsNames wsiIndexItem = new ExperimentsNames(); this.Invoke(new MethodInvoker(delegate() { wsiIndexItem = (ExperimentsNames)cmbBox_experiments.SelectedItem; })); int wsiIndex = wsiIndexItem.Order; cancer_path = ExplanationDatabase.wsi_paths[wsiIndex]; string label_path = ExplanationDatabase.wsi_labels_paths[wsiIndex]; richTxtBxInfo.Invoke((MethodInvoker) delegate { richTxtBxInfo.Text = $"Načitávam label map"; }); cancer_img = new Bitmap(cancer_path); label_img = new Bitmap(label_path); clear_cancer_img = new Bitmap(cancer_path); pcBx_cancer.Image = cancer_img; pcBx_label.Image = label_img; this.probabilities = LoadDatabase.LoadProbabilities(wsiIndex); trackBar1.Visible = true; this.wsi_name = wsiIndexItem.Name; folderPathToSaveResult = ExplanationDatabase.WSI_DATA_PATH + wsi_name + "\\results"; Directory.CreateDirectory(folderPathToSaveResult); // load sugggested point to examine this.suggestedPoints = Utilities.LoadSuggestedPoints(this.wsi_name); this.suggestedPoints.Shuffle(); }
private void pcBx_cancer_Click(object sender, EventArgs e) { if (pcBx_cancer.Image != null && pcBx_label.Image != null) { MouseEventArgs me = (MouseEventArgs)e; Point coordinates = me.Location; if (me.Button == System.Windows.Forms.MouseButtons.Left) { this.pointer = this.SetNormalizePoint(coordinates); this.newPointer = this.SetNormalizePoint(coordinates); var coord = Utilities.GetAbsolutCoordinates(coordinates, ORIGINAL_SIZE, pcBx_cancer); this.actualCoord = coord; int x = coord[0]; int y = coord[1]; var pxColor = label_img.GetPixel(x, y); int predictedLabel = ExplanationDatabase.GetLabel(pxColor); var vector = LoadDatabase.GetProbabilityVector(probabilities, x, y); string[] classes = new string[8]; double[] percent = new double[8]; for (int i = 0; i < 8; i++) { classes[i] = ExplanationDatabase.classes[i + 1]; percent[i] = Math.Round((double)vector[i] * 100, 2); } Array.Reverse(classes, 0, 8); Array.Reverse(percent, 0, 8); chart1.Series[0].Points.DataBindXY(classes, percent); this.actualPredicted = predictedLabel; //richTxtBxInfo.Text = $"Vybrané tkanivo je {ExplanationDatabase.classes[predictedLabel]}. "; richTxtBxInfo.Text = $"Selected area of the tissue is type {ExplanationDatabase.classes[predictedLabel]}. "; Utilities.HighlightWords(ExplanationDatabase.classes.Values.ToArray(), richTxtBxInfo); groupBox_accuracy.Enabled = true; pcBx_label.Refresh(); pcBx_cancer.Refresh(); } } }