Beispiel #1
0
        private double NumberOfScans(List <Saccade> saccades)
        {
            Wordbook saccadeBook = new Wordbook(saccades);
            AtomBook atomBook    = new AtomBook(saccadeBook);

            return(atomBook.NumberOfScans);
        }
        public void WriteInstacesForSlicesToFile(List <Slice> slices, int sliceTime, StreamWriter writer, string className)
        {
            foreach (Slice slice in slices)
            {
                Wordbook saccadeBook = new Wordbook(slice.saccades);
                AtomBook atomBook    = new AtomBook(saccadeBook);
                FeatureExtractionWindow.patterns = atomBook;

                foreach (var extractor in extractors)
                {
                    switch (extractor.DataType())
                    {
                    case FeatureExtractionWindow.RequiredData.Fixation:
                        var fixationExtractor = extractor as FeatureExtractionWindow.FixationFeatureExtractor;
                        writer.Write(fixationExtractor.action(slice.fixations) + ", ");
                        break;

                    case FeatureExtractionWindow.RequiredData.Saccade:
                        var saccadeExtractor = extractor as FeatureExtractionWindow.SaccadeFeatureExtractor;
                        writer.Write(saccadeExtractor.action(slice.saccades) + ", ");
                        break;
                    }
                }

                writer.Write(className);
                writer.Write("\n");
                writer.Flush();
            }
        }
Beispiel #3
0
        // Finding and showing ATOMS

        private void localAlignmentButton_Click(object sender, RoutedEventArgs e)
        {
            Wordbook saccadeBook = new Wordbook(calculatedSaccades);
            AtomBook atomBook    = new AtomBook(saccadeBook);

            MessageBox.Show(atomBook.NumberOfScans.ToString());
        }
Beispiel #4
0
        private double NumberOfHoldFixations(List <Fixation> fixations)
        {
            Wordbook fixationBook = new Wordbook(fixations);

            double numberOfHolds = fixationBook.fixationTokens.Aggregate(0, (acc, next) => next == EyeTrackingCore.Token.Hold ? acc + 1 : acc);

            return(numberOfHolds);
        }
Beispiel #5
0
        private void DrawNextAtom(AtomType type)
        {
            Wordbook saccadeBook = new Wordbook(calculatedSaccades);
            AtomBook atomBook    = new AtomBook(saccadeBook);

            List <Atom> mediumLines = atomBook.atoms[type];

            if (current < mediumLines.Count)
            {
                RemoveLabels();
                RemoveFixationCircles();
                RemoveSaccades();
                DrawSaccades(mediumLines[current++].saccades);
            }
            else
            {
                current = 0;
            }
        }
Beispiel #6
0
        private void showBookCountsButton_Click(object sender, RoutedEventArgs e)
        {
            Wordbook saccadeBook = new Wordbook(calculatedSaccades);

            MessageBox.Show(saccadeBook.SaccadeBook);

            string book       = saccadeBook.SaccadeBook;
            int    windowSize = 4; // 4 directions in a row, eg, SrSrSrLl


            Dictionary <string, int> counts = new Dictionary <string, int>();

            for (int i = 0; i < book.Length - windowSize * 2; i += 2)
            {
                string current = book.Substring(i, windowSize * 2);

                if (counts.ContainsKey(current))
                {
                    // the segment has already been seen, just increment.
                    int currentCount = counts[current];
                    counts[current] = ++currentCount;
                }
                else
                {
                    // the segment hasnt been seen, set it to 1.
                    counts[current] = 1;
                }
            }

            var countsList = counts.ToList();

            countsList.Sort((pair1, pair2) => pair1.Value.CompareTo(pair2.Value));

            foreach (KeyValuePair <string, int> kvp in countsList)
            {
                Console.WriteLine(String.Format("{0}:{1}", kvp.Key, kvp.Value));
            }
        }
Beispiel #7
0
        private void showBookButton_Click(object sender, RoutedEventArgs e)
        {
            Wordbook wordbook = new Wordbook(calculatedFixations, calculatedSaccades);

            // Testing wordbooks.
            Wordbook saccadeBook = new Wordbook(calculatedSaccades);

            MessageBox.Show(saccadeBook.SaccadeBook);

            Wordbook fixationBook = new Wordbook(calculatedFixations);

            MessageBox.Show(fixationBook.FixationBook);

            MessageBox.Show(fixationBook.VSLocationBook);

            double numberOfBriefs = fixationBook.fixationTokens.Aggregate(0, (acc, next) => next == EyeTrackingCore.Token.Brief ? acc + 1 : acc);
            double numberOfHolds  = fixationBook.fixationTokens.Aggregate(0, (acc, next) => next == EyeTrackingCore.Token.Hold ? acc + 1 : acc);

            MessageBox.Show((numberOfBriefs / numberOfHolds).ToString());

            foreach (KeyValuePair <string, int> keyValuePair in saccadeBook.SortedSaccadeWordCount(4))
            {
                Console.Write(keyValuePair.Key + ": ");
                Console.WriteLine(keyValuePair.Value);
            }

            foreach (KeyValuePair <string, int> keyValuePair in fixationBook.SortedFixationWordCount(4))
            {
                Console.Write(keyValuePair.Key + ": ");
                Console.WriteLine(keyValuePair.Value);
            }

            foreach (KeyValuePair <string, int> keyValuePair in fixationBook.SortedLocationWordCount(4))
            {
                Console.Write(keyValuePair.Key + ": ");
                Console.WriteLine(keyValuePair.Value);
            }
        }