Back to the main page.

Bug 1310 - Missing resolution Information in *vhdr causes ft_preprocessing to return only NaNs

Status CLOSED DUPLICATE
Reported 2012-02-02 13:29:00 +0100
Modified 2015-07-15 13:20:46 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: All
Operating System: Windows
Importance: P3 normal
Assigned to: Jim Herring
URL:
Tags:
Depends on:
Blocks:
See also: http://bugzilla.fcdonders.nl/show_bug.cgi?id=1618

Julian Karch - 2012-02-02 13:29:29 +0100

See discussion on the mailing list with the same subject


Julian Karch - 2012-02-02 13:32:49 +0100

My solution. Quoted from my email to the mailing list: it seems like I solved the problem. If you export your data to the ieee floating point format the resolution entry vanishes. I assume that it is just don't needed anymore as the entries are in micro volt then. This was taken into account by the read_brainvision_eeg function until 12/08/2011. On This day a couple of changes were committed. Leading to the fact that ieee_float_32 data is also multiplied with the resolution ================================================================================================== if strcmpi(hdr.DataFormat, 'binary') && strcmpi(hdr.DataOrientation, 'multiplexed') && any(strcmpi(hdr.BinaryFormat, {'int_16', 'int_32', 'ieee_float_32'})) [...] calib = diag(hdr.resolution); % using a sparse multiplication speeds it up dat = full(sparse(calib) * dat); ============================================================= The pre 12/08/2011 version looks like that ============================================================ elseif strcmpi(hdr.DataFormat, 'binary') && strcmpi(hdr.DataOrientation, 'multiplexed') && strcmpi(hdr.BinaryFormat, 'ieee_float_32') fid = fopen(filename, 'rb', 'ieee-le'); fseek(fid, hdr.NumberOfChannels*4*(begsample-1), 'cof'); [dat, siz] = fread(fid, [hdr.NumberOfChannels, (endsample-begsample+1)], 'float32'); fclose(fid); ========================================================== So ieee data was not multiplied by the resolution. Which is probably the correct behavior. I changed the function such that it doesn't multiply the ieee data with the resolution and it seems work. You can look at it here: http://matlab.nopaste.dk/p4635. The changes are just the if statements in line 67and 81.


Robert Oostenveld - 2012-02-04 10:46:19 +0100

Thanks for reporting this and the suggested fix. Could you provide us with a (possibly small) dataset that is stored in the ieee floating point format? We can then check your solution and add it to our collection of test cases. See the faq on http://fieldtrip.fcdonders.nl/contact


Julian Karch - 2012-02-10 20:18:18 +0100

Created attachment 227 Testcase Attached find a test case including a test data set and the fixed read_brainvision_eeg.m. The test data set consists of resting EEG.


Julian Karch - 2012-02-10 20:20:51 +0100

(In reply to comment #3) While creating the test case it also came to my attention that the combination which causes the bug is multiplexed + float. Vectorized + float works fine.


Robert Oostenveld - 2012-02-15 14:18:52 +0100

as discussed in the FT meeting this is now assigned to Lilla.


Jim Herring - 2014-01-23 09:37:50 +0100

This bug is strongly linked to bug1618 which was fixed by setting the resolution to 1 if no resolution is present in the header. As bug1618 was fixed first I'll mark this bug as a duplicate. *** This bug has been marked as a duplicate of bug 1618 ***