[FieldTrip] Antw: Creating a head model using OPENMEEG - Intersecting mesh error

Roey Schurr roeysc at gmail.com
Tue Feb 18 14:16:54 CET 2014


Dear Daniel and all,

First, thank you very much for your advice and codes. They have proved very
helpful, and now I have obtained some very good brain-skull-scalp meshes!

I am now having a problem using OPENMEEG to actually compute the leadfield
based on these meshes, using the following code on frequency domain data:

    cfg=[];
    cfg.method  = 'dics';
    cfg.elec = elec;
    cfg.grid = grid;
    cfg.vol = vol;
    cfg.frequency = 10; % The mean frequency in the band
    cfg.keepfilter  = 'yes';

    sourceCombined = ft_sourceanalysis(cfg, freqCombined);


The problem arises at the function "ft_leadfield_openmeeg" who tries using
OPENMEEG installed on my PC (indeed there is a warning "warning('Sorry,
Windows is not yet tested');" in this function).
To fix onw of the bugs using a PC I changed line 94 to:

    basefile = tempname;
    [clearme basefile] = fileparts(basefile);
    clear clearme;

but even so, every line who tries to actually use OPENMEEG, such as line
149:

    system([fullfile(OPENMEEG_PATH, 'om_check_geom'), ' -g ', geomFile])

fails to do so.
For instance, I get a Windows error window that says "om_assemble.exe has
stopped working" and "om_minverser.exe has stopped working", and also:

Computing inverse head matrix
    187         system([fullfile(OPENMEEG_PATH, 'om_minverser'), ' ',
hmFile, ' ', hminvFile]);
    C:\OpenMEEG\bin\om_minverser version 2.1.0 (799) compiled at Aug 17
2011 19:50:11

    | ------ C:\OpenMEEG\bin\om_minverser
    |
C:\Users\Roey\AppData\Local\Temp\ft-om\tp2f33a1b9_510f_4d55_805d_7ed6ce3b22e3_hm.bin
    |
C:\Users\Roey\AppData\Local\Temp\ft-om\tp2f33a1b9_510f_4d55_805d_7ed6ce3b22e3_hminv.bin
    | -----------------------
    Exception: Unable to open the file
C:\Users\Roey\AppData\Local\Temp\ft-om\tp2f33a1b9_510f_4d55_805d_7ed6ce3b22e3_hm.bin
for reading Doing my best....

So it seems like OPENMEEG cannot open the file ending with "_hm.bin". This
file indeed does no exist.


I am using Matlab 2011b, full fieldtrip version of 17022014, Windows 7 64
bit, and OPENMEEG with om_assemble version 2.1.0 (799) compiled at Aug 17
2011 19:50:41.

Must I use a Macintosh or Linux computer to make this work?

Any ideas would be greatly appreciated!
Thank you very much in advance,

Roey


On Mon, Jan 20, 2014 at 8:10 PM, Daniel Wong <dan.wong.c at utoronto.ca> wrote:

> You can try using the new iso2mesh meshing option that was recently added
> by myself, Sarang Dalal, and Robert Oostenveld:
>
> cfg.method = 'iso2mesh';
> cfg.numvertices = 10000;   % We'll decimate later - this gives nicer
> results
> bnd = ft_prepare_mesh(cfg,seg);
>
> % Decimate to a 1000, 2000, 3000 node mesh (scalp, skull, brain)
> [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));
>
> The latest version of OpenMEEG automatically fixes mesh orientations, but
> if you have an older version of OpenMEEG, you'll need to set bnd(ii).tri =
> bnd(ii).tri(:,[3 2 1]) to fix the orientation error that you'll get - at
> least until we hard code that fix into FieldTrip.
>
> Also, assuming your meshes look like they should (use ft_plot_mesh to
> check), if you still have a problem with meshes intersecting each other,
> you will find a subfunction called decouplesurf that is temporarily stashed
>  at the end of prepare_mesh_segmentation.m.  Copy this function into a new
> m-file (decouplesurf.m) and use it to fix those intersections as follows:
>
> bnd = decouplesurf(bnd);
>
> Note, this will not fix self-intersections. If you're really having a bad
> day, try using the iso2mesh toolbox meshcheckrepair function:
> % Check and repair mesh
> [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');
>
> This info should eventually find its way onto the FieldTrip tutorial
> pages...
>
>
> Best Regards,
> Daniel Wong
>
> Daniel Wong, PhD (IBBME, University of Toronto)
> Postdoctoral Researcher
> Department of Psychology
> University of Konstanz
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140218/97fcb8ae/attachment.html>


More information about the fieldtrip mailing list