Importing Data from Neuralynx

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Mon Feb 4 14:32:37 CET 2008


Hi Nathalie and Marijn,

The neuralynx reading code was not yet included in the official
release version because it was still unstable and prone to frequent
changes. I think that at this moment it is sufficiently stable to be
released. I have just tagged it for release on the ftp server, which
means that from this evening onward it will automatically be included
in the daily release of fieldtrip (which can be found on the ftp
server).

Instead of working with the old version that Marijn attached, I
suggest that you update to the latest fieldtrip version tomorrow (the
ftp release will be done this evening). Working with all neuralynx
file formats also requires the "@uint64" module (that will be
released as well this evening), since standard matlab is not able to
compute with unsigned 64 bit integers (which are used for the
timestamping).

Regarding events: the events.nev file (which you probably use) only
contains timestamps and not sample numbers. For writing trialfuns
(see documentation) and using preprocessing to read the data, you
should compute the corresponding sample numbers yourself by using
hdr.FirstTimesStamp and hdr.TimeStampPerSample according to

hdr = read_fcdc_header('dataset with ncs+nse files')
event = read_fcdc_event('event.nev')

for i=1:length(event)
   % the first sample in the datafile is 1
   event(i).sample = (event(i).timestamp-double
(hdr.FirstTimesStamp))./hdr.TimeStampPerSample + 1;
end

Regarding spike tiemstamps (nse, nts): our usual way of dealing with
them is by making an all-zero virtual continuous channel, and insert
a one at the location of each spike. This is automatically done by
the low-level code if you select a spike channel in preprocessing (by
means of the low level neuralynx specific function that is called by
read_data). Handling of spike waveform information is not yet
supported by the release version.

Given that the online documentation about LFP and spike analysis is
rather sparse at the moment, I would like to invite you to add your
comments and findings w.r.t. using the code to the wiki, e.g. on
http://www2.ru.nl/fcdonders/fieldtrip/doku.php?
id=fieldtrip:dataformat:spike

best regards,
Robert





On 28 Jan 2008, at 14:17, Marijn van Wingerden wrote:

> Hello Natalia,
>
> I've been working on getting Neuralynx data into Fieldtrip as well.
> There are some small and some large problems involved, especially
> concerning the registration of events. Feel free to e-mail me off
> this list with specific problems. It seems this particular error
> occured because you don't have the proper loading functions that
> the wrapper function calls in your path. They are located in the
> fileio subfolder, but I'll attach the relevant Nlx functions here
> in a zip-file. Just put them in your matlab path and the function
> should be able to run.
>
> good luck!
>
> marijn van wingerden
>
> Natalia Grion wrote:
>> Hi All, I want to start with Fieldtrip analysis on animal data
>> recorded with Neuralynx. I have LFP (*.ncs files), spikes (*.nts),
>> and event files (*.nev). So, I have the three wrapper functions;
>> which call these read_xxx functions that detect the file format
>> and subsequently call the appropriate low-level function for each
>> file format.
>> In a first attempt to import data I ran:
>> hdr = read_fcdc_header(file) with a *.ncs file
>> but I found this error:
>> ??? Undefined command/function 'read_neuralynx_ncs'.
>> Error in ==> fieldtrip-20070820\private\read_header at 472
>>    ncs = read_neuralynx_ncs(filename, 1, 0);
>> Error in ==> read_fcdc_header at 37
>> [hdr] = read_header(varargin{:});
>>
>> Do you have any explanation for this error?
>> Another question:  Are *.nst  (spike files) recognized?
>>
>> Thank you all!!
>>
>> ----------------------------------
>> The aim of this list is to facilitate the discussion between users
>> of the FieldTrip  toolbox, to share experiences and to discuss new
>> ideas for MEG and EEG analysis. See also http://
>> listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/
>> fcdonders/fieldtrip.
>
> --
>
> Mr. Marijn van Wingerden, M.Sc.
> PhD-candidate Animal Physiology & Cognitive Neuroscience (APCN)
> Centre for NeuroScience (CNS) section of Swammerdam Institute for
> Life Sciences (SILS)
> University of Amsterdam, Faculty of Science
> Kruislaan 320, 1098 SM Amsterdam, The Netherlands
> Tel: +31 20 525 7713/7547
> Fax: +31 20 525 7709
>
>
> ----------------------------------
> The aim of this list is to facilitate the discussion between users
> of the FieldTrip  toolbox, to share experiences and to discuss new
> ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/
> archives/fieldtrip.html and http://www.ru.nl/fcdonders/
> fieldtrip.<read_neuralynx.zip>

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/fcdonders/fieldtrip.



More information about the fieldtrip mailing list