Back to the main page.

Bug 1836 - ft_write_headshape has to be extended to allow the export of FEM meshes

Status CLOSED FIXED
Reported 2012-11-16 09:48:00 +0100
Modified 2014-07-15 17:25:06 +0200
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P3 normal
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks:
See also:

Robert Oostenveld - 2012-11-16 09:48:19 +0100

Right now ft_read_headshape can read tetgen and vista files, and the meshes can be edited in MATLAB. But there is no way to export them. That means that MATLAB edited meshes can also not be visualized in tetview. See http://tetgen.berlios.de/tetview.html Although we want to extend ft_plot_mesh (see bug 1833), we also want to be able to use external viewers because they are likely much faster. And we want to use tetgen Which formats are desirable for writing to?


Johannes Vorwerk - 2012-11-16 10:34:59 +0100

I can't say very much about tetview, since I never got it running on my office machine and thus never used it. File format is probably the same as the output from tetgen? We mainly use Scirun (http://www.sci.utah.edu/cibc-software/scirun.html) for visualization here, which can read meshes directly as matlab-structs if they are in the right format (example.node, example.cell, example.field), so that this should be quite easy to implement. Interesting might also be gmsh (http://geuz.org/gmsh/), we are currently working on a writer for the .msh format.


Robert Oostenveld - 2012-11-16 10:55:06 +0100

(In reply to comment #1) your report on the difficulty getting tetview to run is interesting in itself. Then we should not try too hard. At this moment there are mac001> grep case ft_write_headshape.m case 'mne_pos' case 'mne_tri' case 'off' case 'vista' case 'tetgen' case 'stl' case 'gifti' we could make a "scirun_mat" export format. It would just convert the structure and then save to the mat file. The "gmsh_msh" would then also be a desired format. The tetgen section currently reads case 'tetgen' % the third argument is the element type. At the moment only type 302 % (triangle) is supported surf_to_tetgen(filename, bnd.pnt, bnd.tri, 302*ones(size(bnd.tri,1),1),[],[]); and makes use of fileio/private/surf_to_tetgen.m which is a function from Arno. So the tetgen section has to be extended with tet and hex meshes. I also notice that the tri is now written to a poly file, whereas I suspect a face file would make more sense. Is this something that Jakub could work on?


Lilla Magyari - 2012-12-21 15:16:51 +0100

(In reply to comment #2) hi all, ft_write_headshape doesn't write hexahedral meshes properly in ply format, see test/test_bug1836. Lilla


Johannes Vorwerk - 2013-01-03 16:21:20 +0100

(In reply to comment #3) Actually, I couldn't find any hint that the ply-format supports hexahedrons. Do we know that this is possible?


Robert Oostenveld - 2013-01-04 12:32:36 +0100

(In reply to comment #4) http://paulbourke.net/dataformats/ply/ suggests that any number of vertices per polygon is possible.


Johannes Vorwerk - 2013-01-07 10:55:21 +0100

(In reply to comment #5) That's true, but I couldn't find any information how the vertices should be oriented, which is somehow more crucial in the hexahedron case then for tetrahedrons.


Robert Oostenveld - 2014-05-20 09:36:13 +0200

following the meeting yesterday, I decided to look into the open bugs. This one has to do with visualisation. Playiung around with test_bug1836 and mesh lab, it seems to me that *.ply can only contain surface elements, where the last vertex always gets connected to the first. That means that we should not use this file format for representing hexaheders, but we can use it for the sides of the cubes. Each hexaheder would be described by 6 polygons, each with 4 vertices.


Robert Oostenveld - 2014-05-20 10:02:54 +0200

I resolved it by converting the volume elements to faces. mac011> svn commit fileio/private/write_ply.m test/test_bug1836.m Sending fileio/private/write_ply.m Sending test/test_bug1836.m Transmitting file data .. Committed revision 9552. the output of test_bug1836 now looks fine in meshlab


Robert Oostenveld - 2014-07-15 17:25:06 +0200

Closed several bugs that were recently resolved. If it is closed in error, please reopen.