[FieldTrip] odd interaction between matlab and ft version in ft_volumerealign

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Fri May 6 10:25:00 CEST 2016


Hi Bruno,

Is this ‘hack’ done inside a function, or do you need to do it outside a function call?
We recently tried and streamline the code to replace all occurrences of ‘pnt’ with ‘pos’. The fact that you need the hack suggests that we need to do some more code cleaning. It would be great if you could give us a pointer.

JM


> On 06 May 2016, at 10:22, Bruno L. Giordano <brungio at gmail.com> wrote:
> 
> Hi,
> 
> thanks, I will look into it!
> 
> One of the problems below we have been consistently experiencing here is related to the headshape structure: to avoid errors, we have been doing:
> 
> hs.pnt=hs.pos;
> 
> Cheers,
> 
> 	Bruno
> 
> On 05/05/2016 20:05, Schoffelen, J.M. (Jan Mathijs) wrote:
>> Hi Bruno,
>> 
>> I think we have just been looking into it. And with just, I mean really
>> just. I just merged a pull request from Roemer van der Meij into
>> github.com/fieldtrip/fieldtrip
>> <http://github.com/fieldtrip/fieldtrip> (#141). This merge is related to
>> a graphics issue that needs to be resolved differently for different
>> matlab versions (in particular for matlab>=2014 it requires a different
>> solution than matlab<2014). I wonder whether this is related to the
>> problem you report.
>> We did not do an comparable extensive sweep of the possible combinations
>> (i.e. matlab versions and fieldtrip versions), so could you pull a copy
>> from git and try it out? We have a ‘tutorial’ on the fieldtrip wiki that
>> explains one way of getting yourself a local copy of the code.
>> 
>> Thanks,
>> 
>> Jan-Mathijs
>> 
>> 
>> 
>> 
>> 
>>> On 05 May 2016, at 20:37, Bruno L. Giordano <brungio at gmail.com
>>> <mailto:brungio at gmail.com>> wrote:
>>> 
>>> Hello,
>>> 
>>> I am trying to run these commands on different matlab versions(2013
>>> vs. 2015) and using different FT versions (20141209 vs. 20160317;
>>> let's call them 2014 vs. 2016).
>>> 
>>> The code I run is as follows:
>>> 
>>> mri=ft_read_mri(mrifilename,'dataformat','nifti_spm');
>>> 
>>> cfg=[];
>>> cfg.method='fiducial';
>>> cfg.coordsys='4d';
>>> cfg.fiducial.nas=[59 168 104];
>>> cfg.fiducial.lpa=[138 133 28];
>>> cfg.fiducial.rpa=[147 138 169];
>>> mri=ft_volumerealign(cfg,mri);
>>> 
>>> hs=ft_read_headshape(headshapefilename);
>>> % hs.pnt=hs.pos; %required for later fieldtrip versions or gives an
>>> error, see v
>>> 
>>> cfg=[];
>>> cfg.method='headshape';
>>> cfg.headshape=hs;
>>> 
>>> mrihs=ft_volumerealign(cfg,mri);
>>> 
>>> Unless otherwise noted, the code fails when I quit the interactive
>>> alignment window.
>>> 
>>> It fails in the following cases (errors below):
>>> Matlab: 2015; FT: 2016
>>> Matlab: 2015; FT: 2014
>>> Matlab: 2013; FT: 2016
>>> 
>>> and is successful only for
>>> Matlab: 2013; FT: 2014
>>> 
>>> Did anyone experience similar problems? Is there a workaround? If not,
>>> would it be complicated to estimate the transformation matrices myself
>>> once I know the right scale/translation/rotation parameters?
>>> 
>>> Thank you,
>>> 
>>> Bruno
>>> 
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> Matlab: 2013; FT: 2016
>>> Matlab: 2013; FT: 2016
>>> Fails when quitting interactive alignment window
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> 
>>> Error using cell/ismember>cellismemberR2012a (line 193)
>>> Input A of class cell and input B of class cell must be cell arrays of
>>> strings, unless one is a string.
>>> 
>>> Error in cell/ismember (line 57)
>>>   [varargout{1:max(1,nargout)}] = cellismemberR2012a(A,B);
>>> 
>>> Error in ft_senstype (line 303)
>>>   if     (mean(ismember(ft_senslabel('ant128'),         sens.label))
>>> > 0.8)
>>> 
>>> Error in ft_datatype_sens (line 138)
>>> ismeg = ft_senstype(sens, 'meg');
>>> 
>>> Error in ft_checkconfig (line 250)
>>> cfg.elec = ft_datatype_sens(cfg.elec);
>>> 
>>> Error in ft_interactiverealign (line 71)
>>> cfg.template   = ft_checkconfig(cfg.template, 'renamed', {'vol',
>>> 'headmodel'});
>>> 
>>> Error in ft_volumerealign (line 691)
>>>     tmpcfg = ft_interactiverealign(tmpcfg);
>>> 
>>> 
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> Matlab: 2015; FT: 2016
>>> Matlab: 2015; FT: 2016
>>> hs.pnt=hs.pos; %required or will give another error
>>> Fails when quitting interactive alignment window
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> 
>>> Error using  *
>>> Inner matrix dimensions must agree.
>>> 
>>> Error in ft_sourceinterpolate (line 328)
>>>       av     = interpmat*fv;
>>> 
>>> Error in ft_volumerealign (line 752)
>>>     smoothdist          = ft_sourceinterpolate(tmpcfg, functional,
>>> target);
>>> 
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> Matlab: 2015; FT: 2014
>>> Matlab: 2015; FT: 2014
>>> hs.pnt=hs.pos; %required or will give another error
>>> Fails when creating the interactive alignment window
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> 
>>> 
>>> ield assignment to a non-structure array object.
>>> 
>>> Error in ft_plot_mesh (line 61)
>>> bnd.pnt = bnd;
>>> 
>>> Error in ft_interactiverealign>cb_redraw (line 282)
>>>   ft_plot_mesh(template.elec.chanpos,'vertexcolor', 'b',
>>> 'vertexsize',10);
>>> 
>>> Error in ft_interactiverealign (line 126)
>>> cb_redraw(gca);
>>> 
>>> Error in ft_volumerealign (line 584)
>>>     tmpcfg = ft_interactiverealign(tmpcfg);
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> --
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> Bruno L. Giordano, PhD
>>> Institute of Neuroscience and Psychology
>>> 58 Hillhead Street, University of Glasgow
>>> Glasgow, G12 8QB, Scotland
>>> T +44 (0) 141 330 5484
>>> Www: http://www.brunolgiordano.net <http://www.brunolgiordano.net/>
>>> Email charter: http://www.emailcharter.org/
>>> _______________________________________________
>>> fieldtrip mailing list
>>> fieldtrip at donders.ru.nl <mailto:fieldtrip at donders.ru.nl>
>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> 
>> 
>> 
>> 
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> 
> 
> -- 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Bruno L. Giordano, PhD
> Institute of Neuroscience and Psychology
> 58 Hillhead Street, University of Glasgow
> Glasgow, G12 8QB, Scotland
> T +44 (0) 141 330 5484
> Www: http://www.brunolgiordano.net
> Email charter: http://www.emailcharter.org/
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip





More information about the fieldtrip mailing list