[FieldTrip] Creating a MRI based headmodel

IMALI THANUJA HETTIARACHCHI ith at deakin.edu.au
Tue Jun 5 05:32:07 CEST 2012


Dear All,

I started with fieldTrip recently and I am trying to create a BEM headmodel using the mri data (standard_mri.mat) available on the website. I use the following code

load standard_mri.mat
mri_orig=mri;

% Realign the data to the CTF system

cfg = [];
cfg.method = 'interactive';
% use n,l,r fudicials
mri_realign = ft_volumerealign(cfg, mri_orig);

cfg = [];
cfg.resolution = 1; % mm
cfg.dim = mri_orig.dim;
mri_reslice = ft_volumereslice(cfg, mri_realign);

%% Segmenting the data

cfg = [];
cfg.output= {'scalp','skull','brain'};
cfg.coordinates    = 'ctf';
cfg.keepintermediate = 'no';
[mri_segment] = ft_volumesegment(cfg, mri_reslice);
mri_combine = mri_reslice;
mri_combine.seg  = mri_segment.scalp + 3*mri_segment.skull + 6*mri_segment.brain;
mri_combine.mask = (mri_combine.seg)>0;

%%  Plot data

cfg = [];
cfg.interactive   = 'no';
cfg.method='slice';
cfg.funparameter  = 'seg';
cfg.funcolormap   = 'jet';
cfg.funcolorlim = [0 7];
cfg.opacitylim    = [0 1.5];
cfg.maskparameter = 'mask';
figure , ft_sourceplot(cfg,mri_combine);
%% Generating the mesh

    cfg=[];
    cfg.tissue=[1 2 3];
    cfg.numvertices=[5000 3000 800];
    cfg.sourceunits=mri_segment.unit;
    scalp=(mri_segment.scalp)&~(mri_segment.skull | mri_segment.brain);
    skull=2*(mri_segment.skull);
    brain=3*(mri_segment.brain);
    mri_segment.seg= scalp+skull+brain;
    bnd = ft_prepare_mesh(cfg, mri_segment);
%% View meshes a transparent plot

figure (2)
tr1=TriRep(bnd(1).tri,bnd(1).pnt(:,1),bnd(1).pnt(:,2),bnd(1).pnt(:,3));
tr2=TriRep(bnd(2).tri,bnd(2).pnt(:,1),bnd(2).pnt(:,2),bnd(2).pnt(:,3));
tr3=TriRep(bnd(3).tri,bnd(3).pnt(:,1),bnd(3).pnt(:,2),bnd(3).pnt(:,3));
       trisurf(tr1,'facealpha',0.1); hold on
       trisurf(tr2,'facealpha',0.2); hold on
       trisurf(tr3)


%% BEM Computation-calculating the related electromagnetic model
Cskin_surface= 0.33; %scalp
Couter_skull_surface=0.0042; %skull
Cinner_skull_surface=0.33; %brain
vol=[];
for i=1:3
vol.bnd(i).tri=bnd(i).tri;
vol.bnd(i).pnt=bnd(i).pnt;
end
vol.cond=[Cskin_surface Couter_skull_surface Cinner_skull_surface];
cfg=[];
cfg.method         = 'openmeeg';
vol = ft_prepare_headmodel(cfg, vol);
When I run the code at the stage of generating the headmodel with ft_prepare_headmodel, I get an error  as;
??? Error using ==> surface_nesting at 24
the compartment nesting cannot be determined

Error in ==> ft_headmodel_bem_openmeeg at 96
order = surface_nesting(vol.bnd, 'insidefirst');

With the limited experience with fieldTrip and headmodels I assume that this is because the meshes are overlapping.

I would really appreciate any guidance and any suggestions given to make this work.

Many thanks in advance.

Kind regards
Imali

Imali Thanuja Hettiarachchi
PhD Candidate
Centre for Intelligent Systems research
Deakin University, Geelong 3217, Australia.
Email: ith at deakin.edu.au<mailto:ith at deakin.edu.au>
www.deakin.edu.au/cisr<http://www.deakin.edu.au/cisr>

[Description: Description: Description: cid:1216BE20-1800-4A47-8B9F-E7B9D94831CD at deakin.edu.au]




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120605/7b4fc9a3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 29155 bytes
Desc: image001.jpg
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120605/7b4fc9a3/attachment-0001.jpg>


More information about the fieldtrip mailing list