Back to the main page.

Bug 2188 - enhancement: implement support for Localite marker positions (eeg-electrodes and tms-coil location)

Status REOPENED
Reported 2013-06-05 10:20:00 +0200
Modified 2013-06-13 10:07:29 +0200
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 enhancement
Assigned to: Jim Herring
URL:
Tags:
Depends on:
Blocks:
See also:

Jim Herring - 2013-06-05 10:20:40 +0200

Created attachment 482 example: Localite EEG markers Localite marker positions are stored in an XML file where the important information is the electrode's label (description), XYZ-coordinates in RAS (dataX), and whether the position is set, or not (set). In this case data0, data1, and data3 represent respectively the X, Y, and Z coordinates. For the instrument markers (e.g. TMS coil position) it is a bit more complicated as instrument markers are stored in 4D matrices in LPS space. For example: As far as I can tell the dataX3 variables roughly correspond with the center of the coil position but I've sent an e-mail to Localite to ask what all the fields in the matrix represent. I'll attach an example of both position files. What should should be updated is: ft_read_sens ft_filetype any others? Is it preferred to create a function to read the marker positions (e.g. read_localite_pos)? </p>

Jim Herring - 2013-06-05 10:21:26 +0200

Created attachment 483 example: Localite TMS marker


Jim Herring - 2013-06-05 10:42:58 +0200

Created attachment 484 Instrument-Marker information sheet


Jim Herring - 2013-06-05 10:44:38 +0200

Localite sent a PDF explaining the 4D matrix, I've attached it.


Robert Oostenveld - 2013-06-06 16:37:35 +0200

I suggest using native MATLAB xmlread for parsing the file. There are other solutions (also in use in fieldtrip) such as xml2struct, but they have some issues with it (incompatibility with certain xml files, conflicting versions). see help xmlread It is to be implemented in ft_read_sens and I suggest to make a read_localite_markers function in fileio/private.


Jim Herring - 2013-06-06 17:38:49 +0200

Hi Robert, I had a meeting on this bug with J-M today. I had already made an implementation with xml2struct and an alternative if java is not available. I've modified ft_filetype and ft_read_sens to add support for Localite EEG marker positions. I haven't committed it to the official Fieldtrip distribution but created a branch in my Fieldtrip for on Github: https://github.com/jimher/fieldtrip/tree/localite I've made ft_filetype to look for the .xml extension and to check for ''. ft_read_sens uses xml2struct to convert the xml file into a structure, the function then loops through the Marker fields to check for channels that are set (Not all channels have to be recorded, those that are not recorded have default and stores their coordinates and labels into the sens structure. If Java is not available I wrote an alternative (perhaps a bit messy) that stores all the text of the .xml file into cells and searches the cells for coordinate and label information, which is then stored into the sens structure. I did not (yet) create an extra low-level function to read the markers but put everything under 'case ''localite_pos''' in ft_read_sens. J-M was fine with the implementation but if you disagree I will gladly put everything into read_localite_markers. Best, Jim </p>

Robert Oostenveld - 2013-06-11 16:19:26 +0200

(In reply to comment #5) sound ok to me. Can you put the data in home/common/fieldtrip/data/test/bug2188, make a test_bug2188 script (and ensure it runs) and then send a pull request to fieldtrip/fieldtrip?


Jim Herring - 2013-06-11 16:45:07 +0200

I've saved you the trouble of handling the pull request and just committed through SVN: Sending fileio/ft_filetype.m Sending fileio/ft_read_sens.m Adding test/test_bug2188.m Transmitting file data ... Committed revision 8237.


Jim Herring - 2013-06-13 09:30:03 +0200

Dashboard fails although the test script works when I run it myself. According to the dashboard log-file the .xml file cannot be opened: "Starting test run with 1 test case. {Warning: could not open /home/common/matlab/fieldtrip/data/test/bug2188/EEG_Markers.xml}" Am I missing something?


Jan-Mathijs Schoffelen - 2013-06-13 09:31:29 +0200

did you do a ft_hastoolbox('gifti', 1) in the testscript?


Jim Herring - 2013-06-13 10:07:29 +0200

I indeed missed something, forgot to set permissions correctly. Should be fixed now.