arnodelorme / mffmatlabio

MFF Matlab file importer and exporter
GNU General Public License v3.0
11 stars 16 forks source link

Wrong trial number returned by mff_import #4

Closed ftadel closed 4 years ago

ftadel commented 5 years ago

One of our users reported an issue related with reading a .mff file: https://neuroimage.usc.edu/forums/t/importing-pre-processed-and-epoched-data-egi-mff/10178

The example .mff file can be downloaded here: https://www.dropbox.com/sh/cdwljgkbcbdxs0g/AABF1ihB5QPegf1mvf0jcFqRa?dl=0

The function mff_import() returns a structure with: EEG.trials=1 EEG.pnts=201 size(EEG.data) = [257×90450 single]

Shouldn't trials be set to 90450/201 = 450 instead?

ftadel commented 5 years ago

There is more incoherent information read from the same file:

                pnts: 201
               srate: 1000
                xmin: -0.2000
                xmax: 1

Should we use the xmin/xmax (-200ms-1000ms) or the pnts/srate values (-200ms-0ms)? Why is the .times field not filled?

arnodelorme commented 5 years ago

Yes, this is correct. This is fixed in EEGLAB by calling the checking function. I think it is safe for a quick fix to have (after you get back the structure) EEG.trials=size(EEG.data,2)/EEG.pnts

I will implement a fix a release a new version (there is also a bug for writing events which I have fixed and another one which I have not fixed yet).

Thanks Francois,

Arno

ftadel commented 5 years ago

Thanks

And how are we supposed to interpret the wrong timing? (pnts/srate/xmin/xmax)

The .epoch field is also missing.

ftadel commented 5 years ago

Btw, eeg_checkset does not fix the missing .epoch field. And it doesn't fix the incoherence between the time fields (pnts/srate/xmin/xmax). The output .times (from -200ms to 0s) does not seem to be what the user is expecting.

ftadel commented 5 years ago

I take this last comment back, eeg_checkset does fix the epoch field, but it is difficult to have this working outside of EEGLAB. Proposed changes to have eeg_checkset working in Brainstorm: https://github.com/arnodelorme/mffmatlabio/pull/5

The question of this particular dataset remains open, reading it generates tons of warnings and does not seem to include the full epochs (only the times between -200ms and 0s seem to be read). I will ask our user to post the dataset here as well. Could you have a look at it, just to check if the problem is coming from the dataset or from the reading functions?

Thanks

ftadel commented 5 years ago

Example dataset: https://www.dropbox.com/sh/lbc25tfvw5dtftt/AADJPsnU5G0XwrWgisknCyQla?dl=0

ftadel commented 5 years ago

Have you got a chance to look at this dataset?

arnodelorme commented 4 years ago

Would you mind to share again the dataset. The link is broken.

ftadel commented 4 years ago

I think it's this dataset: https://www.dropbox.com/s/djofgwxebyd4nu0/0027_Sungjin_20170403_114721_Hfil_Lfil_seg_bcr_blc_ref.mff.zip?dl=0

arnodelorme commented 4 years ago

Thank you Francois,

Arno

On Oct 13, 2019, at 6:50 AM, Francois notifications@github.com wrote:

I think it's this dataset: https://www.dropbox.com/s/djofgwxebyd4nu0/0027_Sungjin_20170403_114721_Hfil_Lfil_seg_bcr_blc_ref.mff.zip?dl=0

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

arnodelorme commented 4 years ago

Hi Francois,

The problem had been fixed already. Is it OK to include your file in the test suite? I will keep you posted for a new release, probably within a month. Best wishes,

Arno

ftadel commented 4 years ago

I don't know, this is not my dataset. I asked the user who posted it on the Brainstorm forum: https://neuroimage.usc.edu/forums/t/importing-pre-processed-and-epoched-data-egi-mff/10178/6