Esempio n. 1
0
        public Boolean ROI_create(CogRecordDisplay CogRecordDisplay1, Runparams runparams)
        {
            string ProcID = System.Reflection.MethodInfo.GetCurrentMethod().Name.ToString();

            try
            {
                //initial RunParams
                m_FindCircleTool.RunParams.ExpectedCircularArc.CenterX    = runparams.mCenterX;
                m_FindCircleTool.RunParams.ExpectedCircularArc.CenterY    = runparams.mCenterY;
                m_FindCircleTool.RunParams.ExpectedCircularArc.Radius     = runparams.mRadius;
                m_FindCircleTool.RunParams.ExpectedCircularArc.AngleStart = runparams.mAngleStart;
                m_FindCircleTool.RunParams.ExpectedCircularArc.AngleSpan  = runparams.mAngleSpan;
                m_FindCircleTool.RunParams.NumCalipers                    = runparams.mNumCalipers;
                m_FindCircleTool.RunParams.CaliperSearchLength            = runparams.mCaliperSearchLength;
                m_FindCircleTool.RunParams.CaliperProjectionLength        = runparams.mCaliperProjectionLength;
                m_FindCircleTool.RunParams.CaliperSearchDirection         = runparams.mCircleSearchDirectionOption;
                m_FindCircleTool.RunParams.NumToIgnore                    = runparams.mNumToIgnore;
                m_FindCircleTool.RunParams.CaliperRunParams.Edge0Polarity = runparams.mCogCaliperPolarityConstants;

                m_FindCircleTool.InputImage = (CogImage8Grey)CogRecordDisplay1.Image;
                CogRecordDisplay1.Record    = m_FindCircleTool.CreateCurrentRecord().SubRecords["InputImage"];
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                FindCircleTool_Status = false;
                return(false);
            }
        }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Runparams runparams = new Runparams();

            runparams.mCenterX                     = 730.041;
            runparams.mCenterY                     = 436.627;
            runparams.mRadius                      = 377.985;
            runparams.mAngleStart                  = 78.8641;
            runparams.mAngleSpan                   = -277.93;
            runparams.mCaliperSearchLength         = 177.499;
            runparams.mCaliperProjectionLength     = 54.2951;
            runparams.mCircleSearchDirectionOption = CogFindCircleSearchDirectionConstants.Outward;
            try
            {
                runparams.mNumCalipers = Int32.Parse(textBox1.Text.ToString());
                runparams.mNumToIgnore = Int32.Parse(textBox2.Text.ToString());
                switch (listBox1.SelectedIndex)
                {
                case 0:
                    runparams.mCogCaliperPolarityConstants = CogCaliperPolarityConstants.DarkToLight;
                    break;

                case 1:
                    runparams.mCogCaliperPolarityConstants = CogCaliperPolarityConstants.LightToDark;
                    break;

                case 2:
                    runparams.mCogCaliperPolarityConstants = CogCaliperPolarityConstants.DontCare;
                    break;

                default:
                    runparams.mCogCaliperPolarityConstants = CogCaliperPolarityConstants.DontCare;
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("輸入格式錯誤!");
            }
            ROI_create(cogRecordDisplay1, runparams);
        }