<div dir="ltr"><div dir="ltr">Hi Diego,<div><br></div><div>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.</div><div><br>
</div><div>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 :)</div>
<div><br></div><div>Bests,</div><div><br></div></div><div class="gmail_extra"><div class="gmail_quote">On Fri, Jul 25, 2014 at 4:31 AM, Lozano Soldevilla, D. (Diego) <span dir="ltr"><<a href="mailto:d.lozanosoldevilla@fcdonders.ru.nl" target="_blank">d.lozanosoldevilla@fcdonders.ru.nl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Azadeh,<br>
<br>
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.<br>
<br>
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:<br>
<br>
mri = ft_read_mri('/home/common/matlab/fieldtrip/template/anatomy/single_subj_T1_1mm.nii');<br>
mri.coordsys = 'spm';<br>
<br>
cfg = [];<br>
cfg.brainsmooth = 5%(default = 5)<br>
cfg.scalpsmooth = 5%(default = 5)<br>
cfg.brainthreshold = 0.25%(default = 0.5)<br>
cfg.scalpthreshold = 0.25%(default = 0.1)<br>
<div class=""><br>
cfg.output = {'brain','skull','scalp'};<br>
</div>seg = ft_volumesegment(cfg, mri);<br>
<br>
cfg = [];<br>
cfg.funparameter = 'scalp';<br>
ft_sourceplot(cfg,seg);<br>
<br>
<br>
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:<br>
<br>
mri = ft_read_mri('/home/common/matlab/fieldtrip/external/spm8/templates/T1.nii');<br>
mri.coordsys = 'spm';<br>
<br>
cfg = [];<br>
cfg.brainsmooth = 2%(default = 5)<br>
cfg.scalpsmooth = 2%(default = 5)<br>
cfg.brainthreshold = 0.25%(default = 0.5)<br>
cfg.scalpthreshold = 0.15%(default = 0.1)<br>
<div class=""><br>
cfg.output = {'brain','skull','scalp'};<br>
</div>seg = ft_volumesegment(cfg, mri);<br>
<br>
cfg = [];<br>
cfg.funparameter = 'scalp';%check the brain and skull too<br>
ft_sourceplot(cfg,seg);<br>
<br>
<br>
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?:<br>
<br>
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)<br>
<br>
Thanks in advance,<br>
<br>
Diego<br>
<br>
<br>
----- Original Message -----<br>
> From azadehh at <a href="http://uvic.ca" target="_blank">uvic.ca</a> Sat Jul 19 00:26:06 2014<br>
> From: azadehh at <a href="http://uvic.ca" target="_blank">uvic.ca</a> (Azadeh Hajihosseini)<br>
> Date: Fri, 18 Jul 2014 15:26:06 -0700<br>
> Subject: [FieldTrip] Source analysis of EEG oscillatory activity/ NaN<br>
<div class="">> values<br>
> in the leadfield matrices<br>
</div>> Message-ID:<br>
> <<a href="mailto:CA%2BAyeFcNNontNAxpRDYU6_TxCTNrCQ8KpE-QFtwOyKVEvfBF_Q@mail.gmail.com">CA+AyeFcNNontNAxpRDYU6_TxCTNrCQ8KpE-QFtwOyKVEvfBF_Q@mail.gmail.com</a>><br>
<div class="">><br>
> Hello FieldTrip members,<br>
><br>
> I am trying to source localize EEG oscillatory activity and have a few<br>
> problems in constructing the forward model and eventually running the<br>
> source analysis. I think the problems are related to each other. Here<br>
> is<br>
> what happens:<br>
><br>
> 1- When I run the source analysis, I get this error message:<br>
><br>
</div>> *??? Error using ==> svd*<br>
> *Input to SVD must not contain NaN or Inf.*<br>
><br>
> *Error in ==> beamformer_dics>pinv at 650*<br>
> * [U,S,V] = svd(A,0);*<br>
><br>
> *Error in ==> beamformer_dics at 339*<br>
> * filt = pinv(lf' * invCf * lf) * lf' * invCf; % Gross<br>
> eqn. 3, use PINV/SVD to cover rank*<br>
> * deficient leadfield*<br>
><br>
> *Error in ==> ft_sourceanalysis at 572*<br>
> * dip(i) = beamformer_dics(grid, sens, vol, [], squeeze(Cf(i,:,:)),<br>
> optarg{:});*<br>
><br>
> *Error in ==> test_sourceanalysis at 12*<br>
> *sourceTF = ft_sourceanalysis(cfg, data_TF);*<br>
<div class="">><br>
><br>
> 2- Checking the leadfiled matrices, I see there are a lot of NaN<br>
> values.<br>
> 3- When I visualize the head model I have created, the plots don't<br>
> look<br>
</div>> right. The third field, *vol.bnd(3),* which is supposed to be the<br>
<div class="">> brain<br>
> tissue, looks like a cube.<br>
><br>
> And here are my code lines:<br>
><br>
</div>> *% CONSTRUCT A HEAD MODEL from the template mri in FT's<br>
> template/anatomy*<br>
> *mri = ft_read_mri('template\anatomy\single_subj_T1.nii');*<br>
> *mri.coordsys = 'spm';*<br>
><br>
> *%SEGMENTATION:*<br>
> *cfg = [];*<br>
> *cfg.output = {'brain','skull','scalp'};*<br>
> *segmentedmri_template = ft_volumesegment(cfg, mri); % Using NOT<br>
> resliced<br>
> data*<br>
> *save segmentedmri_template segmentedmri_template*<br>
><br>
><br>
> *%CREATE THE HEAD MODEL (VOLUME CONDUCTION MODEL)*<br>
> *cfg = [];*<br>
> *cfg.method ='bemcp';*<br>
> *cfg.tissue ={'brain','skull','scalp'};*<br>
> *% cfg.outputfile = 'template_';*<br>
> *vol = ft_prepare_headmodel(cfg, segmentedmri_template);*<br>
> *save vol vol*<br>
><br>
> *%Visualization of the head model*<br>
> *figure;*<br>
> *ft_plot_mesh(vol.bnd(1),'facecolor','none'); %scalp *<br>
> *figure;*<br>
> *ft_plot_mesh(vol.bnd(2),'facecolor','none'); %skull*<br>
> *figure;*<br>
> *ft_plot_mesh(vol.bnd(3),'facecolor','none'); %brain This one looks<br>
> like a<br>
> cube*<br>
><br>
> *% Align electrodes *<br>
> *elec = ft_read_sens('template\electrode\standard_1020.elc'); *<br>
> *% load volume conduction model*<br>
> *% load vol; *<br>
><br>
> *%interactive allignment*<br>
> *cfg = [];*<br>
> *cfg.method = 'interactive';*<br>
> *cfg.elec = elec;*<br>
> *cfg.headshape = vol.bnd(1);*<br>
> *elec_aligned = ft_electroderealign(cfg);*<br>
><br>
> *save elec_aligned elec_aligned*<br>
><br>
> *% Prepare leadfield*<br>
> *load data_TF*<br>
> *cfg=[];*<br>
> *cfg.vol = vol; %structure with volume conduction model*<br>
> *cfg.elec = elec_aligned;%structure with electrode positions*<br>
> *[grid] = ft_prepare_leadfield(cfg, data_TF);*<br>
><br>
> *% Find source*<br>
> *cfg = []; *<br>
> *cfg.method = 'dics';*<br>
> *cfg.frequency = 25; *<br>
> *cfg.grid = grid; *<br>
> *cfg.vol = vol;*<br>
> *cfg.latency = .4;%single number in seconds, for time-frequency<br>
> analysis*<br>
> *cfg.dics.projectnoise = 'yes';*<br>
> *cfg.dics.lambda = 0;*<br>
> *cfg.elec = elec_aligned;%structure with electrode positions*<br>
><br>
> *sourceTF = ft_sourceanalysis(cfg, data_TF);*<br>
><br>
><br>
> I am using *wavelet *with a *fourier* output for the time-frequency<br>
> analysis (*data_TF)*. Do you have any idea what might be wrong here?<br>
<div class="">><br>
> I also have a more general question. What type of time-frequency data<br>
> can<br>
</div>> be input to source analysis? *ft_freqanalysis* provides power, power<br>
<div class="HOEnZb"><div class="h5">> and<br>
> cross-spectra, and complex fourier outputs. But is source-localization<br>
> based on only power data correct? I couldn't find any explanations<br>
> regarding this issue in the tutorial.<br>
><br>
> I look forward to hearing from anyone who might have ideas about any<br>
> of<br>
> these issues!<br>
><br>
> Many thanks,<br>
><br>
> --<br>
> Azadeh HajiHosseini<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
PhD Student<br>
Neuronal Oscillations Group<br>
Donders Institute for Brain, Cognition and Behaviour<br>
Centre for Cognitive Neuroimaging<br>
Radboud University Nijmegen<br>
NL-6525 EN Nijmegen<br>
The Netherlands<br>
<a href="http://www.ru.nl/people/donders/lozano-soldevilla-d/" target="_blank">http://www.ru.nl/people/donders/lozano-soldevilla-d/</a></font></span><br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div><br clear="all"><div><br></div>-- <br>Azadeh HajiHosseini<br>
<br>Graduate student<br>Department of Psychology<br>University of Victoria<br><a href="http://web.uvic.ca/~lccl/" target="_blank">http://web.uvic.ca/~lccl/</a><br>
</div>