Back to the main page.

Bug 1299 - gtec_mat support disappeared from ft_read_header in svn merged branch

Status CLOSED FIXED
Reported 2012-01-31 22:02:00 +0100
Modified 2012-04-02 16:27:04 +0200
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P3 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

Robert Oostenveld - 2012-01-31 22:02:23 +0100

On 31 Jan 2012, at 15:57, Hogervorst, M.A. (Maarten) wrote: Robert, Ik krijg sinds kort fouten bij het inlezen van de matfiles met EEGdata met fieldtrip. Fieldtrip lijkt het format niet te kunnen interpreteren. Als ik jouw import-functies gebruik krijg ik onderstaande error-melding: --------------------------------- ??? Error using ==> ft_read_header at 1531 unsupported header format (gtec_mat) Error in ==> ft_preprocessing at 338 hdr = ft_read_header(cfg.headerfile, 'headerformat', cfg.headerformat); -------------------------------- Ik gebruik de download fieldtrip-20120106


Robert Oostenveld - 2012-01-31 22:05:14 +0100

I zoomed in on the problem. Revision 4286 has the gtec_mat support, revision 4287 lost it. See http://code.google.com/p/fieldtrip/source/browse/trunk/fileio/ft_read_header.m?spec=svn4286&r=4286 http://code.google.com/p/fieldtrip/source/browse/trunk/fileio/ft_read_header.m?spec=svn4287&r=4287 That is a commit from Jan-Mathijs: r4287 by jansch on Sep 23, 2011 enhancement - #879 redefine the description of the sensor-array, merged the branch that was created for this back into the trunk This suggests that something went wrong with the svn merge. Other files with may also have been affected (i.e. other improvements to code may have been undone) and therefore should also be checked.


Robert Oostenveld - 2012-01-31 22:08:18 +0100

To fix the immediate problem for Maarten, I have copied the relevant parts out of the last working revision into the latest/current revision. The diff is mbp> svn diff ft_read_header.m Index: ft_read_header.m =================================================================== --- ft_read_header.m (revision 5188) +++ ft_read_header.m (working copy) @@ -48,6 +48,7 @@ % NeuroScan (*.eeg, *.cnt, *.avg) % Nexstim (*.nxe) % BrainVision (*.eeg, *.seg, *.dat, *.vhdr, *.vmrk) +% GTec (*.mat) % % The following spike and LFP dataformats are supported (with some limitations) % Plextor (*.nex, *.plx, *.ddt) @@ -120,7 +121,7 @@ fallback = ft_getopt(varargin, 'fallback'); if isempty(cache), - if strcmp(headerformat, 'bci2000_dat') || strcmp(headerformat, 'eyelink_asc') || strcmp(headerformat, 'biosig') + if strcmp(headerformat, 'bci2000_dat') || strcmp(headerformat, 'eyelink_asc') || || strcmp(headerformat, 'gtec_mat') || strcmp(headerformat, 'biosig') cache = true; else cache = false; @@ -950,7 +951,31 @@ hdr = db_select('fieldtrip.header', {'nChans', 'nSamples', 'nSamplesPre', 'Fs', 'label'}, 1); hdr.label = mxDeserialize(hdr.label); end + + case 'gtec_mat' + % this is a simple MATLAB format, it contains a log and a names variable + tmp = load(headerfile); + log = tmp.log; + names = tmp.names; + hdr.label = cellstr(names); + hdr.nChans = size(log,1); + hdr.nSamples = size(log,2); + hdr.nSamplesPre = 0; + hdr.nTrials = 1; % assume continuous data, not epoched + + % compute the sampling frequency from the time channel + sel = strcmp(hdr.label, 'Time'); + time = log(sel,:); + + hdr.Fs = 1./(time(2)-time(1)); + + % also remember the complete data upon request + if cache + hdr.orig.log = log; + hdr.orig.names = names; + end + case {'itab_raw' 'itab_mhd'} % read the full header information frtom the binary header structure header_info = read_itab_mhd(headerfile);


Robert Oostenveld - 2012-01-31 22:12:14 +0100

