Is MNE the right place to implement eye tracking segmentation algorithms?

MNE already implements many foundational data structures to read eye tracking data from multiple settings (static or dynamic frame, angular coordinates) and offers a good bedrock to implement algorithms to process such data and give it some semantics. Would you be interested about eye tracking segmentation algorithms?

From data measured using an eye tracker (could be a static one, could be smart glasses), we want to segment the time serie into events such as fixation, saccade, smooth pursuit. Once turned into a sequence of events (Epoch in MNE lingo), we can summarize the way those events, category-wise, live in space (e.g. centroids) or time (e.g. time spent in one category of events) and provide meaningful quantities about the gaze behavior as a whole.

In order to get a higher level view of the gaze, we then ā€œtokenizeā€ this sequence of events by merging successive fixations into words of fixation and consider saccades as word separators. In order to process this ā€œsentenceā€, those words of fixation need to be simplified into features about space, time (durations, …), complexity (length, recurrence) or even their relationship to the saccade prior or next to them. Or we can truly tokenize them by mapping those words of fixation to elements of a discrete space and then use string-like algorithms to compare the sentences.

Using that, it is possible to go even higher and try to focus on the zones where the gaze seems to stick around and understand how interested is the viewer to some areas.

The end goal is to extract semantics from the eye tracking data (how do we see, what do we see) and provide simplified representation to help understand, characterize or compare gaze trajectories.

As you can see, segmentation algorithms for eye tracking could be the first stage for those higher level representations that could help either medical staff to easily analyze high-frequency data from their instruments, or reduce the dimension of the time serie prior to feeding it to a ML algorithm running on a embedded device.

Hi Robert,

I think the short answer to whether any single algorithm or method belongs in MNE, is it depends.

I think that generally MNE strives to provide implementations of widely used signal processing techniques (e.g. filtering, ICA), and when implementing a technique, MNE usually choses a very widely adopted algorithm (e.g. the extended-infomax ICA algorithm).

Sometimes, someone wants to implement a method that is relatively new or that they themselves developed, and so they put this in a separate python package with MNE as a dependency (e.g. the PacTools Python package did this). Sometimes these packages end up being used in MNE (e.g. picard).

As far as the eye tracking methods you propose, it sounds like first thing we need to address is adding functionality to annotate blinks/fixations/saccades/pursuits. We have previously discussed adding an algorithm to annotate blinks ( ENH: find_blinks (pupil) by sappelhoff Ā· Pull Request #12946 Ā· mne-tools/mne-python Ā· GitHub ) So I am pretty certain that this would be welcomed! I would start with the blinks case, and then incorporate fixation, saccade, smooth pursuit etc.

After this, I think we would be in a better position to discuss whether we want to add functionality to generate summary statistics, visualizations, segmentation methods etc., and discuss the goals and best API for each.

Thank you for your response, even though I was a little too much forward coming.

  • The external library seems the right approach as I didn’t show any code yet.
  • The algorithms I’m referring to are baseline ones or refinements of them. The ones from https://userweb.cs.txstate.edu/\~ok11/emd_offline.html for instance.
  • Taking a look at blinks is good way to still contribute to MNE and know the code base better. A method for blink detection was suggested and generously explained in comment.

Hi, I’d think that NeuroKit2 would be the right place!

Richard

I’m really interested into knowing why Neurokit2 is better suited as a foundation to those algorithms and if so, where (approx.) to look at to hook them up to it.

MNE has already some support for loading eye tracking data, so I’ll go with MNE first.