python库以freesurfer的triangularsurface格式读取和写入曲面文件

freesurfer-surface的Python项目详细描述


https://travis-ci.org/fphammerle/freesurfer-surface.svg?branch=masterhttps://coveralls.io/repos/github/fphammerle/freesurfer-surface/badge.svg?branch=masterhttps://img.shields.io/pypi/v/freesurfer-surface.svghttps://img.shields.io/pypi/pyversions/freesurfer-surface.svghttps://zenodo.org/badge/185943856.svg

在freesurfer中读写曲面文件的python库 三角形曲面格式

自由曲线https://surfer.nmr.mgh.harvard.edu/

安装

pip3 install --user freesurfer-surface

用法

编辑曲面文件

fromfreesurfer_surfaceimportSurface,Vertex,Trianglesurface=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')

在注释文件中列出标签

fromfreesurfer_surfaceimportAnnotationannotation=Annotation.read('tests/subjects/fabian/label/lh.aparc.annot')forlabelinannotation.labels.values():print(label.index,label.hex_color_code,label.name)

$ 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

查找标记区域的边界

fromfreesurfer_surfaceimportSurfacesurface=Surface.read_triangular('bert/surf/lh.pial'))surface.load_annotation_file('bert/label/lh.aparc.annot')region,=filter(lambdal:l.name=='precentral',annotation.labels.values())print(surface.find_label_border_polygonal_chains(region))

测试

pip3 install --user pipenv
git clone https://github.com/fphammerle/freesurfer-surface.git
cd freesurfer-surface
pipenv run pylint freesurfer_surface
pipenv run pytest --cov=freesurfer_surface

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java模拟存储库对象从controller testcase返回空结果?   Java扫描程序跳行异常   c#混淆If语句?   java为什么日志中的stacktrace前面没有这一行?   java如何使SSHJ在非标准端口上启动出站SFTP?   java我如何确定为什么每周收入没有在我的程序中显示前三次?   java如何判断堆叠条形图的轴的行为?   java rest json API的Web服务器体系结构   java ClassCastException:javax。摆动按扭   Java在Linux上不读取excel文件(使用Apache POI)   反馈错误后,java Wicket 1.4.9无法从modal使用AjaxRequestTarget!   java方法头中“静态”的含义是什么?   java无法在我的tomcat应用程序中添加外部库   java使用Itext Pdf将图像添加到Pdf文件   java为什么当我调用universe时java3d会闪烁。getCanvas()。getView()。重新油漆();   java Gson嵌套类在使用proguard时为空   java如何确定JSON路径对文档是否有效   java在使用Jsoup解析时保持HTML布尔属性的原始形式   使用Java SDK,如何在Azure存储文件服务中为文件设置元数据?