[FieldTrip] Headmodel with NeuroScan meshes

IMALI THANUJA HETTIARACHCHI ith at deakin.edu.au
Wed Jun 6 10:48:30 CEST 2012


Dear FieldTrip users,



As I have faced problems in creating a head model with MRI's, so I thought to try the MNI head for creating the meshes. I used the NeuroScan software to create the surface meshes and exported them to Matlab. Then tried to crate the head model using ft_prepare_headmodel function.  however the 'om_minverser' stops working and the program terminates.



When I plot the meshes they seem fine to me so I assume that there is no segmenting issues. But Now I get an error as attached in the 'log.txt' from the Matlab workspace, which says about self intersecting meshes. I have attached the Neuroscan exported meshes (innerSkull.mat,outerSkull.mat,skin.mat) and the Matlab function (m_file.txt) that I used in creating the head model.



I really want to generate some simulated EEG data but cannot make anything work. If someone can give a guidance on where I am going wrong in the procedure , that will be highly appreciated.



Many thanks.



Kind regards

Imali



________________________________
From: IMALI THANUJA HETTIARACHCHI
Sent: Tuesday, 5 June 2012 1:32 PM
To: fieldtrip at science.ru.nl
Subject: Creating a MRI based headmodel

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/20120606/750b2c5f/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/20120606/750b2c5f/attachment-0001.jpg>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: log.txt
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120606/750b2c5f/attachment-0002.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: m_file.txt
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120606/750b2c5f/attachment-0003.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: innerSkull.mat
Type: application/octet-stream
Size: 141056 bytes
Desc: innerSkull.mat
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120606/750b2c5f/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: outerSkull.mat
Type: application/octet-stream
Size: 98624 bytes
Desc: outerSkull.mat
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120606/750b2c5f/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: skin.mat
Type: application/octet-stream
Size: 100160 bytes
Desc: skin.mat
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120606/750b2c5f/attachment-0005.obj>


More information about the fieldtrip mailing list