public BlobView(ShapeAnalyzer shapeAnalyzer, PoreAnalyzeData data)
 {
     InitializeComponent();
     pictureBox1.Image = data.Bmp;
     listBox1.Items.Add($"Moment invariant 1: {Convert.ToDecimal(data.GeometricMoment1)}");
     listBox1.Items.Add($"Moment invariant 2: {Convert.ToDecimal(data.GeometricMoment2)}");
     listBox1.Items.Add($"Moment invariant 3: {Convert.ToDecimal(data.GeometricMoment3)}");
     listBox1.Items.Add($"Moment invariant 7: {Convert.ToDecimal(data.GeometricMoment7)}");
     listBox1.Items.Add($"Malinowska's coefficient: {Convert.ToDecimal(data.MalinowskasCoefficient)}");
     listBox1.Items.Add($"Area: {Convert.ToDecimal(data.Area)}");
     listBox1.Items.Add($"Shape Id: {shapeAnalyzer.Analyze(data.getShapeDescriptor())}");
 }
        private void aToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ShapeAnalyzerSettingsView form = new ShapeAnalyzerSettingsView(globalSettings);

            if (form.ShowDialog() == DialogResult.OK)
            {
                globalSettings.SimilarityCoefficient = form.SimilarityCoefficient;


                _shapeAnalyzer = new ShapeAnalyzer(_shapeAnalyzer, globalSettings.SimilarityCoefficient);

                _shapeAnalyzer.ShapeCountChange += (s, count) =>
                {
                    setShapeCountLabel(count);
                };
            }
        }
        public Form1(IImageProcessor imageProcessor)
        {
            InitializeComponent();
            _processor = imageProcessor;
            _image     = new Model.Image();
            _image.OnViewImageChange += _image_OnViewImageChange;
            //  pictureBox1.MouseClick += PictureBox1_MouseClick;
            globalSettings = new GlobalSettings();
            _shapeAnalyzer = new ShapeAnalyzer(globalSettings.SimilarityCoefficient);

            _processor.OnStart += (s, blobsNumber) =>
            {
                progressBar.setMaxValue(blobsNumber * 2);
            };

            _processor.OnProgress += (s, ea) =>
            {
                progressBar.Increment(1);
            };

            pictureBox1.MouseMove += (s, a) =>
            {
                if (pictureBox1.Image != null)
                {
                    try
                    {
                        cordsLabel.Text = $"({a.X},{a.Y})";
                        grayLabel.Text  = $"Gray: {_image.ViewImage.GetPixel(a.X, a.Y).R}";
                    }
                    catch (IndexOutOfRangeException ex) { }
                }
            };

            pictureBox1.MouseLeave += (s, a) =>
            {
                cordsLabel.Text = string.Empty;
                grayLabel.Text  = string.Empty;
            };

            this.SizeChanged += Form1_ResizeEnd;

            _shapeAnalyzer.ShapeCountChange += (s, count) =>
            {
                setShapeCountLabel(count);
            };
        }