多标签行军立方体和体积数据的简化。

zmesh的Python项目详细描述


zmesh:多标签行进立方体和网格简化

Build StatusPyPI version

fromzmeshimportMesherlabels=...# some dense volumetric labeled imagemesher=Mesher((4,4,40))# anisotropy of imagemesher.mesh(labels)# initial marching cubes passmeshes=[]forobj_idinmesher.ids():meshes.append(mesher.get_mesh(obj_id,normals=False,# whether to calculate normals or not# tries to reduce triangles by this factor# 0 disables simplificationsimplification_factor=100,# Max tolerable error in physical distancemax_simplification_error=8))mesher.erase(obj_id)# delete high res meshmesher.clear()# clear memory retained by meshermesh=meshes[0]mesh=mesher.simplify(mesh,# same as simplification_factor in get_meshreduction_factor=100,# same as max_simplification_error in get_meshmax_error=40,compute_normals=False,# whether to also compute face normals)# apply simplifier to a pre-existing meshmesh.verticesmesh.facesmesh.normalsmesh.triangles()# compute triangles from vertices and faces# Extremely common obj formatwithopen('iconic_doge.obj','wb')asf:f,write(mesh.to_obj())# Common binary formatwithopen('iconic_doge.ply','wb')asf:f,write(mesh.to_ply())# Neuroglancer Precomputed formatwithopen('10001001:0','wb')asf:f.write(mesh.to_precomputed())

安装

如果您的系统提供二进制文件:

pip install zmesh

^ {EM1}$需要一个C++编译器

sudo apt-get install python3-dev libboost-all-dev
pip install zmesh --no-binary :all:

性能调节

  • 在64位模式下,如果 对象在X、Y或Z轴上超过<;511、1023、511>;。这是由于一个限制 32位格式的。也可能得到x到1023。
  • 输入标签转换为uint32或uint64。使用这些数据类型之一可避免复制。
  • 网格程序按C顺序处理。

相关项目

    {a3}-ZMeMe大量使用Aleks的C++库。
  • Igneous-使用云计算可视化connectomics数据。

学分

感谢Aleks Zlateski创造和分享这个美丽的网格。

后来由威尔·西尔弗史密斯、尼科·肯尼茨和吴景鹏修改。

参考文献

  1. 洛伦森和克莱恩。”行进立方体:一种高分辨率的三维曲面构造算法”。163-169页。计算机图形学,第21卷,第4期,1987年7月。
  2. tk二次边折叠纸

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

推荐PyPI第三方库


热门话题
如何使用JSON将值从安卓 java类传递到php?   Java MySQL语法错误不会消失   java Android应用程序无法启动活动   bytebuffer在Java中从字节解码实数   java我无法在php中解码json对象   Swing中的JavaFX集成   java如何在JPA实体bean中使用或注释虚拟字段,该字段不应持久化到数据库中   来自另一个活动的java访问方法   java Tapestry动态生成图像   java有没有一种正则表达式方法可以将一组字符替换为另一组字符(比如shell tr命令)?   java通过转换gson将一些特定的表导出为文件   用java格式化字符串并写入文件   Java使用Graphics2D矩形在面板中创建2D平铺贴图?