[FieldTrip] sudden errors in ft_prepare_sourcemodel, ft_volumereslice, ft_volumesegment and ft_sourceplot

Marieke van de Nieuwenhuijzen m.vandenieuwenhuijzen at fcdonders.ru.nl
Wed Apr 4 10:16:43 CEST 2012


Dear all,

I have a problem with my beamforming script. The functions ft_prepare_sourcemodel, ft_volumereslice, ft_volumesegment and ft_sourceplot all crash with the same main error, namely 

??? Reference to non-existent field 'nChans'.

Error in ==> ft_senstype at 188
elseif isheader && input.nChans==1 && ~isempty(regexp(input.label{1}, '^csc'))

Error in ==> ft_convert_units at 56
  if ft_senstype(obj, 'meg')

Error in ==> ft_prepare_sourcemodel at 604 %(or of course ft_volumereslice, ft_volumesegment or ft_sourceplot, depending on the function)
    mri = ft_convert_units(mri);

The only difference is that ft_volumereslice has the additional error layer

Error in ==> ft_checkdata at 402
  data = ft_convert_units(data);

The code I am using is:

cfg =[];
cfg.mri= subject.MRI;
cfg.grid.warpmni = 'yes';
cfg.grid.resolution = 10; %resolution = 10 mm
grid = ft_prepare_sourcemodel(cfg);

mri = ft_read_mri(cfg.mri);
mri.coordsys='ctf';
mri=ft_volumereslice([],mri);

cfg          = [];
cfg.coordsys = 'ctf';
segmentedmri = ft_volumesegment(cfg, mri);

mri.brainmask = segmentedmri.gray+segmentedmri.white+segmentedmri.csf;
cfg              = [];
cfg.funparameter = 'brainmask';
figure;
ft_sourceplot(cfg, mri);

The curious thing is that this exact same code worked without any errors last week, but this week I am getting those errors.

I am using the latest version of fieldtrip, and run ft_defaults before starting the script (although it also crashed when I didn't do that; I only started running ft_defaults when I got these errors).

The fact that all errors seem to stem from the same error in ft_senstype, that this code has worked without any problems until last week, and that ft_senstype has been updated last Friday makes me suspect some bug during that update, but I am not sure about that.

Does anyone have an idea as to what might be the problem here?

Best,
Marieke



More information about the fieldtrip mailing list