private void Measure_2D_Line_Activated(object sender, EventArgs e) { if (M2DLP_form.ifopenformornot == false) { M2DLP_in.Length1 = 20; M2DLP_in.Length2 = 5; M2DLP_in.Sigma = 1; M2DLP_in.Threshold = 10; this.Length1_trackBar.Value = 20; this.Length2_trackBar.Value = 5; this.Sigma_trackBar.Value = 1; this.Threshold_trackBar.Value = 10; M2DLP_form.ifopenformornot = true; M2DLP_form.SelectImage.Clear(); for (int i = 0; i < M2DLP_in.O_T.Count; i++) { for (int j = 0; j < M2DLP_in.O_T[i].OImage.Count; j++) { if (M2DLP_in.O_T[i].OImage[j] != null) { SelectImageNName M1S = new SelectImageNName(); M1S.Image = M2DLP_in.O_T[i].OImage[j]; M1S.ImageName = (string)M2DLP_in.O_T[i].OImageName[j]; M2DLP_form.SelectImage.Add(M1S); index_ij ij_temp = new index_ij(); ij_temp.i = i; ij_temp.j = j; M2DLP_form.index.Add(ij_temp); } } } whichpicture.DataSource = null; whichpicture.DataSource = M2DLP_form.SelectImage; whichpicture.DisplayMember = "ImageName"; whichpicture.ValueMember = "Image"; M2DLP_form.loadfinish = true; M2DLP_form.src_Image.SetImage = (HObject)whichpicture.SelectedValue; if (M2DLP_form.src_Image.GetImage != null) M2DLP_form.src_Image.GetImageSize(); toolWindow.WindowImage.SetImage = M2DLP_form.src_Image.GetImage; toolWindow1.WindowImage.SetImage = M2DLP_form.src_Image.GetImage; tabControl.SelectedTab = setimage; } if (toolWindow.WindowImage.GetImage != null) toolWindow.showImage(); if (toolWindow1.WindowImage.GetImage != null) toolWindow1.showImage(); }
private void CreateMatchingModel_Activated(object sender, EventArgs e) { //判斷是否已經開啟視窗 if (CMMP_form.ifopenformornot == false) { HOperatorSet.GenEmptyObj(out CMMP_form.Reduce_Image); HOperatorSet.GenEmptyObj(out CMMP_form.CreatShapeModel); HOperatorSet.GenEmptyObj(out CMMP_form.ModelAtNewPosition); HOperatorSet.GenEmptyObj(out CMMP_form.ModelAtNewPosition_temp); HOperatorSet.GenEmptyObj(out CMMP_form.ImageAtNewPosition); HOperatorSet.GenEmptyObj(out CMMP_form.Template_Image_rot); HOperatorSet.GenEmptyObj(out CMMP_form.ROI_rot); //進來表示已經開啟,並且更改狀態。 CMMP_form.ifopenformornot = true; //清除SelectImage表單。 CMMP_form.SelectImage.Clear(); //載入O_T至表單裡(OImage) for (int i = 0; i < CMMP_in.O_T.Count - 1; i++) { for (int j = 0; j < CMMP_in.O_T[i].OImage.Count; j++) { if (CMMP_in.O_T[i].OImage[j] != null) { SelectImageNName M1S = new SelectImageNName(); M1S.Image = CMMP_in.O_T[i].OImage[j]; M1S.ImageName = (string)CMMP_in.O_T[i].OImageName[j]; CMMP_form.SelectImage.Add(M1S); index_ij ij_temp = new index_ij(); ij_temp.i = i; ij_temp.j = j; CMMP_form.index.Add(ij_temp); } } } whichpicture.DataSource = null; whichpicture.DataSource = CMMP_form.SelectImage; whichpicture.DisplayMember = "ImageName"; whichpicture.ValueMember = "Image"; CMMP_form.loadfinish = true; CMMP_form.src_Image.SetImage = (HObject)whichpicture.SelectedValue; if (CMMP_form.src_Image.GetImage!=null) { CMMP_form.src_Image.GetImageSize(); } toolWindow.WindowImage = CMMP_form.src_Image; tabControl1.SelectedTab = tabPage1; } if (toolWindow.WindowImage.GetImage != null) toolWindow.showImage(); if (toolWindow1.WindowImage.GetImage != null) toolWindow1.showImage(); if (toolWindow2.WindowImage.GetImage != null) toolWindow2.showImage(); }
private void Measure_Activated(object sender, EventArgs e) { if (!M1DP_form.ifopenformornot) { M1DP_form.ifopenformornot = true; //表格參數預載 this.MaxEdge.Value = 40; this.sigma.Value = 1; this.ROIWeight.Value = 30; this.MaxEage_trackBar.Value = 40; this.Sigma_trackBar.Value = 1; this.ROIWeight_trackBar.Value = 30; M1DP_form.transition_pair = MeasureTransition_pair.all.ToString(); M1DP_form.transition_pos = MeasureTransition_pos.all.ToString(); M1DP_form.select = MeasureSelect.all.ToString(); M1DP_form.sigma = 1; M1DP_form.threshold = 40; M1DP_form.TransitionData_pair.Clear(); M1DP_form.TransitionData_pair.Add(MeasureTransition_pair.all.ToString()); M1DP_form.TransitionData_pair.Add(MeasureTransition_pair.all_strongest.ToString()); M1DP_form.TransitionData_pair.Add(MeasureTransition_pair.negative.ToString()); M1DP_form.TransitionData_pair.Add(MeasureTransition_pair.negative_strongest.ToString()); M1DP_form.TransitionData_pair.Add(MeasureTransition_pair.positive.ToString()); M1DP_form.TransitionData_pair.Add(MeasureTransition_pair.positive_strongest.ToString()); M1DP_form.TransitionData_pos.Clear(); M1DP_form.TransitionData_pos.Add(MeasureTransition_pos.all.ToString()); M1DP_form.TransitionData_pos.Add(MeasureTransition_pos.negative.ToString()); M1DP_form.TransitionData_pos.Add(MeasureTransition_pos.positive.ToString()); M1DP_form.SelectData.Clear(); M1DP_form.SelectData.Add(MeasureSelect.all.ToString()); M1DP_form.SelectData.Add(MeasureSelect.first.ToString()); M1DP_form.SelectData.Add(MeasureSelect.last.ToString()); M1DP_form.SelectImage.Clear(); for (int i = 0; i < M1DP_in.O_T.Count; i++) { for (int j = 0; j < M1DP_in.O_T[i].OImage.Count; j++) { if (M1DP_in.O_T[i].OImage[j] != null) { SelectImageNName M1S = new SelectImageNName(); M1S.Image = M1DP_in.O_T[i].OImage[j]; M1S.ImageName = (string)M1DP_in.O_T[i].OImageName[j]; M1DP_form.SelectImage.Add(M1S); index_ij ij_temp = new index_ij(); ij_temp.i = i; ij_temp.j = j; M1DP_form.index_img.Add(ij_temp); } } } result_list.Clear(); result_list.View = View.Details; result_list.Columns.Add("編號"); result_list.Columns.Add("行"); result_list.Columns.Add("列"); result_list.Columns.Add("振幅"); result_list.Columns.Add("距離"); this.result_list.EndUpdate(); whichpicture.DataSource = null; whichpicture.DataSource = M1DP_form.SelectImage; whichpicture.DisplayMember = "ImageName"; whichpicture.ValueMember = "Image"; SelectBox.DataSource = null; SelectBox.DataSource = M1DP_form.SelectData; posButton.Checked = true; M1DP_form.ifopenformornot = true; M1DP_form.loadfinish = true; M1DP_form.Measure_Image.SetImage = (HObject)whichpicture.SelectedValue; toolWindow.WindowImage.CopyImagetoThis(M1DP_form.Measure_Image.GetImage); } if (toolWindow.WindowImage.GetImage != null) toolWindow.showImage(); }
private void TheVerticalLine_Activated(object sender, EventArgs e) { if (TVL_form.ifopenformornot == false) { TVL_form.ifopenformornot = true; TVL_form.SelectImage.Clear(); for (int i = 0; i < TVL_in.O_T.Count; i++) { for (int j = 0; j < TVL_in.O_T[i].OImage.Count; j++) { if (TVL_in.O_T[i].OImage[j] != null) { SelectImageNName M1S = new SelectImageNName(); M1S.Image = TVL_in.O_T[i].OImage[j]; M1S.ImageName = (string)TVL_in.O_T[i].OImageName[j]; TVL_form.SelectImage.Add(M1S); index_ij ij_temp = new index_ij(); ij_temp.i = i; ij_temp.j = j; TVL_form.index_img.Add(ij_temp); } } } whichpicture.DataSource = null; whichpicture.DataSource = TVL_form.SelectImage; whichpicture.DisplayMember = "ImageName"; whichpicture.ValueMember = "Image"; for (int i = 0; i < TVL_in.O_T.Count; i++) { for (int j = 0; j < TVL_in.O_T[i].OPoint.Count; j++) { if (TVL_in.O_T[i].OPoint[j]!=null) { SelectPointNName SPNN = new SelectPointNName(); SPNN.Point = TVL_in.O_T[i].OPoint[j]; SPNN.PointName = (string)TVL_in.O_T[i].OPointName[j]; SPNN.circleorpoint = 0; TVL_form.SelectPoint1.Add(SPNN); index_ij ij_temp = new index_ij(); ij_temp.i = i; ij_temp.j = j; TVL_form.index_1.Add(ij_temp); } } } for (int i = 0; i < TVL_in.O_T.Count; i++) { for (int j = 0; j < TVL_in.O_T[i].OCircle.Count; j++) { if (TVL_in.O_T[i].OCircle[j] != null) { SelectPointNName SPNN = new SelectPointNName(); PointBase P_temp = new PointBase(); P_temp.row = TVL_in.O_T[i].OCircle[j].row; P_temp.col = TVL_in.O_T[i].OCircle[j].column; SPNN.Point = P_temp; SPNN.PointName = TVL_in.O_T[i].OCircleName[j]; SPNN.circleorpoint = 1; TVL_form.SelectPoint1.Add(SPNN); index_ij ij_temp = new index_ij(); ij_temp.i = i; ij_temp.j = j; TVL_form.index_1.Add(ij_temp); } } } whichpoint1.DataSource = null; whichpoint1.DataSource = TVL_form.SelectPoint1; whichpoint1.DisplayMember = "PointName"; whichpoint1.ValueMember = "Point"; for (int i = 0; i < TVL_in.O_T.Count; i++) { for (int j = 0; j < TVL_in.O_T[i].OPoint.Count; j++) { if (TVL_in.O_T[i].OPoint[j] != null) { SelectPointNName SPNN = new SelectPointNName(); SPNN.Point = TVL_in.O_T[i].OPoint[j]; SPNN.PointName = (string)TVL_in.O_T[i].OPointName[j]; SPNN.circleorpoint = 0; TVL_form.SelectPoint2.Add(SPNN); index_ij ij_temp = new index_ij(); ij_temp.i = i; ij_temp.j = j; TVL_form.index_2.Add(ij_temp); } } } for (int i = 0; i < TVL_in.O_T.Count; i++) { for (int j = 0; j < TVL_in.O_T[i].OCircle.Count; j++) { if (TVL_in.O_T[i].OCircle[j] != null) { SelectPointNName SPNN = new SelectPointNName(); PointBase P_temp = new PointBase(); P_temp.row = TVL_in.O_T[i].OCircle[j].row; P_temp.col = TVL_in.O_T[i].OCircle[j].column; SPNN.Point = P_temp; SPNN.PointName = TVL_in.O_T[i].OCircleName[j]; SPNN.circleorpoint = 1; TVL_form.SelectPoint2.Add(SPNN); index_ij ij_temp = new index_ij(); ij_temp.i = i; ij_temp.j = j; TVL_form.index_2.Add(ij_temp); } } } whichpoint2.DataSource = null; whichpoint2.DataSource = TVL_form.SelectPoint2; whichpoint2.DisplayMember = "PointName"; whichpoint2.ValueMember = "Point"; TVL_form.loadfinish = true; toolWindow.Clear_Object_disp(); TVL_form.src_Image.SetImage = (HObject)whichpicture.SelectedValue; PointBase temp1 = (PointBase)whichpoint1.SelectedValue; PointBase temp2 = (PointBase)whichpoint2.SelectedValue; TVL_form.hv_first_row = temp1.row; TVL_form.hv_first_col = temp1.col; TVL_form.hv_Second_row = temp2.row; TVL_form.hv_Second_col = temp2.col; HOperatorSet.GenCrossContourXld(out TVL_form.ho_Cross_firstpoint, TVL_form.hv_first_row, TVL_form.hv_first_col, 10, 0); HOperatorSet.GenCrossContourXld(out TVL_form.ho_Cross_secondpoint, TVL_form.hv_Second_row, TVL_form.hv_Second_col, 10, 0); toolWindow.Add_Object_disp(TVL_form.ho_Cross_firstpoint, "red", "margin", 3); toolWindow.Add_Object_disp(TVL_form.ho_Cross_secondpoint, "blue", "margin", 3); toolWindow.WindowImage.SetImage = TVL_form.src_Image.GetImage; toolWindow.WindowImage.GetImageSize(); toolWindow.showImage(); toolWindow1.WindowImage.SetImage = TVL_form.src_Image.GetImage; toolWindow1.WindowImage.GetImageSize(); toolWindow1.showImage(); } if (toolWindow.WindowImage.GetImage != null) toolWindow.showImage(); if (toolWindow1.WindowImage.GetImage != null) toolWindow1.showImage(); }
private void PL_distance_Activated(object sender, EventArgs e) { if (setornot == false) { if (ifopenformornot == false) { ifopenformornot = true; SelectImage.Clear(); for (int i = 0; i < O_T.Count; i++) { for (int j = 0; j < O_T[i].OImage.Count; j++) { if (O_T[i].OImage[j] != null) { SelectImageNName M1S = new SelectImageNName(); M1S.Image = O_T[i].OImage[j]; M1S.ImageName = (string)O_T[i].OImageName[j]; SelectImage.Add(M1S); index_ij ij_temp = new index_ij(); ij_temp.i = i; ij_temp.j = j; index_img.Add(ij_temp); } } } whichpicture.DataSource = null; whichpicture.DataSource = SelectImage; whichpicture.DisplayMember = "ImageName"; whichpicture.ValueMember = "Image"; for (int i = 0; i < O_T.Count; i++) { for (int j = 0; j < O_T[i].OPoint.Count; j++) { if (O_T[i].OPoint[j] != null) { SelectPointNName SPNN = new SelectPointNName(); SPNN.Point = O_T[i].OPoint[j]; SPNN.PointName = (string)O_T[i].OPointName[j]; SPNN.circleorpoint = 0; SelectPoint1.Add(SPNN); index_ij ij_temp = new index_ij(); ij_temp.i = i; ij_temp.j = j; index_P1.Add(ij_temp); } } } for (int i = 0; i < O_T.Count; i++) { for (int j = 0; j < O_T[i].OCircle.Count; j++) { if (O_T[i].OCircle[j] != null) { SelectPointNName SPNN = new SelectPointNName(); PointBase P_temp = new PointBase(); P_temp.row = O_T[i].OCircle[j].row; P_temp.col = O_T[i].OCircle[j].column; SPNN.Point = P_temp; SPNN.PointName = O_T[i].OCircleName[j]; SPNN.circleorpoint = 1; SelectPoint1.Add(SPNN); index_ij ij_temp = new index_ij(); ij_temp.i = i; ij_temp.j = j; index_C1.Add(ij_temp); } } } whichpoint1.DataSource = null; whichpoint1.DataSource = SelectPoint1; whichpoint1.DisplayMember = "PointName"; whichpoint1.ValueMember = "Point"; for (int i = 0; i < O_T.Count; i++) { for (int j = 0; j < O_T[i].OLine.Count; j++) { if (O_T[i].OLine[j] != null) { SelectLineNName SPNN = new SelectLineNName(); SPNN.Line = O_T[i].OLine[j]; SPNN.LineName = (string)O_T[i].OLineName[j]; SelectLine.Add(SPNN); index_ij ij_temp = new index_ij(); ij_temp.i = i; ij_temp.j = j; index_L1.Add(ij_temp); } } } whichLline.DataSource = null; whichLline.DataSource = SelectLine; whichLline.DisplayMember = "LineName"; whichLline.ValueMember = "Line"; loadfinish = true; toolWindow.Clear_Object_disp(); src_Image.SetImage = (HObject)whichpicture.SelectedValue; PointBase temp1 = (PointBase)whichpoint1.SelectedValue; Line temp2 = (Line)whichLline.SelectedValue; PLD.hv_first_row = temp1.row; PLD.hv_first_col = temp1.col; PLD.hv_row1 = temp2.row_start; PLD.hv_col1 = temp2.column_start; PLD.hv_row2 = temp2.row_end; PLD.hv_col2 = temp2.column_end; HOperatorSet.GenCrossContourXld(out PLD.ho_Cross_firstpoint, PLD.hv_first_row, PLD.hv_first_col, 10, 0); HOperatorSet.GenRegionLine(out PLD.ho_RegionLines, PLD.hv_row1, PLD.hv_col1, PLD.hv_row2, PLD.hv_col2); toolWindow.Add_Object_disp(PLD.ho_Cross_firstpoint, "red", "margin", 3); toolWindow.Add_Object_disp(PLD.ho_RegionLines, "green", "margin", 3); toolWindow.WindowImage.CopyImagetoThis(src_Image.GetImage); toolWindow.showImage(); } } else if (setornot == true) { if (ifopenformornot == false) { ifopenformornot = true; toolWindow.showImage(); } } }