[FieldTrip] Creating a MRI based headmodel
Robert Oostenveld
r.oostenveld at donders.ru.nl
Fri Jun 8 10:51:29 CEST 2012
Dear Imali
One problem might be that the surfaces are intersecting, but with this clean template MRI I consider that unlikely. If it were the case, then we should revise the segmentation procedure for skull and skin.
An alternative for the problem is that it is due to the surfaces being incorrectly oriented (e.g. inside out).
So the problem you are descibing suggests that there is an error (or imperfection) in the code.
I have filed it as a bug on http://bugzilla.fcdonders.nl/show_bug.cgi?id=1510 under your name. The bug tracking system will automatically keep you posted on the updates.
best regards,
Robert
On 8 Jun 2012, at 3:05, IMALI THANUJA HETTIARACHCHI wrote:
> 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
> www.deakin.edu.au/cisr
>
> <image001.jpg>
>
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at science.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
More information about the fieldtrip
mailing list