In [1]:
%pylab nbagg
from tvb.simulator.lab import *

Populating the interactive namespace from numpy and matplotlib
INFO  log level set to INFO


# Exploring a surface mesh¶

Surface level simulations in TVB use a triangular mesh surface to represent the folded cortical surface, similar triangular mesh surfaces are used to represent the boundaries between brain and skull, skull and skin, and skin and air, that are used in the calculation of EEG and MEG forward solutions. This tutorial covers a few basic ways of looking at the properties of these surfaces.

One of the things we'll be looking for is how well regularised the mesh is -- a well regularised a mesh has a narrow distribution of edge lengths and triangle areas. For most uses in TVB, it is important to have a well regularised mesh.

In [2]:
ctx = cortex.Cortex(load_default=True)
ctx.configure()
ctx

Out[2]:

We can see a number of basic properties of the mesh here, such as the number of vertices, edges and triangles making up the surface. A summary of the edge lengths is also included, this is useful to know what scale of features, eg LocalConnectivity, we can expect to be able to represent on this surface. As a Cortex also has a large-scale Connectivity associated with it we see some "Region" information as well, here it is TVB's default 76 region connectivity matrix. As we can see, this Connectivity parcellates the cortex into regions with a fairly broad range of sizes.

Looking in more detail, we can plot the distributions of things like edge lengths and triangle areas to see in more detail whether the mesh is well regularised...

In [5]:
figure(figsize=(10, 5))
subplot(121)
hist(ctx.edge_lengths, bins=100)
title("Distribution of Edge Lengths")
xlabel("mm")

subplot(122)
hist(ctx.triangle_areas, bins=100)
title("Distribution of Triangle Areas")
xlabel("mm$^2$")

Out[5]:
<matplotlib.text.Text at 0x1a0fd400>
 Number of edges 49140 Edge lengths, shortest (mm) 0.663807708237 Number of vertices 16384 Region area, minimum (mm:math:^2) 540.903695267 Has two hemispheres False Number of triangles 32760 Edge lengths, longest (mm) 7.75671824544 Number of regions 76 Region area, maximum (mm:math:^2) 9333.39347792 Region area, mean (mm:math:^2) 3038.51244522 Edge lengths, mean (mm) 3.97605292871 Surface type Cortex