[FieldTrip] Error in ft_sourceinterpolate

fosco bernasconi fosco.bernasconi at gmail.com
Fri Mar 18 16:49:33 CET 2016


Dear all,

I'm trying to compute 'pcc' beamforming source analysis of eeg data, but I
have an error when calling ft_sourceinterpolate:





* Reference to non-existent field 'avg'.Error in getsubfield (line 45)  s =
s.(t{k});Error in ft_sourceinterpolate (line 209)  if
~iscell(getsubfield(functional, cfg.parameter{i}))*


If I check my source structure I do have the avg field.

source =
freq: 10
cumtapcnt: [157x1 double]
dim: [18 21 18]
inside: [6804x1 logical]
pos: [6804x3 double]
method: 'average'
avg: [1x1 struct]
cfg: [1x1 struct]


Any suggestion?

Thank you for your help!
Best,
fosco


here the rest of my code:


load('standard_bem.mat');
load('standard_sourcemodel3d10mm.mat');

templatefile =
'/home/sv/Matlabtoolboxes/fieldtrip-20160306/template/anatomy/single_subj_T1.nii';
template_mri = ft_read_mri(templatefile);
template_mri = ft_convert_units(template_mri,'mm');
template_mri.coordsys = 'spm';

cfg = [];
cfg.grid.warpmni = 'yes';
cfg.grid.template  = sourcemodel;
cfg.grid.nonlinear = 'yes'; % use non-linear normalization
cfg.mri      = template_mri;
sourcemodel  = ft_prepare_sourcemodel(cfg,freq);
sourcemodel  = ft_convert_units(sourcemodel,'mm');

cfg         = [];
cfg.elec    = sens;
cfg.channel = sens.label;
cfg.headmodel = vol;
cfg.grid      = sourcemodel;
cfg.grid.unit = 'mm';% same unit as above, i.e. in cm
lf = ft_prepare_leadfield(cfg,freq);

cfg            = [];
cfg.method     = 'mtmfft';
cfg.output     = 'fourier';
cfg.keeptrials = 'yes';
cfg.tapsmofrq  = 2;
cfg.foi        = 10;
freq           = ft_freqanalysis(cfg,dataft{1,1});

% compute source reconstruction
cfg   = [];
cfg.frequency = freq.freq;
cfg.method    = 'pcc';
cfg.grid         = lf;
cfg.headmodel         = vol;
cfg.keeptrials        = 'yes';
cfg.pcc.lambda        = '5%';
cfg.pcc.projectnoise  = 'yes';
source = ft_sourceanalysis(cfg,freq);

cfg = [];
cfg.projectmom = 'yes';
source_proj = ft_sourcedescriptives(cfg,source);

% and provide  mni template
source_proj.dim = sourcemodel.dim;
source_proj.pos = sourcemodel.pos;

cfg  = [];
cfg.voxelcoord   = 'no';
cfg.parameter    = 'avg.nai';
source_int  = ft_sourceinterpolate(cfg,source,template_mri);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160318/7add5a30/attachment-0001.html>


More information about the fieldtrip mailing list