stuart-knock / BrainNetworkModels

Matlab code which was the basis of TheVirtualBrain scientific library.
GNU General Public License v3.0
9 stars 3 forks source link

Laplacian on Cortical Mesh #1

Open xelgzh opened 10 years ago

xelgzh commented 10 years ago

Hi Stuart,

I wanted to use your code to solve the Helmholtz equation on a cortical mesh. I've downloaded your BrainNetworkModels but haven't figured out how to implement the simulation. Specifically, I would like to know

1/ How to load and display the default cortex the Cortex_reg13.mat (I don't really need the connectivity data)

2/ How to run the scripts related to the Laplacian such that I can solve the Helmholtz equation on this surface.

Thanks!

stuart-knock commented 10 years ago

Hey,

I'm not checking gitHub or my mail that regularly at the moment. In case you haven't already figured this stuff out by yourself, I've added a few pointers for what's available below. While the Matlab code and TVB include elements that will be useful for you, the problem you want to solve is not what this code was written for, so won't provide a complete solution -- more details below.

For Matlab, the first thing to note is that I haven't properly checked the surface stuff recently (since publishing on GitHub), the surface stuff is built around matlab's TriRep object which isn't supported by Octave (I don't currently have access to matlab). That being said, last time I checked it worked...

All the Matlab functions have basic usage instructions in the header, as well as comments throughout the code. For displaying the mesh surface, in the PlottingTools directory:

SurfaceMesh() -- visualises the whole surface PlotLocalSurface() -- visualise a small piece of the mesh surface.

and for basic surface information there is a function in the Surfaces directory:

GetSurfaceSummaryInfo() -- which extract info such as number of vertices, edge-lengths, etc...

For the discrete approximation of the Laplace-Beltrami operator (2nd order spatial derivative operator), you want the function called MeshLaplacian() in the Surfaces directory. The biggest short coming with the Matlab version is that I never implemented a geodesic distance algorithm (I moved over to Python when I reached this point). This function just uses mesh distance, which isn't too bad a first approximation when using a fairly well regularise mesh, however I wouldn't consider it publication quality -- that is, for what you're doing it would be important to use geodesic rather than mesh distance. TVB includes a geodesic distance algorithm which is accessible via methods on the surface objects. As the surface in the Matlab and in TVB is the same, a short cut would be to use TVB/Python to get geodesic distances and then calculate the approximation of the Laplace-Beltrami operator using the Matlab code.

As far as actual algorithms for solving the Helmholtz equation on the surface, there isn't anything implemented for this purely spatial type of problem. All of the simulation code is about dynamic evolution on the surface (ie, temporal integration), and quite specifically about the inclusion of delays in this...

For TVB/python, take a look at the "Getting To Know Your Mesh Surface" tutorial:

https://github.com/the-virtual-brain/scientific_library/wiki/Tutorials

Unless someone has finalised it since I last looked, it is only partially written but it should get you started looking at the mesh and it's properties, which can be accessed via a method on the surface object. The surface visualisations make use of Mayavi, via the functions such as plot_surface() found in tvb/simulator/plot/tools.py

While I have done a basic port of the Matlab MeshLaplacian() function to python, so far it's not publicly available anywhere as it hasn't been properly tested... I do plan to get around to this, though it may be a while before I do.

Best, Stuart.

On 26 November 2013 13:31, xcavier notifications@github.com wrote:

Hi Stuart,

I wanted to use your code to solve the Helmholtz equation on a cortical mesh. I've downloaded your BrainNetworkModels but haven't figured out how to implement the simulation. Specifically, I would like to know

1/ How to load and display the default cortex the Cortex_reg13.mat (I don't really need the connectivity data)

2/ How to run the scripts related to the Laplacian such that I can solve the Helmholtz equation on this surface.

Thanks!

— Reply to this email directly or view it on GitHubhttps://github.com/stuart-knock/BrainNetworkModels/issues/1 .

xelgzh commented 10 years ago

Thanks for the reply. I've been playing around with the code and surface and it seems things are still working! Though there was an issue with the anisotropic cpp files in compile_mex. I am however wondering if its possible to split the default cortex into two; more specifically is it possible to work the two hemispheres separately?