Back to the main page.

Bug 3202 - improve support for Tucker Davis Technologies (TDT) files

Reported 2016-11-03 18:03:00 +0100
Modified 2019-08-10 12:40:40 +0200
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P5 normal
Assigned to: Arjen Stolk
Depends on:
See also:

Arjen Stolk - 2016-11-03 18:03:51 +0100

There's a host of low-level reading functions in fileio/private (read_tdt_xxx), yet ft_read_header mentions the filetype is not supported (l. 2175, reproduced below for convenience). read_tdt_tsq seems able to read the (unstructured) header, and read_tdt_tev is able to read the data. But how far is this code? Is it just a matter or (re-)structuring the header and data in ft_read_header, or do the need low-level functionalities more testing? And who from the ESI in Frankfurt (as suggested in the code) is looking at this? case {'tdt_tsq', 'tdt_tev'} % FIXME the code below is not yet functional, it requires more input from the ESI in Frankfurt % tsq = read_tdt_tsq(headerfile); % k = 0; % chan = unique([]); % % loop over the physical channels % for i=1:length(chan) % chansel = []==chan(i); % code = unique({tsq(chansel).code}); % % loop over the logical channels % for j=1:length(code) % codesel = false(size(tsq)); % for k=1:numel(codesel) % codesel(k) = identical(tsq(k).code, code{j}); % end % % find the first instance of this logical channel % this = find(chansel(:) & codesel(:), 1); % % add it to the list of channels % k = k + 1; % frequency(k) = tsq(this).frequency; % label{k} = [char(typecast(tsq(this).code, 'uint8')) num2str(tsq(this).channel)]; % tsqorig(k) = tsq(this); % end % end error('not yet implemented');

Robert Oostenveld - 2016-11-04 08:44:41 +0100

this is what the log tells me commit 6ae53d0816b8b241aa529d3fee41e5a2c1a448d3 Author: Robert Oostenveld <> Date: Thu Nov 25 08:17:48 2010 +0000 added some reading functions for TDT files, not all are fully implemented git-svn-id: svn+ssh:// 0cf7c7f0-3615-4144-b4e6-68da3bce3cd0 commit 0f15e0c7cec9c40f06d396328c39e031365e851e Author: Robert Oostenveld <> Date: Thu Nov 25 08:14:24 2010 +0000 some improvements for reading TDT *.tsq files git-svn-id: svn+ssh:// 0cf7c7f0-3615-4144-b4e6-68da3bce3cd0 I wrote these functions when Pascal got a TDT system at the ESI, but then it took ages for them to actually start recording with it. And actually I don't even know whether they ever recorded with it. A bit similar with the Neuralynx and Plexon system: there are multiple file formats and some of them are quite messy. The TDT system (and file formats) are not designed to be processed with non-TDT software. The overall idea in the TDT acquisition and analysis software is to deal with the data like a database. If memory serves me well, the TBK and TDX files are related to the indexing of the data in the files. In general: storing spike data in files is hard, as the spikes don't come in regularly. That makes a spike file a collection of "random" snippets from many different channels. That feature also tends to be reflected in the other (continuous) file formats of companies that work with spike data. What are exactly the files that you have?

Arjen Stolk - 2016-11-04 23:07:36 +0100

(In reply to Robert Oostenveld from comment #1) Thanks for digging that up, and the history of this functionality. The tdt data here pertains to ECoG recordings, if that makes any difference. The data of the individual channels are also stored in separate matfiles. Would prefer to stay as close as possible to the original data, but could work with those mat files otherwise. Any idea whether it's worth looking further into the tdt format (e.g. is it still being used)?

Robert Oostenveld - 2016-11-05 09:18:33 +0100

(In reply to Arjen Stolk from comment #2) mat files are not native TDT. What is the extension of the other files you have?

Arjen Stolk - 2016-11-05 17:04:11 +0100

(In reply to Robert Oostenveld from comment #3) .Tbk, .Tdx, .tev, .tsq

Robert Oostenveld - 2016-11-21 16:36:05 +0100

did you try this, which is from here it is windows only, uses ActiveX. But it includes examples.

Robert Oostenveld - 2016-11-21 16:42:58 +0100

(In reply to Arjen Stolk from comment #4) there is documentation on and As I understand it, it is like this .Tbk -> ? .Tdx -> ? .tev -> continuous data .tsq -> events For the tev and tsq the code is explicit enough. But for those there are also the FT implementations... could you be more explicit of what the desired outcome of this bug report would be?

Arjen Stolk - 2016-11-21 18:05:37 +0100

Thanks for delving into this. The outcome, with no strong preference really, would be either 'yes, we activate the currently built in support' or 'no, it's not yet reliable enough'.

Robert Oostenveld - 2016-11-22 08:46:24 +0100

(In reply to Arjen Stolk from comment #7) If the current code works, we should "yes" enable it in the high level interface. Since not everything works, it should also be documented what does and what not. The "tank" dataset format is difficult enough as it is. Can you share a dataset with me?

Arjen Stolk - 2016-11-22 18:09:09 +0100

Thanks. The data is on its way to you. I included the TDT 4 files. As a side note, the data is about 10 years old. Hopefully it's representative for newer data as well.

Arjen Stolk - 2017-09-05 08:49:03 +0200

This is no priority for anyone I think.

Robert Oostenveld - 2019-08-10 12:34:30 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on

Robert Oostenveld - 2019-08-10 12:40:40 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on