larmor.surfaces#
Operations on surfaces.
Joins surfaces into one mesh, such as lh and rh. |
|
Keeps only the vertices where |
|
Computes the unit normal of every vertex, pointing out of the surface. |
- larmor.surfaces.concatenate_surfaces(surfaces)#
Joins surfaces into one mesh, such as lh and rh.
Only the value names every surface has are kept, and the reference only when all the surfaces have matching grids.
- Parameters:
surfaces (Sequence[Surface]) – The surfaces to join. Their faces are renumbered, in the order given.
- Returns:
Surface – The joined surface.
- Raises:
ValueError – If
surfacesis empty.- Return type:
- larmor.surfaces.keep_vertices(surface, mask)#
Keeps only the vertices where
maskis True, such as the cortex of a label.Faces that touch a removed vertex are removed, the kept faces are renumbered, and
vertex_datais sliced to match; the reference is kept. Removing the medial wall:mask = np.zeros(white.num_vertices, dtype=bool) mask[read_freesurfer_label(“lh.cortex.label”)] = True cortex = keep_vertices(white, mask)
- Parameters:
- Returns:
Surface – The kept part. Its vertex numbering differs from
surface’s.- Raises:
ValueError – If
maskis not a boolean array with one entry per vertex.- Return type: