Back to the main page.

Bug 811 - implement spm2ft converter function

Status CLOSED FIXED
Reported 2011-07-11 14:51:00 +0200
Modified 2013-06-06 15:08:42 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P1 normal
Assigned to: Johanna
URL:
Tags:
Depends on:
Blocks:
See also:

Robert Oostenveld - 2011-07-11 14:51:01 +0200

... upon request from Raphael Kaplan


Robert Oostenveld - 2011-07-11 14:51:09 +0200

the first version was made by Jan-Mathijs, I extended it a bit with some error checking, output on screen and explicit conversion of the file_array into normal arrays.


Robert Oostenveld - 2011-07-11 14:58:04 +0200

created and added test script fieldtrip/test/test_bug811.m


Robert Oostenveld - 2011-07-13 14:46:59 +0200

changed the status for a whole bunch of resolved bugs to CLOSED


Johanna - 2012-10-19 13:11:15 +0200

reopened, since test_bug811 crashes. In the test function, within the call to spm2fieldtrip, there is the call to ft_defaults. Ft_defaults crashes on line 108, since it attempts to do something like a string comparison, but by list{i}(1:numel(ftPath)) == ftPath. Except that for my case, numel(ftPath) is 37, but the first index i for my list of paths is: list{1}='/home/common/matlab/spm8/spm.m' which is fewer than 37 characters, thus K>> list{i}(1:numel(ftPath)) ??? Index exceeds matrix dimensions.


Jan-Mathijs Schoffelen - 2012-10-24 09:27:17 +0200

I cannot reproduce Johanna's problem, but ran into a different one. spm2fieldtrip calls some postambles, one of which crashes due to the cfg not being defined within spm2fieldtrip. Since it is of no functional consequence I added an empty cfg in spm2fieldtrip, causing the test_bug811 to run without error. Index: spm2fieldtrip.m =================================================================== --- spm2fieldtrip.m (revision 6780) +++ spm2fieldtrip.m (working copy) @@ -46,6 +46,10 @@ % data.sampleinfo(i,2) = D.indsample(i) + D.nsamples; % end +% create empty cfg-structure in order for the ft_postamble to work. It is +% of no further consequence +cfg = []; + % do the general cleanup and bookkeeping at the end of the function ft_postamble callinfo ft_postamble history data bash-3.2$ svn commit spm2fieldtrip.m Sending spm2fieldtrip.m Transmitting file data . Committed revision 6782.


Jan-Mathijs Schoffelen - 2012-10-24 09:27:33 +0200

I cannot reproduce Johanna's problem, but ran into a different one. spm2fieldtrip calls some postambles, one of which crashes due to the cfg not being defined within spm2fieldtrip. Since it is of no functional consequence I added an empty cfg in spm2fieldtrip, causing the test_bug811 to run without error. Index: spm2fieldtrip.m =================================================================== --- spm2fieldtrip.m (revision 6780) +++ spm2fieldtrip.m (working copy) @@ -46,6 +46,10 @@ % data.sampleinfo(i,2) = D.indsample(i) + D.nsamples; % end +% create empty cfg-structure in order for the ft_postamble to work. It is +% of no further consequence +cfg = []; + % do the general cleanup and bookkeeping at the end of the function ft_postamble callinfo ft_postamble history data bash-3.2$ svn commit spm2fieldtrip.m Sending spm2fieldtrip.m Transmitting file data . Committed revision 6782.


Johanna - 2012-10-24 09:35:29 +0200

I get these warnings: Warning: multiple versions of SPM on your path will confuse FieldTrip > In fieldtrip-dev/private/warning_once at 95 In ft_defaults at 98 In spm2fieldtrip at 16 In test_bug811 at 14 Warning: one version of SPM is found here: /home/common/matlab/spm8/spm.m > In ft_defaults at 106 In spm2fieldtrip at 16 In test_bug811 at 14 And then crash: ??? Index exceeds matrix dimensions. Error in ==> ft_defaults at 108 if list{i}(1:numel(ftPath)) == ftPath Isn't line 108 of ft_defaults still a problem, even if it doesn't crash for others? It shouldn't assume that numel(list{i}) is greater than numel(ftPath), right?


Robert Oostenveld - 2012-12-24 11:04:34 +0100

is this still a problem?


Johanna - 2012-12-24 11:34:10 +0100

The problem of comment 7 has been solved after Robert's change r7011 to ft_defaults. http://code.google.com/p/fieldtrip/source/detail?spec=svn7011&r=7011 I set to resolved/fixed.