Python Library to Read and Write Surface Files in Freesurfer's TriangularSurface Format
Project description
Python Library to Read and Write Surface Files in Freesurfer’s TriangularSurface Format
compatible with Freesurfer’s MRISwriteTriangularSurface() https://github.com/freesurfer/freesurfer/blob/release_6_0_0/include/mrisurf.h#L1281 https://github.com/freesurfer/freesurfer/blob/release_6_0_0/utils/mrisurf.c https://raw.githubusercontent.com/freesurfer/freesurfer/release_6_0_0/utils/mrisurf.c
Freesurfer https://surfer.nmr.mgh.harvard.edu/
Edit Surface File >>> from freesurfer_surface import Surface, Vertex, Triangle >>> >>> surface = Surface.read_triangular(‘bert/surf/lh.pial’)) >>> >>> vertex_a = surface.add_vertex(Vertex(0.0, 0.0, 0.0)) >>> vertex_b = surface.add_vertex(Vertex(1.0, 1.0, 1.0)) >>> vertex_c = surface.add_vertex(Vertex(2.0, 2.0, 2.0)) >>> surface.triangles.append(Triangle((vertex_a, vertex_b, vertex_c))) >>> >>> surface.write_triangular(‘somewhere/else/lh.pial’)
List Labels in Annotation File >>> from freesurfer_surface import Annotation >>> >>> annotation = Annotation.read(‘bert/label/lh.aparc.annot’) >>> for label in annotation.labels.values(): >>> print(label.index, label.hex_color_code, label.name)
Find Border of Labelled Region >>> surface = Surface.read_triangular(‘bert/surf/lh.pial’)) >>> surface.load_annotation_file(‘bert/label/lh.aparc.annot’) >>> region, = filter(lambda l: l.name == ‘precentral’, >>> annotation.labels.values()) >>> print(surface.find_label_border_polygonal_chains(region))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file freesurfer-surface-0.1.0.tar.gz
.
File metadata
- Download URL: freesurfer-surface-0.1.0.tar.gz
- Upload date:
- Size: 3.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2980ab01b4ae34c6f6352219f9ea618a8daf0e030087db4c09b96d265ff37fc |
|
MD5 | 0128b57bb964118d0f146189f1bff40a |
|
BLAKE2b-256 | b4beeb0cc13bae99bace056c842bee05dc2930e00c2cd40f54225a6597b793f9 |
Provenance
File details
Details for the file freesurfer_surface-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: freesurfer_surface-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffb623cfd96f7da3f8cda4331a8c04d3518cee5f37565ec575755c4d4177801b |
|
MD5 | aee6ecbddd0158f98e365326df701bba |
|
BLAKE2b-256 | 3794ed9b4bb032feae8b70aca8018af77ac13dfe1d72a159f78cda39b54acb54 |