Пример #1
0
        private void _SetTargetValueZ()
        {
            if (dataAnalyzeAreaSets.SelectedRows.Count > 0)
            {
                DataGridViewRow s_row            = dataAnalyzeAreaSets.CurrentRow;
                AnalyzeAreaSet  s_analyzeAreaSet = (AnalyzeAreaSet)s_row.DataBoundItem;

                //int selectZ = this._Analyzer.GetZ(s_analyzeAreaSet, scrollT.Value);

                int selectZ = 1;
                for (int z = 1; z <= this._Project.Z; z++)
                {
                    AnalyzeArea aa = s_analyzeAreaSet.GetAnalyzeArea(z, scrollT.Value);
                    if (aa.Enabled)
                    {
                        selectZ = z;
                        break;
                    }
                }

                if (scrollZ.Maximum < selectZ)
                {
                    scrollZ.Maximum = selectZ;
                }
                if (scrollZ.Minimum > selectZ)
                {
                    scrollZ.Minimum = selectZ;
                }
                if (nudZ.Maximum < selectZ)
                {
                    nudZ.Maximum = selectZ;
                }
                if (nudZ.Minimum > selectZ)
                {
                    nudZ.Minimum = selectZ;
                }

                scrollZ.Value = selectZ;
                nudZ.Value    = selectZ;

                //AnalyzeArea analyzeArea = this._GetCurrentAnalyzeArea();
                //nudThreshold.Value = analyzeArea.Threshold;

                scrollZ.Enabled = false;
                nudZ.Enabled    = false;
            }
            else
            {
                scrollZ.Enabled = true;
                nudZ.Enabled    = true;
            }
        }
Пример #2
0
        public int GetZ(AnalyzeAreaSet analyzeAreaSet, int t)
        {
            int targetZ = 1;
            //AnalyzeArea analyzeArea = analyzeAreaSet.GetAnalyzeArea(1, t);
            AnalyzeArea analyzeArea = new AnalyzeArea();

            for (int z = 1; z <= this._Project.Z; z++)
            {
                analyzeArea = analyzeAreaSet.GetAnalyzeArea(z, t);

                if (analyzeArea.Enabled)
                {
                    targetZ = z;
                    break;
                }
            }

            return(targetZ);
        }
Пример #3
0
        public double[] AnalyzeSpot(AnalyzeAreaSet analyzeAreaSet, int t, int threshold)
        {
            int targetZ = 0;
            //AnalyzeArea analyzeArea = analyzeAreaSet.GetAnalyzeArea(1, t);
            AnalyzeArea analyzeArea = new AnalyzeArea();

            for (int z = 1; z <= this._Project.Z; z++)
            {
                analyzeArea = analyzeAreaSet.GetAnalyzeArea(z, t);

                if (analyzeArea.Enabled)
                {
                    targetZ = z;
                    break;
                }
            }

            if (targetZ == 0)
            {
                return(new double[3]);
            }

            double[]   spots         = new double[3];
            MicroImage microImage473 = this.GetMicroImage(targetZ, t, "473");
            MicroImage microImage561 = this.GetMicroImage(targetZ, t, "561");

            //spots[0] = analyzeArea.Count473;
            //spots[1] = analyzeArea.Count561;

            spots[0] = microImage473.AnalyzeSpot(analyzeArea, threshold);
            spots[1] = microImage561.AnalyzeSpot(analyzeArea, threshold);

            //Integrated Density
            spots[2] = microImage473.AnalyzeLuminance(analyzeArea, threshold);

            return(spots);
        }
Пример #4
0
        private AnalyzeArea _GetCurrentAnalyzeArea()
        {
            AnalyzeAreaSet analyzeAreaSet = this._GetCurrentAnalyzeAreaSet();

            return(analyzeAreaSet.GetAnalyzeArea(scrollZ.Value, scrollT.Value));
        }
Пример #5
0
        private void _Render()
        {
            Cursor oldCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            if (this._Analyzer != null)
            {
                menuProjectSave.Enabled   = true;
                menuProjectSaveAs.Enabled = true;
                menuTool.Enabled          = true;

                panel.Enabled = true;

                checkDrawArea.Enabled  = dataAnalyzeAreaSets.SelectedRows.Count > 0 ? true : false;
                checkBinarize.Enabled  = dataAnalyzeAreaSets.SelectedRows.Count > 0 ? true : false;
                buttonAnalyzer.Enabled = dataAnalyzeAreaSets.SelectedRows.Count > 0 ? true : false;
                nudThreshold.Enabled   = dataAnalyzeAreaSets.SelectedRows.Count > 0 ? true : false;

                this._SetTargetValueZ();

                foreach (DataGridViewRow row in dataAnalyzeAreaSets.Rows)
                {
                    if (this._Project.T <= row.Cells.Count)
                    {
                        AnalyzeAreaSet analyzeAreaSet = (AnalyzeAreaSet)row.DataBoundItem;
                        row.HeaderCell.Value = analyzeAreaSet.Name;

                        for (int t = 1; t <= this._Project.T; t++)
                        {
                            int targetZ = 1;
                            for (int z = 1; z <= this._Project.Z; z++)
                            {
                                AnalyzeArea aa = analyzeAreaSet.GetAnalyzeArea(z, t);
                                if (aa.Enabled)
                                {
                                    targetZ = z;
                                    break;
                                }
                            }
                            row.Cells[t - 1].Value = analyzeAreaSet.GetAnalyzeArea(targetZ, t).ToString();
                        }
                    }
                }

                dataAnalyzeAreaSets.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders);

                MicroImage microImage;
                if (radioButtonPic473.Checked)
                {
                    microImage = this._GetCurrentMicroImage("473");
                }
                else
                {
                    microImage = this._GetCurrentMicroImage("561");
                }

                Image image;

                if (checkBinarize.Checked == true)
                {
                    int threshold = (int)nudThreshold.Value;
                    image = microImage.GetBinarizedImage(threshold);
                }
                else
                {
                    image = microImage.GetImage();
                }

                if (checkDrawArea.Checked == true && dataAnalyzeAreaSets.SelectedRows.Count > 0)
                {
                    AnalyzeArea analyzeArea = this._GetCurrentAnalyzeArea();

                    if (analyzeArea.Enabled == true)
                    {
                        Image    tmp = new Bitmap(image.Width, image.Height);
                        Graphics g   = Graphics.FromImage(tmp);
                        g.DrawImage(image, 0, 0, image.Width, image.Height);

                        Pen pen = new Pen(Color.FromArgb(191, Color.LightGray));
                        g.DrawEllipse(
                            pen,
                            analyzeArea.X - analyzeArea.R,
                            analyzeArea.Y - analyzeArea.R,
                            analyzeArea.R * 2,
                            analyzeArea.R * 2
                            );

                        g.Dispose();

                        image = tmp;
                    }
                }

                pictureMicroImage.Image = image;
            }
            else
            {
                menuProjectSave.Enabled   = false;
                menuProjectSaveAs.Enabled = false;
                menuTool.Enabled          = false;
                chartSpot.Visible         = false;
                buttonExportAsCSV.Enabled = false;
                buttonAnalyzer.Enabled    = false;
                nudThreshold.Enabled      = false;

                panel.Enabled = false;
            }

            Cursor.Current   = oldCursor;
            labelStatus.Text = this._Flash;
            this._Flash      = "";
        }