[FieldTrip] Source analysis of EEG oscillatory activity/ NaN values in the leadfield matrices

Azadeh Hajihosseini azadehh at uvic.ca
Mon Jul 21 20:12:56 CEST 2014


Hi Tyler,

Thanks for responding! Actually, I have 51 electrodes. I also checked the
units again and they are all 'mm'.

It looks like there is a problem in preparing the head model because when I
call the line:

 *vol        = ft_prepare_headmodel(cfg, segmentedmri_template), *

there is this warning:

*Warning: Matrix is singular, close to singular or badly scaled.*
*         Results may be inaccurate. RCOND = NaN. *

 coming from *ft_headmodel_bemcp. *Any idea about this?

Thanks again!!
Azadeh


> On Sun, Jul 20, 2014 at 2:14 AM, Tyler Grummett <
> tyler.grummett at flinders.edu.au> wrote:
>
>>  Also are the units the same for your Headmodel, electrodes and
>> sourcemodel(?)
>>
>> Sent from my iPad
>>
>> On 20 Jul 2014, at 4:08 pm, "Tyler Grummett" <
>> tyler.grummett at flinders.edu.au> wrote:
>>
>>   I don't know if this advice is at all correct but I usually get that
>> error if I've got a relatively small number of electrodes (~29) or a small
>> data set (30 seconds of data).
>>
>>  Does that sound familiar?
>>
>>  I usually clear all and run it again and it will work eventually haha
>>
>> Sent from my iPad
>>
>> On 19 Jul 2014, at 8:01 am, "Azadeh Hajihosseini" <azadehh at uvic.ca>
>> wrote:
>>
>>    Hello FieldTrip members,
>>
>>  I am trying to source localize EEG oscillatory activity and have a few
>> problems in constructing the forward model and eventually running the
>> source analysis. I think the problems are related to each other. Here is
>> what happens:
>>
>>  1- When I run the source analysis, I get this error message:
>>
>>   *??? Error using ==> svd*
>> *Input to SVD must not contain NaN or Inf.*
>>
>>  *Error in ==> beamformer_dics>pinv at 650*
>> *  [U,S,V] = svd(A,0);*
>>
>>  *Error in ==> beamformer_dics at 339*
>> *        filt = pinv(lf' * invCf * lf) * lf' * invCf;              %
>> Gross eqn. 3, use PINV/SVD to cover rank*
>> *        deficient leadfield*
>>
>>  *Error in ==> ft_sourceanalysis at 572*
>> *      dip(i) = beamformer_dics(grid, sens, vol, [],  squeeze(Cf(i,:,:)),
>> optarg{:});*
>>
>>  *Error in ==> test_sourceanalysis at 12*
>> *sourceTF = ft_sourceanalysis(cfg, data_TF);*
>>
>>
>>  2- Checking the leadfiled matrices, I see there are a lot of NaN values.
>> 3- When I visualize the head model I have created, the plots don't look
>> right. The third field, *vol.bnd(3),* which is supposed to be the brain
>> tissue, looks like a cube.
>>
>>  And here are my code lines:
>>
>>   *% CONSTRUCT A HEAD MODEL from the template mri in FT's
>> template/anatomy*
>> *mri = ft_read_mri('template\anatomy\single_subj_T1.nii');*
>> *mri.coordsys = 'spm';*
>>
>>  *%SEGMENTATION:*
>> *cfg           = [];*
>> *cfg.output    = {'brain','skull','scalp'};*
>> *segmentedmri_template  = ft_volumesegment(cfg, mri); % Using NOT
>> resliced data*
>> *save segmentedmri_template segmentedmri_template*
>>
>>
>>  *%CREATE THE HEAD MODEL (VOLUME CONDUCTION MODEL)*
>> *cfg        = [];*
>> *cfg.method ='bemcp';*
>> *cfg.tissue ={'brain','skull','scalp'};*
>> *% cfg.outputfile = 'template_';*
>> *vol        = ft_prepare_headmodel(cfg, segmentedmri_template);*
>> *save vol vol*
>>
>>  *%Visualization of the head model*
>> *figure;*
>> *ft_plot_mesh(vol.bnd(1),'facecolor','none'); %scalp *
>> *figure;*
>> *ft_plot_mesh(vol.bnd(2),'facecolor','none'); %skull*
>> *figure;*
>> *ft_plot_mesh(vol.bnd(3),'facecolor','none'); %brain This one looks like
>> a cube*
>>
>>  *% Align electrodes  *
>> *elec = ft_read_sens('template\electrode\standard_1020.elc');   *
>> *% load volume conduction model*
>> *% load vol;                              *
>>
>>  *%interactive allignment*
>> *cfg           = [];*
>> *cfg.method    = 'interactive';*
>> *cfg.elec      = elec;*
>> *cfg.headshape = vol.bnd(1);*
>> *elec_aligned  = ft_electroderealign(cfg);*
>>
>>  *save elec_aligned elec_aligned*
>>
>>  *% Prepare leadfield*
>> *load data_TF*
>> *cfg=[];*
>> *cfg.vol           = vol; %structure with volume conduction model*
>> *cfg.elec          = elec_aligned;%structure with electrode positions*
>> *[grid] = ft_prepare_leadfield(cfg, data_TF);*
>>
>>  *% Find source*
>> *cfg              = []; *
>> *cfg.method       = 'dics';*
>> *cfg.frequency    = 25;  *
>> *cfg.grid         = grid; *
>> *cfg.vol          = vol;*
>> *cfg.latency       = .4;%single number in seconds, for time-frequency
>> analysis*
>> *cfg.dics.projectnoise = 'yes';*
>> *cfg.dics.lambda       = 0;*
>> *cfg.elec          = elec_aligned;%structure with electrode positions*
>>
>>  *sourceTF = ft_sourceanalysis(cfg, data_TF);*
>>
>>
>>  I am using *wavelet *with a *fourier* output for the time-frequency
>> analysis (*data_TF)*. Do you have any idea what might be wrong here?
>>
>>  I also have a more general question. What type of time-frequency data
>> can be input to source analysis? *ft_freqanalysis* provides power, power
>> and cross-spectra, and complex fourier outputs. But is source-localization
>> based on only power data correct? I couldn't find any explanations
>> regarding this issue in the tutorial.
>>
>>  I look forward to hearing from anyone who might have ideas about any of
>> these issues!
>>
>> Many thanks,
>>
>>  --
>> Azadeh HajiHosseini
>>
>>   _______________________________________________
>> fieldtrip mailing list
>> 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
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140721/99c7d041/attachment-0002.html>


More information about the fieldtrip mailing list