How dcnieho/glassesviewer works
Main Components
• Main GUI & Entry Point: At the core is the “glassesViewer.m” script that launches the user interface. This component drives the overall workflow from file selection to displaying parsed data.
• Data Parsers: Under “function_library”, you have dedicated parser functions for the two types of recording data:
– TobiiG2DataReader (for Glasses 2 recordings)
– TobiiG3DataReader (for Glasses 3 recordings)
• Data Quality and Signal Processing: Multiple utility functions (e.g., in “function_library/DataQuality” and related functions like “computeDataQuality.m”, “computeRMSnoise.m”, etc.) help process and evaluate the data streams.
• User Functions & Classifiers: In “user_functions”, there are custom implementations and classifiers (like “HesselsEtAl2020” and “HoogeCamps2013”) which process specific aspects of the data (e.g., event detection like fixations, saccades).
• Configuration & Settings: The “defaults.json” file holds default settings that configure how data is read (channels, time windows, plot limits) and how the GUI behaves. This directly maps into the runtime settings structure.
• Demo / Sample Data: The “demo_data” folder holds example projects and recordings that can be loaded to test and demonstrate the application’s functionality.
• Miscellaneous Modules: Other files (e.g., “SDparser”, “extractAllAndGetDataQuality.m”, “user_functions/detPitchRoll”, etc.) contribute supporting functionality such as file parsing, indicator extraction, and video overlay processing for scene videos with gaze data.
Relationships and Interactions
• Initialization and Configuration: The main GUI file (“glassesViewer.m”) reads “defaults.json” and may adjust settings. It then uses the file picker to allow the user to select a particular recording (or project folder from the demo_data structure).
• Data Ingestion: Depending on whether a Glasses 2 or 3 recording is chosen, the viewer invokes either the “readG2DataFiles.m” or “readG3DataFiles.m” function from the function_library. These functions traverse the recording structure (as seen in “demo_data/projects/…”) to read various data files (like calibration, recording, segments, and participant files). Parsed data is then stored in MATLAB files (“livedata.mat” or “gazedata.mat”).
• Signal Processing & Quality Assessments: Once the data is loaded, additional processing happens via the DataQuality functions and various helper utilities (e.g., smoothing filters, timestamp alignment) to prepare a clean dataset for visualization.
• Annotation & Classification: The project supports multiple annotation streams (sync streams, hand-coded events, file-based events, APIevents, and classifier-based events). These are configured through settings (as described extensively in the README) and are implemented via a mix of built-in functions and user functions in “user_functions”. The relationships here include toggling between manual inputs and automated classifier outputs.
• And Export: The GUI displays the parsed data (with separate panels indicated by “settings.plot” for different streams such as azimuth, elevation, velocity, etc.). Export functions allow saving data streams, quality reports, and even scene videos with gaze overlays.
Architectural Patterns and Design Principles
• Modular Design: The project is structured in clear modules (parsers, utility functions, user extensions, GUI script) which follow a flat hierarchy – facilitating maintenance and ease of extension.
• Separation of Concerns: There is a distinct separation between data ingestion (parsing functions), data processing (filtering, quality computations, and user streams), and presentation (GUI functions in “glassesViewer.m” and associated annotation procedures).
• Configurability and Extensibility: The use of an external “defaults.json” and customizable “userStreams” (with both direct script references and classifier functions) ensures that the tool can be tailored to different experiments or analysis pipelines.