(In reply to comment #2) mbp> svn commit ft_read_header.m Sending ft_read_header.m Transmitting file data . Committed revision 5189. @Maarten, the updated file will be in the ftp release tomorrow evening (it is too late for it to end up in the 20120131 release). You can also pick up this individual file itself at http://code.google.com/p/fieldtrip/source/browse/trunk/fileio/ft_read_header.m?r=5189


Robert Oostenveld - 2012-01-31 22:14:22 +0100

(In reply to comment #1) Oh my ..., the merging of the branch affected a lot of files. See http://code.google.com/p/fieldtrip/source/detail?spec=svn4287&r=4287


Jan-Mathijs Schoffelen - 2012-02-01 15:35:51 +0100

These are those files: I'll check them to see whether there have been changes that were lost due to the branching Modify /trunk/fileio/ft_chantype.m diff Modify /trunk/fileio/ft_read_header.m diff Modify /trunk/fileio/ft_read_headshape.m diff Modify /trunk/fileio/ft_read_sens.m diff Modify /trunk/forward/ft_apply_montage.m diff Modify /trunk/forward/ft_average_sens.m diff Modify /trunk/forward/ft_compute_leadfield.m diff Modify /trunk/forward/ft_convert_units.m diff Modify /trunk/forward/ft_headmodel_localspheres.m diff Modify /trunk/forward/ft_prepare_vol_sens.m diff Modify /trunk/forward/ft_senstype.m diff Add /trunk/forward/private/channelposition.m diff Add /trunk/forward/private/fixsens.m diff Modify /trunk/forward/private/meg_forward.m diff Modify /trunk/forward/private/meg_ini.m diff Add /trunk/forward/private/undobalancing.m diff Modify /trunk/ft_channelrepair.m diff Modify /trunk/ft_electroderealign.m diff Modify /trunk/ft_headmodelplot.m diff Modify /trunk/ft_headmovement.m diff Modify /trunk/ft_interactiverealign.m diff Modify /trunk/ft_megplanar.m diff Modify /trunk/ft_megrealign.m diff Modify /trunk/ft_neighbourplot.m diff Modify /trunk/ft_prepare_layout.m diff Modify /trunk/ft_prepare_localspheres.m diff Modify /trunk/ft_prepare_neighbours.m diff Modify /trunk/ft_prepare_sourcemodel.m diff Modify /trunk/ft_scalpcurrentdensity.m diff Modify /trunk/ft_sensorrealign.m diff Modify /trunk/plotting/ft_plot_sens.m diff Add /trunk/plotting/private/fixsens.m diff Modify /trunk/plotting/private/ft_apply_montage.m diff Modify /trunk/plotting/private/ft_senstype.m diff Modify /trunk/private/constructplanargrad.m diff Modify /trunk/private/fixsens.m diff Modify /trunk/private/head_surf.m diff Modify /trunk/private/headsurface.m diff Modify /trunk/private/megplanar_fitplane.m diff Modify /trunk/private/megplanar_orig.m diff Modify /trunk/private/megplanar_sincos.m diff Modify /trunk/private/sel50p.m diff Modify /trunk/test/test_ft_megplanar.m diff Modify /trunk/utilities/ft_checkdata.m diff Modify /trunk/utilities/ft_datatype_comp.m diff Modify /trunk/utilities/ft_datatype_freq.m diff Modify /trunk/utilities/ft_datatype_mvar.m diff Modify /trunk/utilities/ft_datatype_raw.m diff Modify /trunk/utilities/ft_datatype_timelock.m diff Modify /trunk/utilities/ft_transform_geometry.m diff


Jan-Mathijs Schoffelen - 2012-02-01 15:50:09 +0100

Created attachment 223 difference between revision 4286 and 4287 svn diff -r 4286:4287 > svndiff4286to4287.txt


Jan-Mathijs Schoffelen - 2012-02-01 15:51:27 +0100

Created attachment 224 summary of modified files


Jan-Mathijs Schoffelen - 2012-02-01 16:22:58 +0100

Created attachment 225 differences between 4286 and 4287 which were present in 4286, and not anymore in 4287


Jan-Mathijs Schoffelen - 2012-02-01 16:24:07 +0100

I went throught the diff of all files modified from revision 4286 to 4287. The only files that were incorrectly merged seem to be: ft_read_header (fixed by Robert). ft_checkdata (fixed by JM). revision5213