Ejemplo n.º 1
0
        // This window will work as the link between the capture processes and the analysis processes

        public AnalysisWindow(CaptureWindow cw, bool countAnalysis, bool classAnalysis, string map, string folder)
        {
            InitializeComponent();

            this.Width  = 1200;
            this.Height = 900;

            if (countAnalysis)
            {
                countPage = new CountAnalytics(this); chartPage = new ChartPage();
            }
            if (classAnalysis)
            {
                clssPage = new ClassifyAnalytics(); if (map.Length > 1)
                {
                    clssPage.Init(map, countPage);
                }
            }

            pick = new Picker(cw, countAnalysis, classAnalysis, clssPage, countPage, chartPage, folder);

            Navigate(pick);

            closeRequest = false;

            captureWindow = cw;
        }
Ejemplo n.º 2
0
 // @Override Task Constructor
 public Task()
 {
     captureWindow    = null;
     numberOfCaptures = 0;
     interval         = 0;
     index            = 0;
     delay            = 0;
 }
Ejemplo n.º 3
0
 // Constructor
 public Task(CaptureWindow cw, int nOfC, int inter, int ind, int dl, List <Uri> cpt, string f)
 {
     captureWindow    = cw;
     numberOfCaptures = nOfC;
     interval         = inter;
     index            = ind;
     captures         = cpt;
     delay            = dl;
     folder           = f;
 }
Ejemplo n.º 4
0
 // @Override Task Constructor
 public Task()
 {
     captureWindow    = null;
     numberOfCaptures = 0;
     interval         = 0;
     index            = 0;
     delay            = 0;
     name             = "";
     location         = null;
     size             = new System.Drawing.Point();
 }
Ejemplo n.º 5
0
 // Constructor
 public Task(CaptureWindow cw, int nOfC, int inter, int ind, int dl, List <Uri> cpt, string f, bool count, bool classAn, string n, PcPhysicalPoint loc, System.Drawing.Point s)
 {
     captureWindow    = cw;
     numberOfCaptures = nOfC;
     interval         = inter;
     index            = ind;
     captures         = cpt;
     delay            = dl;
     folder           = f;
     countAnalysis    = count;
     classAnalysis    = classAn;
     name             = n;
     location         = loc;
     size             = s;
 }
Ejemplo n.º 6
0
        // UI initialization with a link to every analysis related interface

        public Picker(CaptureWindow cw, bool count, bool classAn, ClassifyAnalytics clss, CountAnalytics cnt, ChartPage chp, string folder)
        {
            InitializeComponent();

            captureWindow = cw;
            countAnalysis = count;
            classAnalysis = classAn;

            Logo_Init();

            Panel_Logic_Init();

            clssPage  = clss;
            countPage = cnt;

            chartPage = chp;

            saveFolder = folder;
        }
Ejemplo n.º 7
0
        // As long as the parameter "playing" is active in Capture Window, this thread will trigger the function CaptureWindow.showNextCapture at a
        // speed rate given by the mentioned window

        public void StartHandler(object param)
        {
            CaptureWindow cw = (CaptureWindow)param;

            Thread.Sleep(1000);

            while (true)
            {
                if (!cw.playing)
                {
                    return;
                }
                else
                {
                    App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background,
                                                       new Action(() => cw.showNextCapture()));

                    Thread.Sleep((int)(cw.speed * 1000));
                }
            }
        }
Ejemplo n.º 8
0
        // In each step, colony tracking is performed by comparing the current taken image with the
        // first one (serving as background) and the last one in the look for changes

        public void newStep(object param)
        {
            while (analysisInProgress)
            {
                Thread.Sleep(1000);
            }

            analysisInProgress = true;

            object[] objects = (object[])param;

            System.Drawing.Bitmap bmp = (System.Drawing.Bitmap)objects[0];
            CaptureWindow         cw  = (CaptureWindow)objects[1];

            Tracking_Images.Add(bmp);
            Tracking_Images[Tracking_Images.Count - 1].Tag = DateTime.Now.ToString("hh:mm:ss");

            // Firstly we will find the best matching repositioning to the images by selecting the one that minimizes the edges difference
            // This is needed because of the Sprout's image acquisition impresition, which leads to minor mismatches between the same object's captures

            int[] positions = Matching_Robinson.RobinsonRepositioning(background, bmp);

            // Once the reposition is calculated, a difference between the taken image and the background is performed
            // For this difference, Manhattan difference computation has been used. However, Eucliedean distance computation and
            // Pearson's correlation index difference computation functions are included in the code and ready to be used.

            Map resultDifference = DifferenceComputation.getManhattan(background, bmp, positions);

            // A cluster search is computed

            List <Cluster> frameBlobs = FindObjects(resultDifference, DateTime.Now.ToString("hh:mm:ss"));

            // If this is the first tracking step made, the found clusters are set as base ones,
            // otherwise a tracking algorithm trying to match current clusters with already monitored ones is performed

            if (track.isEmpty())
            {
                track.firstScan(frameBlobs, step); events = new int[0];
            }
            else
            {
                events = track.assignBlobs(frameBlobs, step);
            }

            events = checkBounds(events, track.getLast(), bmp);

            if (aw.getPicker().classAnalysis&& !aw.getClass().hasError())
            {
                aw.getClass().newStep(track.getLast(), bmp);

                App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.ApplicationIdle,
                                                   new Action(() => cw.processClassification()));
            }

            step++;

            App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.ApplicationIdle,
                                               new Action(() => cw.processEvents()));

            analysisInProgress = false;
        }
Ejemplo n.º 9
0
 public void setCaptureWindow(CaptureWindow cp)
 {
     this.captureWindow = cp;
 }
Ejemplo n.º 10
0
 public Tuple(CaptureWindow cp, int[] param)
 {
     captureWindow = cp;
     parameters    = param;
 }