Skip to main content

Interface for streaming and receiving Tobii eye tracker data using Lab Streaming Layer

Project description

Downloads PyPI Latest Release image

TittaLSL

The TittaLSL tool is an extension to Titta (and its TittaMex and TittaPy wrappers). It allows to stream data from Tobii eye trackers in Titta's format using Lab Streaming Layer and to receive such data and access it through an API that is identical to that of Titta. That allows handling local and remote eye tracker data sources in a uniform manner, making it possible to design interesting experiments using multiple eye trackers.

TittaLSL is a C++ library that can be compiled and used as a static library without Matlab/Octave or Python. However, MATLAB and Python wrappers are also provided in the form of TittaLSLMex and TittaLSLPy, respectively.

In comparison to the the Lab Streaming Layer TobiiPro Connector, Titta LSL provides access to all gaze data fields instead of only gaze position on the screen, as well as the external signal, time synchronization and positioning streams. Samples are furthermore properly timestamped using the timestamps from the eye tracker, where possible (all streams except for the positioning stream, which doesn't have timestamps).

The TittaLSL, TittaLSLMex and TittaLSLPy classes

The functionality of TittaLSL is divided over two classes, Sender for making eye tracker data available on the network (AKA an outlet in Lab Streaming Layer terminology) and Receiver for recording from TittaLSL data streams available on the network (AKA an inlet). The below documents the available methods of these classes. The functionality below is exposed under the same names in MATLAB as TittaLSL.Sender and TittaLSL.Receiver, respectively. The same functionality is also available from TittaLSLPy.Sender and TittaLSLPy.Receiver instances, but in that case all function and property names as well as stream names use snake_case names instead of camelCase. In C++ all below functions and classes are in the TittaLSL namespace. See here for example C++ code using the library, and here for example Python code.

Free functions

Call Inputs Outputs Description
getTobiiSDKVersion()
  1. SDKVersion: A string containing the version of the Tobii SDK.
Get the version of the Tobii Pro SDK dynamic library that is used by TittaLSL.
getLSLVersion()
  1. LSLVersion: An int32 scalar denoting the version of Lab Streaming Layer.
Get the version of the Lab Streaming Layer dynamic library that is used by TittaLSL.

Construction and initialization

Call Inputs Notes
TittaLSL::Sender() (C++)
TittaLSL.Sender() (MATLAB)
TittaLSLPy.Sender (Python)
  1. address: address of the eye tracker to be made available on the network. A list of connected eye trackers and their addresses can be using the static function Titta.findAllEyeTrackers() in the Titta library.
TittaLSL::Receiver() (C++)
TittaLSL.Receiver() (MATLAB)
TittaLSLPy.Receiver (Python)
  1. streamSourceID: Source ID of LSL stream to record from. Must be a TittaLSL stream.
  2. initialBufferSize: (optional) value indicating for how many samples memory should be allocated.
  3. doStartRecording: (optional) value indicating whether recording from the stream should immediately be started.
The default initial buffer size should cover about 30 minutes of recording gaze data at 600Hz, and longer for the other streams. Growth of the buffer should cause no performance impact at all as it happens on a separate thread. To be certain, you can indicate a buffer size that is sufficient for the number of samples that you expect to record. Note that all buffers are fully in-memory. As such, ensure that the computer has enough memory to satify your needs, or you risk a recording-destroying crash.

Methods

The following method calls are available on a TittaLSL.Sender instance:

Call Inputs Outputs Description
getEyeTracker()
  1. eyeTracker: information about the eyeTracker that TittaLSL is connected to.
Get information about the eye tracker that the TittaLSL instance is connected to and will stream data from.
start()
  1. stream: a string, possible values: gaze, externalSignal, timeSync and positioning.
  1. success: a boolean indicating whether sending of the stream was started. May be false if sending was already started.
Start providing data of a specified type on the network.
setIncludeEyeOpennessInGaze()
  1. include: a boolean, indicating whether eye openness samples should be provided in the sent gaze stream or not. Default false.
Set whether calls to start or stop providing the gaze stream will include data from the eye openness stream. An error will be raised if set to true, but the connected eye tracker does not provide an eye openness stream.
isStreaming()
  1. stream: a string, possible values: gaze, externalSignal, timeSync and positioning.
  1. streaming: a boolean indicating whether the indicated stream type is being made available on the network.
Check whether the specified stream type from the connected eye tracker is being made available on the network.
stop()
  1. stream: a string, possible values: gaze, externalSignal, timeSync and positioning.
Stop providing data of a specified type on the network.

The following static calls are available for TittaLSL.Receiver:

Call Inputs Outputs Description
GetStreams()
  1. stream: (optional) string, possible values: gaze, externalSignal, timeSync and positioning. If provided, only streams of this type are discovered on the network.
  1. streamInfoList: list of objects containing info about discovered streams.
Discover what TittaLSL streams are available on the network.

The following method calls are available on a TittaLSL.Receiver instance. Note that samples provided by the consume*() and peek*() functions are almost identical to those provided by their namesakes in Titta for a local eye tracker. The only difference is that the samples provided by TittaLSL have two extra fields, remoteSystemTimeStamp and localSystemTimeStamp. remoteSystemTimeStamp is the timestamp as provided by the Tobii SDK on the system where the eye tracker is connected. localSystemTimeStamp is the same timestamp, but expressed in the clock of the receiving machine. This local time is computed by using the offset provided by Lab Streaming Layer's time_correction function for the stream that the receiver is connected to. See the Tobii SDK documentation for a description of the other fields.

Call Inputs Outputs Description
getInfo()
  1. info: object containing info about the remote stream.
Get info about the connected remote stream.
getType()
  1. stream: a stream indicating what type of data this remote source provides. Possible values: gaze, externalSignal, timeSync and positioning.
Get data type provided by the remote stream.
start() Start recording data from this remote stream to buffer.
isRecording()
  1. status: a boolean indicating whether data of the indicated type is currently being recorded to the buffer.
Check if data from this remote stream is being recorded to buffer.
consumeN()
  1. N: (optional) number of samples to consume from the start of the buffer. Defaults to all.
  2. side: a string, possible values: first and last. Indicates from which side of the buffer to consume N samples. Default: first.
  1. data: struct containing data from the requested buffer, if available. If not available, an empty struct is returned.
Return and remove data from the buffer. See the Tobii SDK documentation for a description of the fields.
consumeTimeRange()
  1. startT: (optional) timestamp indicating start of interval for which to return data. Defaults to start of buffer.
  2. endT: (optional) timestamp indicating end of interval for which to return data. Defaults to end of buffer.
  3. timeIsLocalTime: (optional) boolean value indicating whether time provided startT and endT parameters are in local system time (true, default) or remote time (false).
  1. data: struct containing data from the requested buffer in the indicated time range, if available. If not available, an empty struct is returned.
Return and remove data from the buffer. See the Tobii SDK documentation for a description of the fields.
peekN()
  1. N: (optional) number of samples to peek from the end of the buffer. Defaults to 1.
  2. side: a string, possible values: first and last. Indicates from which side of the buffer to peek N samples. Default: last.
  1. data: struct containing data from the requested buffer, if available. If not available, an empty struct is returned.
Return but do not remove data from the buffer. See the Tobii SDK documentation for a description of the fields.
peekTimeRange()
  1. startT: (optional) timestamp indicating start of interval for which to return data. Defaults to start of buffer.
  2. endT: (optional) timestamp indicating end of interval for which to return data. Defaults to end of buffer.
  3. timeIsLocalTime: (optional) boolean value indicating whether time provided startT and endT parameters are in local system time (true, default) or remote time (false).
  1. data: struct containing data from the requested buffer in the indicated time range, if available. If not available, an empty struct is returned.
Return but do not remove data from the buffer. See the Tobii SDK documentation for a description of the fields.
clear() Clear the buffer.
clearTimeRange()
  1. startT: (optional) timestamp indicating start of interval for which to clear data. Defaults to start of buffer.
  2. endT: (optional) timestamp indicating end of interval for which to clear data. Defaults to end of buffer.
  3. timeIsLocalTime: (optional) boolean value indicating whether time provided startT and endT parameters are in local system time (true, default) or remote time (false).
Clear data within specified time range from the buffer.
stop()
  1. doClearBuffer: (optional) boolean indicating whether the buffer of the indicated stream type should be cleared.
Stop recording data from this remote stream to buffer.

Working on the source

The enclosed Visual Studio project files can be opened using the Titta.sln file in the SDK_wrapper directory. It is to be opened and built with Visual Studio 2022 (last tested with version 17.8.4).

Building the mex files

Run makeTittaLSLMex.m to build the mex file.

For building the Linux mex file the default gcc version 11.2.0 included with Ubuntu 22.04 was used. For compatibility with an earlier version of Ubuntu, either install the right GLIBCXX version or recompile following the instructions here. See this issue for more information.

Required environment variables

Some environment variables must be set when working on the code or building it from Visual Studio. Here are the values i used (at the time of writing):

  • MATLAB_ROOT: C:\Program Files\MATLAB\R2023b
  • PYTHON_ROOT: C:\Program Files\PsychoPy

Dependencies

Lab Streaming Layer library

To update the Lab Streaming Layer library used to build TittaLSL against, you need to manually put the some files in the right place:

  1. The *.h include files are placed in \LSL_streamer\deps\include
  2. The Windows lsl.lib link library is placed in \LSL_streamer\deps\lib.
  3. The *.dll, *.so and *.dylib files are placed in the output directory, \LSL_streamer\TittaLSLMex\+TittaLSL\+detail.

Titta

TittaLSL also requires Titta and its dependencies to build. The build scripts are set up such that Titta is automatically built. However, ensure to check Titta's dependencies and make sure they are available, or the build will fail.

Acknowledgements

This project was made possible by funding from the LMK foundation, Sweden.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

TittaLSLPy-1.3.2-cp313-cp313-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.13 Windows x86-64

TittaLSLPy-1.3.2-cp313-cp313-manylinux_2_28_x86_64.whl (7.5 MB view details)

Uploaded CPython 3.13 manylinux: glibc 2.28+ x86-64

TittaLSLPy-1.3.2-cp313-cp313-macosx_12_0_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.13 macOS 12.0+ x86-64

TittaLSLPy-1.3.2-cp312-cp312-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.12 Windows x86-64

TittaLSLPy-1.3.2-cp312-cp312-manylinux_2_28_x86_64.whl (7.5 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ x86-64

TittaLSLPy-1.3.2-cp312-cp312-macosx_12_0_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.12 macOS 12.0+ x86-64

TittaLSLPy-1.3.2-cp311-cp311-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.11 Windows x86-64

TittaLSLPy-1.3.2-cp311-cp311-manylinux_2_28_x86_64.whl (7.5 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

TittaLSLPy-1.3.2-cp311-cp311-macosx_12_0_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.11 macOS 12.0+ x86-64

TittaLSLPy-1.3.2-cp310-cp310-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.10 Windows x86-64

TittaLSLPy-1.3.2-cp310-cp310-manylinux_2_28_x86_64.whl (7.5 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

TittaLSLPy-1.3.2-cp310-cp310-macosx_12_0_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.10 macOS 12.0+ x86-64

TittaLSLPy-1.3.2-cp39-cp39-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.9 Windows x86-64

TittaLSLPy-1.3.2-cp39-cp39-manylinux_2_28_x86_64.whl (7.5 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

TittaLSLPy-1.3.2-cp39-cp39-macosx_12_0_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.9 macOS 12.0+ x86-64

TittaLSLPy-1.3.2-cp38-cp38-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.8 Windows x86-64

TittaLSLPy-1.3.2-cp38-cp38-manylinux_2_28_x86_64.whl (7.5 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

TittaLSLPy-1.3.2-cp38-cp38-macosx_12_0_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.8 macOS 12.0+ x86-64

File details

Details for the file TittaLSLPy-1.3.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8e7a6e3ce3d8b8df62212013b19d402f2d7c334f1ccdfdb213f773901acb80b7
MD5 306ac3293e0e1a57018fe46c40139b9a
BLAKE2b-256 45e7d98256376d95da9781e92c650742443d9bd0f39dd7b2512efd6fad3ab96b

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8ce4c55f90bef5d9bffbe172b75afade53bef3cb5fcbbed75f32583eb92a407e
MD5 712a6fdd13b2169f27a5fc78f9b55d87
BLAKE2b-256 e8980bfa2ad161e68b08cb3b1c3dc34f6965ce85a76915db3db867936ddab506

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp313-cp313-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp313-cp313-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 9b24396fc5fc0c4c560e1eeea813f03973b4ff844fcae30dd92cb072c2353d95
MD5 0993f12af57300eb0b4c697a21336bd4
BLAKE2b-256 cd708053eea1b3c9754ec30ccd24515f4a99e86a5fffa9eec47b344d546d91a4

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9fe3cda1f9688a95168cbc37bb4ec7d4d04c8202b3caf95c3e7411e498efe5fe
MD5 5f6134e7cd2d7a81ba83ca8bd67b8830
BLAKE2b-256 24738d0b5a9041e43722a8f65900898fe603ebee89ae4ec36a5f20df4a00e8bb

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d8f6368a0ff0ae81df4b249ba0d1675b506477db4becea68a5fac897831d5e5d
MD5 ea578047f1434d5639d75ee5ae6b8a8f
BLAKE2b-256 3578f9bfde588e90db2f4fd623c694dc349bd930dbed2eaba4423f552dbf7d40

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp312-cp312-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp312-cp312-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 60d240a69abce8d93cd8d5092c4f13939ef2128a983264ccdf4b1fc6d5603cf6
MD5 51176e3d7c19295c052dbe410bdf8b08
BLAKE2b-256 960f0c9b4248fdd4f0894e776b853647c1f8808190722a3ed4abf73747f6e2da

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 30976cbb0901ae0559403c394b1597738303e9bc4592a96f6482d6287606a44e
MD5 363f8e2f466317b07b98c4c47664f070
BLAKE2b-256 ccaa18cbb15a8baf7a56f84cbf8193bf6a804cad547b8816bfc8cb549a204ca9

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 788a94a5d66bab3927120dc725904ba9367b3a11775ba09980dc887ac1c4ee71
MD5 5f09b7461892d79557f5a65003700540
BLAKE2b-256 a24e973f0fc800a9bd89d86c09e101ea760ed5c32a98dd3f79249c0c56efae0a

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp311-cp311-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp311-cp311-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 a9d853c3fb8c5f1eae61b7bc2c3f821c9af1a8d0f1a1c630934290421731b903
MD5 9885627dcd9e6ddb2620e86f7010d576
BLAKE2b-256 71874638a46a41a9ba6602d07ba41bd6cbad66554b5ed8fdad564e44602e2455

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e377f00588cb25788782559a9e2ceadab78402287e0a1af79fbed45c1f303b61
MD5 3e2fc977b7b35d22a9e9a0e93b3bcfb7
BLAKE2b-256 595c998fde45dae491486b8d34012578585adb14350420eec75f64f61eecbafe

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3e3d5d4a14c6fd30eb455b93f23893049ca518e70ad0c95c120358301ddfb04e
MD5 6d36405767b67f5c7cd8b5a55c534b25
BLAKE2b-256 4a80b640268cc8f3a6165a4679068d4d6896f07725f13a460917334cdd0df941

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp310-cp310-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 5170a041f14e81d5fdf3a7ce4fad0c889def45b895f23e03853b2f4f38c69ce9
MD5 7c800baa46740bba2a8fcc62f8d707df
BLAKE2b-256 75368e9b4e2dd0bf3f5b293c2c0dd833834c4b56dfd1013fb041d7d48eae5b4a

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 28bbdf48860bcd46f1bca294f67bd35dc960fb48559e26001534cc72437e3711
MD5 53d2abdb60afe29cfc6df137f4e052a6
BLAKE2b-256 441fe4065df9be38df8cd33008984864409d62c946a6786980acae1a1ab5c789

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a146d1e4207c6d5c955c436d22e532094e3ba8e1cd04e9b3e6e0b49dad54b962
MD5 62a3ab810f454c84a61a9d8dac56a413
BLAKE2b-256 572464d12de9db62365bcb474573147cfaa2cd69c3092b48498e799a1069f174

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp39-cp39-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 b1973ade2be55546046cb0d0e041ea351409b0de012063ff43c75c17daa1d5c9
MD5 24db9eb856da66435f121bce660a5c25
BLAKE2b-256 762e1c92ef7609e47011b446d4a8a6782e7a0e0a43e487c85397a9503582d81f

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 3f7716922de5c7e0fd43e0e8ad8b71b1b80455e199126ebd6ddca76bf490ce66
MD5 8f9d033ed5a4c9738e07f37354225fa9
BLAKE2b-256 8faf33605bbb28c31aef1e77bf8b567e048af7ba8e5d400c3bed5cd60fdbd736

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 120080173e4e07c74466722dc705bdb32009856d19f27987cfbfb45f9f533e20
MD5 3ec552b19aab487da4bc26be50ae5e9b
BLAKE2b-256 9cedfca0097165d72cbd72e54721a98a27adc513af8691540057566097c721bb

See more details on using hashes here.

File details

Details for the file TittaLSLPy-1.3.2-cp38-cp38-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.2-cp38-cp38-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 dd55fefec3c59db07a3a2aa06e997be19ac18dadd6c6ae9cbc7cf7bf7aaa745b
MD5 e6448bfdc6b81e367c243399563eaa02
BLAKE2b-256 56fb9b47b277b8dd5f56701f68198b9ead457a0d0372542deaf4da708b0dd960

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page