Ejemplo n.º 1
0
        public Tracker(GTCommands commands)
        {
            this.commands       = commands;
            detectionManager    = new DetectionManager();
            calibration         = new Calibration.Calibration();
            recalibration       = new Recalibration();
            eyeMovement         = new Classifier();
            exponentialSmoother = new ExponentialSmoother(20, 0, (int)Math.Ceiling(GTSettings.Current.Processing.SmoothLevel / 5.0));
            visualization       = new Visualization();
            server                         = new UDPServer();
            gazeDataRaw                    = new GTGazeData();
            gazeDataSmoothed               = new GTGazeData();
            processingDone                 = true;
            timerCalibrationDelay          = new DispatcherTimer();
            timerCalibrationDelay.Interval = TimeSpan.FromMilliseconds(calibrationDelayMilliseconds);
            timerCalibrationDelay.Tick    += TimerCalibrationTick;
            logGaze                        = new Logger();
            logGaze.Server                 = server; // Used to send messages back to client (log start/stop etc.)
            logGaze.IsEnabled              = GTSettings.Current.FileSettings.LoggingEnabled;

            recalibration.RecalibrationAvailable += new Recalibration.RecalibrationAvailableHandler(recalibration_RecalibrationAvailable);
            //recalibration.OnRecalibrationAvailable +=new Recalibration.RecalibrationAvailable(recalibration_OnRecalibrationAvailable);
            GTSettings.Current.Processing.PropertyChanged += ProcessingSettingsPropertyChanged;
            timerCalibrationDelay.Tick += TimerCalibrationTick;
            CameraControl.Instance.FrameCaptureComplete += Camera_FrameCaptureComplete;
        }
Ejemplo n.º 2
0
 private void btnCalib_Click(object sender, EventArgs e)
 {
     ThreadManager.CreateThread(link =>
     {
         link.Name = "Calibration";
         Recalibration.Calibration();
     }).StartThread();
 }
Ejemplo n.º 3
0
 private void btnCalib_Click(object sender, System.EventArgs e)
 {
     ThreadManager.CreateThread(link =>
     {
         link.Name = "Calibration";
         Recalibration.Calibration();
         picCalibration.InvokeAuto(() => picCalibration.Image = Properties.Resources.ValidOk96);
         CalibrationDone?.Invoke();
     }).StartThread();
     btnTrap.Focus();
 }
Ejemplo n.º 4
0
        private Tracker(GTCommands commands)
        {
            log.Info("Constructing Tracker...");
            this.commands       = commands;
            detectionManager    = new DetectionManager();
            calibration         = new Calibration.Calibration();
            recalibration       = new Recalibration();
            eyeMovement         = new Classifier();
            exponentialSmoother = new ExponentialSmoother(Settings.Instance.EyeMovement.SmoothNumberOfSamples, 0, (int)Math.Ceiling(Settings.Instance.EyeMovement.SmoothLevel / 5.0));
            visualization       = new Visualization();
            server                         = new UDPServer();
            gazeDataRaw                    = new GTGazeData();
            gazeDataSmoothed               = new GTGazeData();
            gazeDazaExtended               = new GTExtendedData();
            processingDone                 = true;
            timerCalibrationDelay          = new DispatcherTimer();
            timerCalibrationDelay.Interval = TimeSpan.FromMilliseconds(calibrationDelayMilliseconds);
            timerCalibrationDelay.Tick    += TimerCalibrationTick;
            logGaze                        = new Logger();
            logGaze.Server                 = server; // Used to send messages back to client (log start/stop etc.)
            log.Info("Looking up LoggingEnabled in FileSettings");
            logGaze.IsEnabled = Settings.Instance.FileSettings.LoggingEnabled;

            log.Info("Setting RecalibrationAvailableHandler");
            recalibration.RecalibrationAvailable += new Recalibration.RecalibrationAvailableHandler(recalibration_RecalibrationAvailable);
            //recalibration.OnRecalibrationAvailable +=new Recalibration.RecalibrationAvailable(recalibration_OnRecalibrationAvailable);
            Settings.Instance.Processing.PropertyChanged += ProcessingSettingsPropertyChanged;
            timerCalibrationDelay.Tick += TimerCalibrationTick;

            if (GTHardware.Camera.Instance.Device != null)
            {
                log.Info("Setting GTHardware device OnImage EventHandler");
                GTHardware.Camera.Instance.Device.OnImage += new EventHandler <GTHardware.Cameras.ImageEventArgs>(Device_OnImage);
            }
            string sDate = DateTime.Now.ToString();

            sDate = sDate.Replace(" ", "");
            sDate = sDate.Replace("/", "");
            sDate = sDate.Replace(":", "");

            log.Info("Completed constructing Tracker");

            fileName2 = "c:\\temp\\log" + sDate + ".csv";
            appendToFile(fileName2, "TimeStamp;GazeX;GazeY;DiameterLeftPupil;DiameterRightPupil");

            /*fileName = "c:\\temp\\log" + sDate + ".arff";
             * appendToFile(fileName, "@relation 'logeye'");
             * appendToFile(fileName, "@attribute TimeStamp real");
             * appendToFile(fileName, "@attribute GazeX real");
             * appendToFile(fileName, "@attribute GazeY real");
             * appendToFile(fileName, "@attribute DiameterLeftPupil real");
             * appendToFile(fileName, "@attribute DiameterRightPupil real");
             * appendToFile(fileName, "@data");*/
        }
