Back to the main page.

Bug 3042 - implement support for reading/converting brainstorm cortical surface+labels

Status REOPENED
Reported 2016-01-13 14:20:00 +0100
Modified 2016-01-15 12:36:32 +0100
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P5 normal
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks:
See also:

Robert Oostenveld - 2016-01-13 14:20:29 +0100

here at the workshop in Marseille we encountered an interesting use case of first brainstorm, followed by a FT analysis. For that it would be nice to continue in FT on the same (cortical) source model.


Robert Oostenveld - 2016-01-13 14:21:45 +0100

I got a "tess_cortex_pial_low.mat" file, which I plan to convert to a structure compatible with FT_DATATYPE_PARCELLATION (which is the FT version of the same stuff in the file).


Robert Oostenveld - 2016-01-13 14:23:48 +0100

The idea is that >> filename = 'tess_cortex_pial_low.mat'; >> tess = load(filename) tess = Comment: 'cortex_15002V' Vertices: [15002x3 double] Faces: [29981x3 double] VertConn: [15002x15002 logical] VertNormals: [15002x3 double] Curvature: [15002x1 single] SulciMap: [15002x1 double] Reg: [1x1 struct] History: {7x3 cell} tess2mri_interp: [16777216x15002 double] mrimask: [256x256x256 logical] Atlas: [1x6 struct] iAtlas: 4 to have >> ft_read_atlas(filename) Error using ft_read_atlas (line 2182) the mat-file tess_cortex_pial_low.mat does not contain a variable called 'atlas' return a structure compatible with FT_DATATYPE_PARCELLATION


François Tadel - 2016-01-13 14:51:01 +0100

Note that many of the fields in the surfaces are not present immediately after importing the anatomy of the subject. - VertConn, VertNormals, Curvature, SulciMap: Computed the first time the surface is loaded for display (see brainstorm3/toolbox/io/in_tess_bst.m) - Reg: contains the registered spheres from FreeSurfer, or squares from BrainSUite. - tess2mri_interp: Interpolation matrix between the surface and the MRI, computed only when needed. - mrimask: Volume mask corresponding to this surface, computed only when needed. - Atlas: ROIs, user-defined parcellations or FreeSurfer/BrainSuite atlases. Do you need help with anything?


Jan-Mathijs Schoffelen - 2016-01-13 14:53:55 +0100

I don't know about the brainstorm specifics, but do the brainstorm source models also come without an atlas? in that case we might want to consider also building in functionality in ft_read_headshape. When reading in freesurfer files, or hcp .gii files things like .curv and .sulc are added to the mesh. These map directly onto Curvature and SulciMap respectively.


François Tadel - 2016-01-13 14:59:33 +0100

The atlases are only saved in the surface files. The information is not copied to the source models: when reading a head model, you also need to read the surface file pointed by the .SurfaceFile field. Curvature, SulciMap: Computed from Brainstorm. The files read from the FreeSurfer segmentation folders are listed here: http://neuroimage.usc.edu/brainstorm/Tutorials/LabelFreeSurfer#Importing_the_results_in_Brainstorm


Robert Oostenveld - 2016-01-15 12:35:02 +0100

I have added support for the BrainStorm cortical sheets including the atlas details. mac011> svn commit `cat out` Sending fileio/ft_read_atlas.m Sending fileio/ft_read_headshape.m Adding test/test_bug3042.m Sending utilities/copyfields.m Adding utilities/renamefields.m Transmitting file data ..... Committed revision 11062. mac011> svn commit `cat out` Sending test/test_bug3042.m Transmitting file data . Committed revision 11063. It will be included in the FTP release of this evening. With this support, it is now possible to do cfg = ... cfg.sourcemodel = ft_read_headshape(brainstorm file) sourceresult = ft_sourceanalysis(cfg, data) and subsequently for example atlas = ft_read_atlas(brainstorm file) cfg = []; cfg.parcellation = 'destrieux'; parcels = ft_sourceparcellate(cfg, sourceresult, atlas); which will average the estimated source parameters over the atlas parcels. Other options besides averaging are in cfg.method and include the option of computing the largest eigenvector.


Robert Oostenveld - 2016-01-15 12:36:32 +0100

Oh, I should not have closed. I think it would be good to follow up with a more complete example. The only one I have now is based on a single file from Valerie (CC).