Пример #1
0
        public void imageAvailableMain(string filename)
        {
            //Bitmap temp = new Bitmap(filename);
            //mainView.postImageMain(temp);

            ImageAnalysis tempAnalysis = mainAnalyser.analyse(filename); //Move to thread task?

            mainView.postImageMain(tempAnalysis.Result);

            currentGrain = new GrainAnalysis();
            currentGrain.setMain(tempAnalysis);

            string output = "";

            switch (currentState)
            {
            case State.SampleARecord:
                //runSampleA.add(tempAnalysis);
                break;

            case State.SampleBRecord:
                //runSampleB.add(tempAnalysis);
                break;

            case State.DataRecord:
                //currentRun.add(tempAnalysis);
                break;

            case State.Idle:
                break;
            }


            output += "Main| C=(" + (int)tempAnalysis.Center.X + "px," + (int)tempAnalysis.Center.Y + "px), ";
            output += "A=" + (int)tempAnalysis.Area + ", W=" + (int)tempAnalysis.Width + ", L=" + (int)tempAnalysis.Length + ", R=1:" + tempAnalysis.Ratio;
            mainView.displayData(output);
        }
Пример #2
0
        public void imageAvailableSide(string filename)
        {
            //Bitmap temp = new Bitmap(filename);
            //mainView.postImageSide(temp);

            ImageAnalysis tempAnalysis2 = sideAnalyser.analyse(filename);

            mainView.postImageSide(tempAnalysis2.Result);

            string output = "Side| C=(" + (int)tempAnalysis2.Center.X + "px," + (int)tempAnalysis2.Center.Y + "px), ";

            output += "A=" + (int)tempAnalysis2.Area + ", W=" + (int)tempAnalysis2.Width + ", L=" + (int)tempAnalysis2.Length + ", R=1:" + tempAnalysis2.Ratio;

            mainView.displayData(output);

            if (currentGrain != null)
            {
                currentGrain.setSide(tempAnalysis2);
                currentGrain.analyse();

                switch (currentState)
                {
                case State.SampleARecord:
                    //runSampleA.add(tempAnalysis);
                    runSampleA.add(currentGrain);
                    break;

                case State.SampleBRecord:
                    //runSampleB.add(tempAnalysis);
                    runSampleB.add(currentGrain);
                    break;

                case State.DataRecord:
                    //currentRun.add(tempAnalysis);
                    currentRun.add(currentGrain);
                    int length = currentRun.totalLength();
                    mainView.displayLength(length);
                    break;

                case State.Idle:
                    break;
                }


                output = "Grain| L=" + currentGrain.Length + ", W=" + currentGrain.Width + ", D=" + currentGrain.Depth + ", V=" + currentGrain.Volume;
                mainView.displayData(output);

                if (sort)
                {
                    if (rejectAboveThreshold)
                    {
                        if (currentGrain.Volume > threshold)
                        {
                            //reject
                            mainView.displayData("Reject!");
                            System.Media.SystemSounds.Asterisk.Play();
                        }
                    }
                    else
                    {
                        if (currentGrain.Volume < threshold)
                        {
                            //reject
                            mainView.displayData("Reject!");
                            System.Media.SystemSounds.Asterisk.Play();
                        }
                    }
                }

                currentGrain = null;
            }
        }
Пример #3
0
 public void add(GrainAnalysis ia)
 {
     store.Add(ia);
 }