[FieldTrip] Fixing headmodel vertices
Hassan Aleem
ha438 at georgetown.edu
Sun Feb 21 00:23:01 CET 2016
Hi Everyone,
New to fieldtrip. My headmodel looks pretty good except for a couple
vertices that are poking in. Is there any way to address them specifically?
The code I used is similar to one provided by someone who was successful.
As follows
mri.coordsys ='SPM'
cfg = [];
cfg.brainthreshold = 0.15;
cfg.scalpthreshold = 0.3;
cfg.downsample = 1; %no downsampling
cfg.output = {'brain' 'scalp' 'skull'};
segment = ft_volumesegment(cfg, mri);
cfg = [];
cfg.method = 'projectmesh';
cfg.numvertices = 10000;
bnd = ft_prepare_mesh( cfg, seg);
% 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'; %openmeeg doesnt work with multiple output from
ft_volumesegment
vol = ft_prepare_headmodel(cfg, bnd);
clear bnd
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160220/01254e03/attachment-0001.html>
More information about the fieldtrip
mailing list