Ejemplo n.º 5
0
 private void btnRestartRecal_Click(object sender, EventArgs e)
 {
     ThreadManager.CreateThread(link =>
     {
         link.Name = "GoToCalibration";
         if (Recalibration.GoToCalibration())
         {
             Recalibration.Calibration();
         }
     }).StartThread();
 }
Ejemplo n.º 6
0
        public void RecalibrateTest()
        {
            var vcfPath        = Path.Combine(TestPaths.LocalTestDataDirectory, "testData.PairRealigned.genome.vcf");
            var expectedPath   = Path.Combine(TestPaths.LocalTestDataDirectory, "testData.PairRealigned.genome.model");
            var vcfOutTestFile = Path.Combine(TestPaths.LocalTestDataDirectory, "testData.PairRealigned.recal.vcf");
            var outPath        = TestPaths.LocalScratchDirectory;
            var vcfOutFile     = Path.Combine(outPath, "testData.PairRealigned.recal.vcf");

            var options = new AdaptiveGtOptions
            {
                VcfPath         = vcfPath,
                OutputDirectory = outPath
            };
            Recalibration recal = new Recalibration(options);

            recal.Recalibrate();

            // Check model file
            var outFile = Path.Combine(outPath, "testData.PairRealigned.genome.model");

            TestHelper.CompareFiles(outFile, expectedPath);

            // Check vcf file
            Assert.True(File.Exists(vcfOutFile));
            CompareVariants.AssertSameVariants_QScoreAgnostic(vcfOutFile, vcfOutTestFile);

            File.Delete(vcfOutFile);

            // Use model to generate vcf and check file
            recal = new Recalibration(options);
            recal.Recalibrate();

            Assert.True(File.Exists(vcfOutFile));
            CompareVariants.AssertSameVariants_QScoreAgnostic(vcfOutFile, vcfOutTestFile);

            File.Delete(outFile);
            File.Delete(vcfOutFile);
        }
Ejemplo n.º 7
0
        private Tracker(GTCommands commands)
        {
            log.Info("Constructing Tracker...");
            this.commands       = commands;
            detectionManager    = new DetectionManager();
            calibration         = new Calibration.Calibration();
            recalibration       = new Recalibration();
            eyeMovement         = new Classifier();
            exponentialSmoother = new ExponentialSmoother(Settings.Instance.EyeMovement.SmoothNumberOfSamples, 0, (int)Math.Ceiling(Settings.Instance.EyeMovement.SmoothLevel / 5.0));
            visualization       = new Visualization();
            server                         = new UDPServer();
            gazeDataRaw                    = new GTGazeData();
            gazeDataSmoothed               = new GTGazeData();
            gazeDazaExtended               = new GTExtendedData();
            processingDone                 = true;
            timerCalibrationDelay          = new DispatcherTimer();
            timerCalibrationDelay.Interval = TimeSpan.FromMilliseconds(calibrationDelayMilliseconds);
            timerCalibrationDelay.Tick    += TimerCalibrationTick;
            logGaze                        = new Logger();
            logGaze.Server                 = server; // Used to send messages back to client (log start/stop etc.)
            log.Info("Looking up LoggingEnabled in FileSettings");
            logGaze.IsEnabled = Settings.Instance.FileSettings.LoggingEnabled;

            log.Info("Setting RecalibrationAvailableHandler");
            recalibration.RecalibrationAvailable += new Recalibration.RecalibrationAvailableHandler(recalibration_RecalibrationAvailable);
            //recalibration.OnRecalibrationAvailable +=new Recalibration.RecalibrationAvailable(recalibration_OnRecalibrationAvailable);
            Settings.Instance.Processing.PropertyChanged += ProcessingSettingsPropertyChanged;
            timerCalibrationDelay.Tick += TimerCalibrationTick;

            if (GTHardware.Camera.Instance.Device != null)
            {
                log.Info("Setting GTHardware device OnImage EventHandler");
                GTHardware.Camera.Instance.Device.OnImage += new EventHandler <GTHardware.Cameras.ImageEventArgs>(Device_OnImage);
            }

            log.Info("Completed constructing Tracker");
        }