Esempio n. 1
0
        public static bool fixCheckRoiConfig(int index, ViewWindow.Model.ROI region, ref List <Model.CheckRoiConfig> checkRoiConfig)
        {
            bool rct = false;

            try
            {
                if (checkRoiConfig.Count > 0)
                {
                    //    List<ViewWindow.Model.RoiData> m_RoiData = new List<ViewWindow.Model.RoiData>();
                    //    m_RoiData.Add(new ViewWindow.Model.RoiData(0, region));
                    //    checkRoiConfig.Add
                    //}
                    //else
                    //{
                    checkRoiConfig[index].ROIParameter[0] = new ViewWindow.Model.RoiData(0, region);
                }
                rct = true;
            }
            catch (Exception)
            {
                rct = false;
            }

            return(rct);
        }
Esempio n. 2
0
        public static bool addROI(ViewWindow.Model.ROI region, ref List <Model.CheckRoiConfig> checkRoiConfig)
        {
            bool mRET = false;

            try
            {
                List <ViewWindow.Model.RoiData> m_RoiData = new List <ViewWindow.Model.RoiData>();
                m_RoiData.Add(new ViewWindow.Model.RoiData(0, region));

                int id = 0;
                if (checkRoiConfig == null)
                {
                    checkRoiConfig = new List <CheckRoiConfig>();
                }
                else if (checkRoiConfig.Count > 0)
                {
                    id = checkRoiConfig[checkRoiConfig.Count - 1].ID + 1;
                }

                checkRoiConfig.Add(new CheckRoiConfig(id, m_RoiData[0].Name, true, m_RoiData));

                mRET = true;
            }
            catch (Exception ex)
            {
            }


            return(mRET);
        }
Esempio n. 3
0
        private void viewPort_HMouseUp(object sender, HMouseEventArgs e)
        {
            int           index;
            List <double> data;

            ViewWindow.Model.ROI roi = this._windowControl.smallestActiveROI(out data, out index);

            if (index > -1)
            {
                this._windowControl.fixROI(index, roi, ref this._regions);
                Model.CheckRoiConfig.fixCheckRoiConfig(index, roi, ref this._checkRoiConfig);
            }
        }
Esempio n. 4
0
        //窗口ROI选择
        private void viewPort_HMouseUp(object sender, HMouseEventArgs e)
        {
            int           index;
            List <double> data;

            ViewWindow.Model.ROI roi = this._windowControl.smallestActiveROI(out data, out index);

            if (index > -1)
            {
                this._windowControl.fixROI(index, roi, ref this._regions);
                Model.MatchingConfig.fixMatchingConfig(Model.FixType.ROIParameter, index, roi, ref this._matchingConfig);
            }
        }
Esempio n. 5
0
        private bool creatShapeModel(HObject image, ViewWindow.Model.ROI roi, List <Model.CreatModelParameter> parameter, out HTuple modleID)
        {
            bool    m_flag = false;
            HObject ho_TemplateImage;
            HObject ho_modelROI;

            HOperatorSet.GenEmptyRegion(out ho_modelROI);
            HOperatorSet.GenEmptyRegion(out ho_TemplateImage);
            ho_modelROI.Dispose();
            ho_TemplateImage.Dispose();

            modleID = new HTuple();

            try
            {
                ViewWindow.Model.RoiData region = new ViewWindow.Model.RoiData(0, roi);

                switch (region.Name)
                {
                case "Rectangle1":
                    HOperatorSet.GenRectangle1(out ho_modelROI, region.Rectangle1.Row1, region.Rectangle1.Column1,
                                               region.Rectangle1.Row2, region.Rectangle1.Column2);
                    break;

                case "Rectangle2":
                    HOperatorSet.GenRectangle2(out ho_modelROI, region.Rectangle2.Row, region.Rectangle2.Column,
                                               region.Rectangle2.Phi, region.Rectangle2.Lenth1, region.Rectangle2.Lenth2);
                    break;

                case "Circle":
                    HOperatorSet.GenCircle(out ho_modelROI, region.Circle.Row, region.Circle.Column, region.Circle.Radius);
                    break;
                }

                HOperatorSet.ReduceDomain(image, ho_modelROI, out ho_TemplateImage);
                HOperatorSet.CreateShapeModel(ho_TemplateImage, parameter[0].NumLevels, parameter[0].AngleStart, parameter[0].AngleExtent, "auto",
                                              "none", "use_polarity", "auto", "auto", out modleID);
                m_flag = true;
            }
            catch (Exception)
            {
                m_flag  = false;
                modleID = null;
                ho_modelROI.Dispose();
                ho_TemplateImage.Dispose();
            }

            return(m_flag);
        }
Esempio n. 6
0
        public static bool addShapeModel(HObject image, ViewWindow.Model.ROI region, ref List <Model.MatchingConfig> matchingConfig, out HTuple modelID)
        {
            bool rct = false;

            if ((region != null) && (image != null))
            {
                List <Model.CreatModelParameter> m_CreatModelParameter = new List <Model.CreatModelParameter>();
                Model.CreatModelParameter        m_CreatModel          = new Model.CreatModelParameter(1, 0.0, 360.0, 3);
                m_CreatModelParameter.Add(m_CreatModel);
                List <Model.FindModelParameter> m_FindModelParameter = new List <Model.FindModelParameter>();
                Model.FindModelParameter        m_FindModel          = new Model.FindModelParameter(1, 0.0, 360.0, 0.75, 1, 0.75, 3);
                m_FindModelParameter.Add(m_FindModel);

                List <ViewWindow.Model.RoiData> m_RoiData = new List <ViewWindow.Model.RoiData>();

                m_RoiData.Add(new ViewWindow.Model.RoiData(0, region));

                int id = 0;

                if (matchingConfig == null)
                {
                    matchingConfig = new List <MatchingConfig>();
                }
                else if (matchingConfig.Count > 0)
                {
                    id = matchingConfig[matchingConfig.Count - 1].ID + 1;
                }

                Model.MatchingConfig m_matchingConfig = new Model.MatchingConfig(id, m_RoiData[0].Name, true, m_RoiData, m_CreatModelParameter, m_FindModelParameter);
                matchingConfig.Add(m_matchingConfig);

                rct = creatShapeModel(image, m_RoiData[0], m_CreatModelParameter, out modelID);
            }
            else
            {
                rct     = false;
                modelID = null;
            }

            return(rct);
        }
Esempio n. 7
0
        private void creatNewROI()
        {
            List <double> m_data;
            int           m_index;

            ViewWindow.Model.ROI m_region = this._windowControl.smallestActiveROI(out m_data, out m_index);

            if (m_index > -1)
            {
                bool rct = Model.CheckRoiConfig.addROI(m_region, ref this._checkRoiConfig);

                //if (rct)
                //{
                //    binDataGridViewMatchingConfig(this.dgv_MatchingConfig, this._matchingConfig);
                //    Model.MatchingConfig.saveModelId(ho_ModelImage, this._matchingConfig[m_index], this._ModelIdSavePath);
                //    string msg = string.Format("创建模板成功 {0}", this.hv_ModelId.I);
                //    MessageBox.Show(msg, "系统提示", MessageBoxButtons.OK);
                //}
            }
            else
            {
                MessageBox.Show("请选择ROI", "系统提示", MessageBoxButtons.OK);
            }
        }