[FieldTrip] Thank you for beamformer help
Tyler Grummett
tyler.grummett at flinders.edu.au
Fri Jul 11 03:31:11 CEST 2014
Hello fieldtrip,
I just wanted to thank the following people for helping me with my beamformer issues:
Eelke Spaak, Roey Schurr, Matt craddock, Julian Keil and of course Jorn Horschig.
For the sake of helping other, I want to collate the help so that it is all in one place.
--------------------------------------
With the help of Roey Schurr and Matt craddock I calculated the headmodel as follows:
% % load in template files
temp = load( fullfile( matlabrootpath, 'Matlab', 'fieldtrip', ...
'template', 'headmodel', 'standard_mri.mat'));
mri = temp.mri; clear temp
% segment MRI (return probabilistic tissue maps of gray/white/csf
% compartments
cfg = [];
cfg.write = 'no';
cfg.coordsys = 'spm';
cfg.output = { 'scalp', 'skull', 'brain'};
segmentedmri = ft_volumesegment(cfg, mri);
cfg = [];
cfg.method = 'iso2mesh';
cfg.numvertices = 10000;
bnd = ft_prepare_mesh( cfg, segmentedmri);
% fix mesh
[ bnd( 1).pnt, bnd( 1).tri] = meshresample( bnd( 1).pnt, bnd( 1).tri, 1000/size( bnd( 1).pnt, 1));
[ bnd( 2).pnt, bnd( 2).tri] = meshresample( bnd( 2).pnt, bnd( 2).tri, 2000/size( bnd( 2).pnt, 1));
[ bnd( 3).pnt, bnd( 3).tri] = meshresample( bnd( 3).pnt, bnd( 3).tri, 3000/size( bnd( 3).pnt, 1));
for ii = 1:size( bnd),
[ bnd( ii).pnt, bnd( ii).tri] = meshcheckrepair( bnd( ii).pnt, bnd( ii).tri, 'dup');
[ bnd( ii).pnt, bnd( ii).tri] = meshcheckrepair( bnd( ii).pnt, bnd( ii).tri, 'isolated');
[ bnd( ii).pnt, bnd( ii).tri] = meshcheckrepair( bnd( ii).pnt, bnd( ii).tri, 'deep');
[ bnd( ii).pnt, bnd( ii).tri] = meshcheckrepair( bnd( ii).pnt, bnd( ii).tri, 'meshfix');
end
% calculate headmodel % reordered to brain skull scalp
cfg = [];
cfg.method = 'bemcp';
vol = ft_prepare_headmodel(cfg, bnd);
clear bnd
--------------------------------------
The electrode positions were fixed from literally taking the electrode positions from the template, at first I interpreted Matt's suggestions as using a function to do it. It is very clear that just copying the positions are the way to go.
% Get electrode positions from template
temp_electrodes = ft_read_sens( fullfile( matlabrootpath, 'Matlab', 'fieldtrip', ...
'template', 'electrode', 'standard_1005.elc'));
match = ismember( temp_electrodes.label, data.elec.label);
temp_pos = temp_electrodes.chanpos( match, :);
data.elec.label = temp_electrodes.label( match);
data.elec.chanpos = temp_pos;
data.elec.elecpos = data.elec.chanpos;
% add LPA RPA and Nasian labels
data.elec.label{ end+1} = temp_electrodes.label{ 1};
data.elec.label{ end+1} = temp_electrodes.label{ 2};
data.elec.label{ end+1} = temp_electrodes.label{ 3};
% add LPA RPA and Nasian positions
data.elec.chanpos( end+1, :) = temp_electrodes.chanpos( 1, :);
data.elec.chanpos( end+1, :) = temp_electrodes.chanpos( 2, :);
data.elec.chanpos( end+1, :) = temp_electrodes.chanpos( 3, :);
data.elec.elecpos = data.elec.chanpos;
--------------------------------------
Then finally the sourcemodel can be calculated:
% calculate sourcemodel
cfg = [];
cfg.mri = mri;
cfg.vol = vol;
cfg.grid.warpmni = 'yes';
cfg.grid.template = template.sourcemodel;
cfg.grid.nonlinear = 'yes';
cfg.moveinward = 1; % actually uses vol mesh
cfg.inwardshift = 0; % needs to be expressed to work with moveinward
cfg.elec = timelock.elec;
sourcemodel = ft_prepare_sourcemodel( cfg);
--------------------------------------
Thank you to everyone that has helped me. I gladly appreciate it.
Im really sorry for all the emails as well.
There will be another coming because the beamformer technique works for 2 datasets (out of four) and I cant work out why it isnt working for two datasets.
Kind regards,
Tyler
*************************
Tyler Grummett ( BBSc, BSc(Hons I))
PhD Candidate
Brain Signals Laboratory
Flinders University
Rm 5A301
Ext 66124
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140711/694ec78e/attachment-0001.html>
More information about the fieldtrip
mailing list