コード例 #1
0
ファイル: roiDetection.cs プロジェクト: fray1014/first
        private void CalcDsc(int id)
        {
            RectangleF rectFRoiRecord;

            PointF[] rectFRoiPoints;
            Size     rectRoiSize;

            RectangleF rectFBlkRecord;
            Rectangle  rectBlkRecord;

            PointF[] rectFBlkPoints;
            Size     rectBlkSize;

            string fileName = Path.Combine(fileDir + "-", Convert.ToString(id));;

            rectFRoiRecord = RectConverter.ConvertFromDrawRect(roi[id], slide[id], id);
            rectFRoiPoints = RectConverter.GetAllPointsByRectangleF(rectFRoiRecord, amp);
            rectRoiSize    = RectConverter.GetStepsByRectangleF(rectFRoiRecord, amp);

            rectBlkRecord  = rectsBLK[id];
            rectFBlkRecord = RectConverter.ConvertFromDrawRect(rectsBLK[id], slide[id], id);
            // Cal two Points.
            rectFBlkPoints    = new PointF[2];
            rectFBlkPoints[0] = new PointF(rectFBlkRecord.Left - rectFBlkRecord.Width / 3, rectFBlkRecord.Top + rectFBlkRecord.Height / 2);
            rectFBlkPoints[1] = new PointF(rectFBlkRecord.Left - rectFBlkRecord.Width * 2 / 3, rectFBlkRecord.Top + rectFBlkRecord.Height / 2);
            rectBlkSize       = RectConverter.GetStepsByRectangleF(rectFBlkRecord, amp);

            roi[id] = RectConverter.ConvertToDrawRect(roi[id], slide[id], id);

            GenerateTaskDesc(fileName, roi[id], rectFRoiRecord, rectFRoiPoints, rectRoiSize,
                             rectBlkRecord, rectFBlkRecord, rectFBlkPoints, rectBlkSize,
                             id);
        }
コード例 #2
0
        private void btntestmove_Click(object sender, EventArgs e)
        {
            RectangleF testmoveRF = RectConverter.ConvertFromDrawRect(rect, idxRect);
            PointF     testmovePt = RectConverter.GetAllPointsByRectangleF(testmoveRF, amp)[0];
            double     testmovezp = TangoController.TangoGetZPos();

            TangoController.TangoMoveAbs(1, testmovePt.X, testmovePt.Y, testmovezp, 0, true);
        }
コード例 #3
0
        private void btnStartScan_Click(object sender, EventArgs e)
        {
            if (isSetName)
            {
                rectFRoiTotalPoints = 0;
                if (MessageBox.Show(generateConfirmMessage(), "确认", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                }
                else
                {
                    RectangleF rectFRoiRecord;
                    Rectangle  rectRoiRecord;
                    PointF[]   rectFRoiPoints;
                    Size       rectRoiSize;

                    RectangleF rectFBlkRecord;
                    Rectangle  rectBlkRecord;
                    PointF[]   rectFBlkPoints;
                    Size       rectBlkSize;


                    for (int i = 0; i < 4; i++)
                    {
                        if (broi[i])
                        {
                            //if (isimporttask[i])
                            //{
                            //    rectFRoiTotalPoints += tdscs[i].rectRoiSize.Width * tdscs[i].rectRoiSize.Height;
                            //    rectFRoiTotalPoints += tdscs[i].rectBlkPts.Length;

                            //    rectRoiRecord = rectsROI[i];
                            //    rectFRoiRecord = RectConverter.ConvertFromDrawRect(rectsROI[i], i);
                            //    rectFRoiPoints = RectConverter.GetAllPointsByRectangleF(rectFRoiRecord, amp);
                            //    rectRoiSize = RectConverter.GetStepsByRectangleF(rectFRoiRecord, amp);
                            //    rectFRoiTotalPoints += rectRoiSize.Width * rectRoiSize.Height;

                            //    rectBlkRecord = rectsBLK[i];
                            //    rectFBlkRecord = RectConverter.ConvertFromDrawRect(rectsBLK[i], i);
                            //    // Cal two Points.
                            //    rectFBlkPoints = new PointF[2];
                            //    rectFBlkPoints[0] = new PointF(rectFBlkRecord.Left - rectFBlkRecord.Width / 3, rectFBlkRecord.Top + rectFBlkRecord.Height / 2);
                            //    rectFBlkPoints[1] = new PointF(rectFBlkRecord.Left - rectFBlkRecord.Width * 2 / 3, rectFBlkRecord.Top + rectFBlkRecord.Height / 2);
                            //    rectBlkSize = RectConverter.GetStepsByRectangleF(rectFBlkRecord, amp);
                            //    rectFRoiTotalPoints += rectFBlkPoints.Length;

                            //    Temp = RectConverter.GenerateTaskDesc(colorconfig.location, setnames[i],
                            //        rectRoiRecord, rectFRoiRecord, rectFRoiPoints, rectRoiSize,
                            //        rectBlkRecord, rectFBlkRecord, rectFBlkPoints, rectBlkSize,
                            //        i);

                            //}
                            //else
                            //{
                            rectRoiRecord        = rectsROI[i];
                            rectFRoiRecord       = RectConverter.ConvertFromDrawRect(rectsROI[i], i);
                            rectFRoiPoints       = RectConverter.GetAllPointsByRectangleF(rectFRoiRecord, amp);
                            rectRoiSize          = RectConverter.GetStepsByRectangleF(rectFRoiRecord, amp);
                            rectFRoiTotalPoints += rectRoiSize.Width * rectRoiSize.Height;

                            rectBlkRecord  = rectsBLK[i];
                            rectFBlkRecord = RectConverter.ConvertFromDrawRect(rectsBLK[i], i);
                            // Cal two Points.
                            rectFBlkPoints       = new PointF[2];
                            rectFBlkPoints[0]    = new PointF(rectFBlkRecord.Left - rectFBlkRecord.Width / 3, rectFBlkRecord.Top + rectFBlkRecord.Height / 2);
                            rectFBlkPoints[1]    = new PointF(rectFBlkRecord.Left - rectFBlkRecord.Width * 2 / 3, rectFBlkRecord.Top + rectFBlkRecord.Height / 2);
                            rectBlkSize          = RectConverter.GetStepsByRectangleF(rectFBlkRecord, amp);
                            rectFRoiTotalPoints += rectFBlkPoints.Length;

                            Temp = RectConverter.GenerateTaskDesc(colorconfig.location, setnames[i],
                                                                  rectRoiRecord, rectFRoiRecord, rectFRoiPoints, rectRoiSize,
                                                                  rectBlkRecord, rectFBlkRecord, rectFBlkPoints, rectBlkSize,
                                                                  i);
                            //}
                        }
                    }

                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("请先设置扫描玻片的名字");
            }
        }