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.1-cp313-cp313-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.13 Windows x86-64

TittaLSLPy-1.3.1-cp313-cp313-manylinux_2_28_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.13 manylinux: glibc 2.28+ x86-64

TittaLSLPy-1.3.1-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.1-cp312-cp312-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.12 Windows x86-64

TittaLSLPy-1.3.1-cp312-cp312-manylinux_2_28_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ x86-64

TittaLSLPy-1.3.1-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.1-cp311-cp311-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.11 Windows x86-64

TittaLSLPy-1.3.1-cp311-cp311-manylinux_2_28_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

TittaLSLPy-1.3.1-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.1-cp310-cp310-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.10 Windows x86-64

TittaLSLPy-1.3.1-cp310-cp310-manylinux_2_28_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

TittaLSLPy-1.3.1-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.1-cp39-cp39-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.9 Windows x86-64

TittaLSLPy-1.3.1-cp39-cp39-manylinux_2_28_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

TittaLSLPy-1.3.1-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.1-cp38-cp38-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.8 Windows x86-64

TittaLSLPy-1.3.1-cp38-cp38-manylinux_2_28_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

TittaLSLPy-1.3.1-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.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ee8cdaa304258cff752956c766b75a6b539d4fd51fc046dd0c7d45447d3d566e
MD5 9c50a57f87988e77ade2c46609473e0b
BLAKE2b-256 14a04fa0943954cd21d75b5ea784260b18c9adca740bb3ee8c0671d3177044dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 60d8dc1b65628c8594347aabd4251af4ef18d4ae3e63d74b0129ce2d3d24293b
MD5 8eb82150a6b5ee8a7fb06a87fa52bd77
BLAKE2b-256 069d66d467a91718208ef8e663b56ea5c0dcb8f89e7fbeeef82f8d70fd6c78fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp313-cp313-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 d27235a41d0aac23732e5b58c559f7cb83a44f824ac443009e23f1f95be1d65d
MD5 cfd2bc4ea8b44a8acfd75f80210b126d
BLAKE2b-256 038a36fe8e03853b3c1940604b1846a4543d857e1784a0326d921b1137b3a524

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 aa05db88cd4e9844de1f9260760fbb3eabbcc46b91760ed48cde399a91ce7472
MD5 ba090138aa004b88026727429aad5d7c
BLAKE2b-256 43cf5492cf2c71dac3c7066144b8fced608031c031843f530dddf1abd7d5ac49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a31eed92d93bfe7a6c341864b3019ae679105213398b6e5a1218260882101272
MD5 4a8dede4c33bc4a9ca74a4fde5b9cc31
BLAKE2b-256 a9762228d3ee0fb9585a2773b9ecdc28a978b035f16312c25bd012ef18055f02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp312-cp312-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 b3e89924d3ea92ad57c33e1fd41a3c0e491470f942b392ba68dd16ac18e8b9de
MD5 28fe915f2642f4dabc68f2218c7c9315
BLAKE2b-256 549d0097e29e1ecb68aa89c30bb8e8494193229b18b9b5a0c181c405dfca5aab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ca4d6629351e9c62fdf75bf49e14bdb94c02abeb9e5c7ab58aa8790eb68288c9
MD5 8ff5803dc0a83805e3254ddd58883ef3
BLAKE2b-256 48513d43c4d16bc2f3204846c6f3531ee13bbb42c653851750ba33ab88cc95e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f087fbecc242d5b0f6afa26875d1aba228fb47b321f284f58a011941de67a2c2
MD5 d84ba1d814db57e19249a822aafe0dde
BLAKE2b-256 f8ef9cdc025b8f990c8afa186bb061c0a1d8c5d70ba2c20749d080972d2ccddd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp311-cp311-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 53247c08bc28d8e43a659d6734b34f1ae1df67e4ee608eefd0a8de2718d735b5
MD5 8ade40fdbc4a42451c4dc834939b9556
BLAKE2b-256 4f1166b8506302edb080c03317d90fb338f4f35ed8e178dd70b8d4c971f25ff6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1c6e478ba505eae44db19aa90cfefd0f5cd6abe2b6a5450e4f96096204a5e28f
MD5 c0309f6af9e3b6d29999765130278e8c
BLAKE2b-256 e370286ef8efa57f9cf4ac698780142c109c8bba4b0a4ad04a65e1b0d64f617d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c75161be75670c81cbdbfe43076c2401ea974fdda62bb68250f74f8776083d27
MD5 1383cc58e231abeb07a3649cd8db4d35
BLAKE2b-256 65cd5c9ae754f74f564cde23c876f7d1941239c39dbf5f521b78f6c8cb5a2fcd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 f73677197815cffd5e5b8bbaa03112c85672244b78b7037cd0fec18b4bdf73c0
MD5 a1ed2cdb570d2004930f82a472b71206
BLAKE2b-256 945a6b0c68a619e9f06958c3a7e75e6c29556acc87bb8aa1c3744c792c34efc3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 cd0869a3ff49599d51578a904a4cf2005436d150537160efac5ea7e56de2d3b7
MD5 401e4b9640daf3c583779d1716d91605
BLAKE2b-256 f3108d902f2dcbfdb3a0262e5be934cf5127664bd9e42eeeca57297ce1c68b05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b362eb13cd9e55b365779d7b458e02f704200140dd85521e78bce96e98f8ffb1
MD5 2a27fa917a388afe2882b340dbce4a83
BLAKE2b-256 340fae93f95a9b9179de275a9c027459b0ff30bb1b0aaf829bcd3820bc1c5c82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 4f565c5341c6fc52087a94a02dac3326a931150d27c4a2ef1fdeeecb5adcc4db
MD5 77d09ca6c7280633e6dc58579fc5a95c
BLAKE2b-256 e31f30be83a42d422d86b1cda53d8abd1793a8f3f135a6e5d1be691979294a7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 f1c33eef5d09321a0bce32fd0906cbaeef26704d579c1d6a42de0f6e7c844b69
MD5 b7313e144127747922a6c949470fa26c
BLAKE2b-256 f23045c04818b83319584b2ce40e697d15e4424fe22d6a3a8bda802be79aa7c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3efdffa2dc3f63a8cf51701c2c53ef3fdf7810b554bafbb4cf05b99734b2329d
MD5 f32098786a2951852ba19275c470b822
BLAKE2b-256 318a3813de5793157a0ba93ad18ce3a308ef7664cdf2c2ea6312f6fbb888648f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TittaLSLPy-1.3.1-cp38-cp38-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 297e406e2a9994d2967efe4b70652c10f94185437927853cb5a0ad77dda134b4
MD5 52d50492671d130fbb84f3540bc2104d
BLAKE2b-256 cfceadeadbeaffd2f8c1c2147bad5d80008e9a7c086ee2da97daf3e7cb365a88

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