Back to the main page.

Bug 2104 - Unable to use ft_redefinetrial (fieldtrip-20130301) on MEG data preprocessed with older version

Status CLOSED FIXED
Reported 2013-04-11 13:47:00 +0200
Modified 2014-03-12 12:21:44 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: Macintosh
Operating System: Mac OS
Importance: P3 normal
Assigned to: Jörn M. Horschig
URL:
Tags:
Depends on:
Blocks:
See also:

Julia - 2013-04-11 13:47:03 +0200

Created attachment 447 First trial of the preprocessed data Hi all, I would like to do a source analysis with MEG data (ctf) which was preprocessed with an older fieldtrip version. For this, I need to redefine the trials of the preprocessed data, which I did with the command from the fieldtrip tutorial: cfg = []; cfg.toilim = [-.5 0]; dataPre = ft_redefinetrial(cfg, data_clean); However, I get following error message: Attempted to access numcoils(1); index out of bounds because numel(numcoils)=0. Error in channelposition (line 98) if all(numcoils==numcoils(1)) Error in ft_datatype_sens (line 127) [chanpos, chanori, lab] = channelposition(sens, 'channel', 'all'); Error in ft_datatype_raw (line 130) data.grad = ft_datatype_sens(data.grad); Error in ft_checkdata (line 213) data = ft_datatype_raw(data, 'hassampleinfo', hassampleinfo); Error in ft_redefinetrial (line 104) data = ft_checkdata(data, 'datatype', 'raw', 'feedback', cfg.feedback); Thank you for your help! Best, Julia


Jörn M. Horschig - 2013-04-23 13:56:32 +0200

Hi Julia, I just started looking into this - will let you know soon


Jörn M. Horschig - 2013-04-23 14:21:07 +0200

okidoki, at least I tracked down the error to the point where your sensor information is going wrong. The channelposition function, wants to undo the balancing, which would somehow make it for you to revert back to ICs. And then it goes wrong, because it cannot find MEG channels anymore (obviously, because the sensor information consists of ICs now instead of MEG coils). I'll continue looking into this


Jörn M. Horschig - 2013-04-23 14:30:45 +0200

a workaround for you is to to remove the data.grad.balance: data.grad = rmfield(data.grad, 'balance'); this will make the code work. I remember that we had some discussion about this in the past and after consulting some colleagues, I am fairly sure that this was the conclusion. In data.grad.balance there is basically only the mixing matrix stored. Maybe also data.tra should be removed the same way. I will however make sure that this is really the correct way to do, and we will think about throwing an appropriate warning including a solution for how to solve this error.


Julia - 2013-04-25 14:28:39 +0200

(In reply to comment #3) Hi Jörn Thank you very much for looking into this! With the workaround, I was able to calculate a leadfield so far (I have not removed the data.tra field). I hope all the other data sets also work. Best, Julia


Jörn M. Horschig - 2013-07-03 09:33:20 +0200

I created a faq for this: http://fieldtrip.fcdonders.nl/faq/i_used_ica_on_my_meg_data_from_before_2012_and_now_fieldtrip_crashes_why_is_that I am not sure in how much detail I should explain all the changes, imho the sparse information provided now should be enough for most users


Jörn M. Horschig - 2013-07-03 09:33:54 +0200

JM, could you please check whether the FAQ is good enough (see last comment)?


Jörn M. Horschig - 2013-07-24 12:06:02 +0200

I assume the FAQ is good enough ;)