Няма описание

Fabian Peter Hammerle 38fc2232e1 setup.py: added repo url преди 5 години
examples d088beacca adapt examples/precentral_gyrus_border: add small cubes instead of radiating triangles преди 5 години
freesurfer_surface f9f0ee56a9 convert attribute type annotations to #type comments (python3.5 compatibility) преди 5 години
tests e6b9d296bd refactor Surface tests to support python3.5 преди 5 години
.gitignore 0303eb775c added Surface.read_triangular(), setup.py & dev pipenv преди 5 години
.pylintrc 54205cdfc4 fix linter warnings: unused imports преди 5 години
.travis.yml b27da4a004 mark python<3.5 as unsupported (`pipenv sync` fails) преди 5 години
Pipfile 24189db123 pipenv: added autopep8 to dev deps преди 5 години
Pipfile.lock 952cf8c3d6 added Surface.add_rectangle() преди 5 години
README.md 9ff89d1389 readme & module docstring: added usage examples преди 5 години
setup.py 686962f42d setup.py: added repo url преди 5 години

README.md

Usage

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('tests/subjects/fabian/label/lh.aparc.annot')
for label in annotation.labels.values():
    print(label.index, label.hex_color_code, label.name)

or

$ freesurfer-annotation-labels tests/subjects/fabian/label/lh.aparc.annot
index	color	name
0	#190519	unknown
1	#196428	bankssts
2	#7d64a0	caudalanteriorcingulate
3	#641900	caudalmiddlefrontal
...
33	#4614aa	temporalpole
34	#9696c8	transversetemporal
35	#ffc020	insula

Find Border of Labelled Region

from freesurfer_surface import Surface
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))