[FieldTrip] Fwd: Source Analysis from EEG data
Cristiano Micheli
michelic72 at gmail.com
Thu Jun 1 09:20:30 CEST 2017
Dear Kastouri,
the error might come from an incorrect realignment of the segmented volumes
or from a failure to segment the mri into the wished compartments. You
could check the mri images by browsing through the slices with
ft_sourcplot([],mri).
If the mri images are of low quality or contain artefacts, due to set-up
devices such as scaffoldings, or ROI boxed images (limiting the volume of
acquisition) you are in trouble.
If you pass the previous check, try again to plot the tessellated surfaces
in the same image. Have you done that yet?
Best
Cris
On Thu, Jun 1, 2017 at 8:27 AM, Kasturi Barik <kash.kgp at gmail.com> wrote:
> Dear all,
>
> As per last suggestion, I again focus on constructing head-model to generate
> a proper forward model for localization purposes.
>
> *CODE:*
>
> %% 1. read the anatomical data with ft_read_mri;
> load('standard_mri.mat');
> disp(mri)
> save mri mri
>
> %% Align the coordinate system
> cfg = [];
> cfg.method = 'interactive';
> cfg.coordsys = 'spm';
> cfg.snapshot = 'yes';
> [mri_aligned] = ft_volumerealign(cfg,mri);
> save mri_aligned mri_aligned
>
> %% 2. SEGMENTATION
> % set path of means go to : D:\MATLAB\toolbox\fieldtrip-
> 20140401\external\spm8
> cfg = [];
> cfg.output = {'brain','skull','scalp'};
> segmentedmri = ft_volumesegment(cfg, mri_aligned);
> save segmentedmri segmentedmri
>
> %% 3. triangulate the surfaces with ft_prepare_mesh;
> cfg = [];
> cfg.tissue = {'brain','skull','scalp'};
> cfg.numvertices = [3000 2000 1000];
> bnd = ft_prepare_mesh(cfg,segmentedmri);
> save bnd bnd
>
> %% 4. Create headmodel
> cfg = [];
> cfg.method = 'bemcp'; % You can also specify 'openmeeg', 'bemcp', or
> another method.
> % cfg.conductivity = [0.3300 0.0041 0.3300];
> vol1 = ft_prepare_headmodel(cfg, bnd);
>
> *When running these settings **I am getting the following error message:*
>
> Error using surface_nesting (line 26)
> the compartment nesting cannot be determined
>
> Error in ft_headmodel_bemcp (line 66)
> order = surface_nesting(vol.bnd, 'insidefirst');
>
> Error in ft_prepare_headmodel (line 257)
> vol = ft_headmodel_bemcp(geometry, 'conductivity',
> cfg.conductivity);
>
> I am not able to detect, where is the problem. I would be very thankful
> if you can help me in this regard.
>
> On Wed, May 31, 2017 at 5:19 PM, Cristiano Micheli <michelic72 at gmail.com>
> wrote:
>
>> Dear Kastouri,
>>
>> My hunch is that either ft_prepare_headmodel or ft_prepare_leadfield fail
>> in generating a proper forward model for localization purposes.
>> I would check that ft_prepare_headmodel's vol structure contains sensible
>> data by plotting both the 'bnd' triangulated surface and the EEG electrodes
>> together (you should be able to find instructions on the wiki) in the same
>> image. Sometimes units (mm,cm) or coregistration (left/right swap) might
>> influence a good outcome.
>> Accordingly the grid.leadfield structure will not make sense because it
>> uses the incorrect outcome of the vol structure.
>>
>> So if you manage to solve the 1st problem you'll kill two bird with a
>> stone
>> Good luck!
>> Cris
>>
>>
>>
>>
>>
>> On Wed, May 31, 2017 at 12:50 PM, Kasturi Barik <kash.kgp at gmail.com>
>> wrote:
>>
>>> *Dear all,
>>> **I am trying to perform source localization in the frequency domain *
>>>
>>> *from EEG data using 'DICS' . As I have no mri data of the participants, *
>>>
>>> *I am using **'Subject01.mri' to read the anatomical data with ft_read_mri. *
>>>
>>> *The **head model created with 'bemcp'.*
>>>
>>> *Code:*
>>>
>>> *%% **Read the anatomical data*
>>>
>>> *mri = ft_read_mri('Subject01.mri');*
>>>
>>> *%% **Segment the anatomical information & triangulate the surfaces*
>>>
>>> *load segmentedmri % load from *ftp
>>> server
>>> <ftp://ftp.fieldtriptoolbox.org/pub/fieldtrip/tutorial/headmodel_eeg/segmentedmri.mat>
>>> (segmentedmri.mat).
>>> *load bnd*
>>>
>>> *%% **Create the headmodel*
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *cfg = [];cfg.method = 'bemcp'; vol =
>>> ft_prepare_headmodel(cfg, bnd);%% Position of the
>>> electrodesload('Face_sub.mat'); % data of
>>> participants' electrode positions electrodes = Face_sub.elec;%% Interactive
>>> alignmentcfg = [];cfg.method = 'interactive';cfg.elec =
>>> electrodes;cfg.headshape = vol.bnd(3); %
>>> scalpelec_aligned = ft_electroderealign(cfg);%% Compute leadfield:cfg
>>> = [];cfg.elec = elec_aligned;cfg.vol =
>>> vol;cfg.channel = {'EEG'};[grid] = ft_prepare_leadfield(cfg);%%
>>> Source Analysiscfg = []; cfg.method =
>>> 'dics';cfg.frequency = 10; cfg.grid = grid;cfg.vol =
>>> vol;cfg.dics.projectnoise = 'yes';cfg.dics.lambda = 0;sourceFace =
>>> ft_sourceanalysis(cfg, face_data); % face_data is obtained from the
>>> FT_FREQANALYSIS % [%% time frequency analysis
>>> || cfg = [];
>>> || cfg.channel = 'EEG'; ||
>>> cfg.method = 'mtmfft'; ||
>>> cfg.output = 'powandcsd'; ||
>>> cfg.tapsmofrq = 4; ||
>>> cfg.foi = 1:1:40; ||
>>> face_data = ft_freqanalysis(cfg, Face_sub); ]*
>>>
>>> *When running DICS with these settings **I am getting the following error message:*
>>>
>>>
>>> *Error using svd
>>> Input to SVD must not contain NaN or Inf.
>>>
>>> Error in beamformer_dics>pinv (line 650)
>>> [U,S,V] = svd(A,0);
>>>
>>> Error in beamformer_dics (line 339)
>>> filt = pinv(lf' * invCf * lf) * lf' * invCf;
>>> % Gross eqn. 3, use PINV/SVD to cover rank
>>> deficient leadfield
>>>
>>> Error in ft_sourceanalysis (line 568)
>>> dip(i) = beamformer_dics(grid, sens, vol, [],
>>> squeeze(Cf(i,:,:)), optarg{:});
>>>
>>> Error in SourceAnalysis (line 133)
>>> sourceFace = ft_sourceanalysis(cfg, face_data);*
>>>
>>>
>>> * I am not able to detect, where is the problem. Another issue I have found that 'vol.mat' or 'grid.leadfield' are all NaN value. I cannot understand how to solve it. I would be very thankful if you can help me in this regard. *
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Thanks & Regards
>>>
>>> *Kasturi Barik*
>>>
>>> MS Research Scholar
>>> Audio and Bio-signal Processing Lab
>>> Department of Electronics and Electrical Engineering
>>> Indian Institute of Technology Kharagpur
>>> Mob: +91-8902400644 <+91%2089024%2000644>
>>>
>>> _______________________________________________
>>> fieldtrip mailing list
>>> fieldtrip at donders.ru.nl
>>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>
>
>
> --
> Thanks & Regards
>
> *Kasturi Barik*
>
> MS Research Scholar
> Audio and Bio-signal Processing Lab
> Department of Electronics and Electrical Engineering
> Indian Institute of Technology Kharagpur
> Mob: +91-8902400644 <+91%2089024%2000644>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170601/00feb1e8/attachment-0002.html>
More information about the fieldtrip
mailing list