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

Azadeh Hajihosseini azadehh at uvic.ca
Fri Jul 25 20:03:38 CEST 2014


Hi Diego,

Thanks so much for looking into this and finding the problem! I am going to
try the other two templates you suggested and see what I can make of them.

As you mentioned, it would be great to know other people's experience on
using mri templates for EEG source localization. I look forward to hearing
from anyone who has this experience! Thanks in advance :)

Bests,

On Fri, Jul 25, 2014 at 4:31 AM, Lozano Soldevilla, D. (Diego) <
d.lozanosoldevilla at fcdonders.ru.nl> wrote:

> Hi Azadeh,
>
> The problem is originated during the segmentation processing. Basically
> the default cfg values that you applied to
> template/anatomy/single_subj_T1.nii gave you the attached segmentation: the
> scalp is poorly defined as you can see. Then you end up with the wrong
> headmodel.
>
> I noticed that the single_subj_T1.nii has very low resolution. I used the
> single_subj_T1_1mm.nii instead with the following cfg parameters (by trial
> and error...) and they gave me sensitive binary representations:
>
> mri =
> ft_read_mri('/home/common/matlab/fieldtrip/template/anatomy/single_subj_T1_1mm.nii');
> mri.coordsys = 'spm';
>
> cfg                = [];
> cfg.brainsmooth    = 5%(default = 5)
> cfg.scalpsmooth    = 5%(default = 5)
> cfg.brainthreshold = 0.25%(default = 0.5)
> cfg.scalpthreshold = 0.25%(default = 0.1)
>
> cfg.output    = {'brain','skull','scalp'};
> seg  = ft_volumesegment(cfg, mri);
>
> cfg              = [];
> cfg.funparameter = 'scalp';
> ft_sourceplot(cfg,seg);
>
>
> The ft_volumesegment documentation mentions the
> fieldtrip/external/spm8/templates/T1.nii Unfortunately I'm not sure what
> this T1 is (MNI152 might be?) and its advantages or disadvantatges. If you
> use the T1.nii with the following cfg, you'll get a segmentation that makes
> sense to me:
>
> mri =
> ft_read_mri('/home/common/matlab/fieldtrip/external/spm8/templates/T1.nii');
> mri.coordsys = 'spm';
>
> cfg                = [];
> cfg.brainsmooth    = 2%(default = 5)
> cfg.scalpsmooth    = 2%(default = 5)
> cfg.brainthreshold = 0.25%(default = 0.5)
> cfg.scalpthreshold = 0.15%(default = 0.1)
>
> cfg.output    = {'brain','skull','scalp'};
> seg  = ft_volumesegment(cfg, mri);
>
> cfg              = [];
> cfg.funparameter = 'scalp';%check the brain and skull too
> ft_sourceplot(cfg,seg);
>
>
> My source modeling experience is restricted to MEG using individual T1s
> (not a template). I'm sure a lot of people in the list have experience in
> the EEG/source modeling business using template anatomical scans. Could
> somedoby provide us a bit of advice?:
>
> Which anatomical template should one use (T1.nii, single_subj_T1_1mm.nii
> other?) and which cfg parameters make sense for the segmentation? It would
> be very nice if we could establish a kind of default and share them in the
> fieldtrip wiki ;) (I could do it if somebody share his/her
> knowledge/experience)
>
> Thanks in advance,
>
> Diego
>
>
> ----- Original Message -----
> > From azadehh at uvic.ca Sat Jul 19 00:26:06 2014
> > From: azadehh at uvic.ca (Azadeh Hajihosseini)
> > Date: Fri, 18 Jul 2014 15:26:06 -0700
> > Subject: [FieldTrip] Source analysis of EEG oscillatory activity/ NaN
> > values
> > in the leadfield matrices
> > Message-ID:
> > <CA+AyeFcNNontNAxpRDYU6_TxCTNrCQ8KpE-QFtwOyKVEvfBF_Q at mail.gmail.com>
> >
> > 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
>
> --
> PhD Student
> Neuronal Oscillations Group
> Donders Institute for Brain, Cognition and Behaviour
> Centre for Cognitive Neuroimaging
> Radboud University Nijmegen
> NL-6525 EN Nijmegen
> The Netherlands
> http://www.ru.nl/people/donders/lozano-soldevilla-d/
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>



-- 
Azadeh HajiHosseini

Graduate student
Department of Psychology
University of Victoria
http://web.uvic.ca/~lccl/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140725/984f35a3/attachment-0002.html>


More information about the fieldtrip mailing list