什么算法mayavi.mlab.管道.iso标准_表面.IsoSurface使用?

2024-04-19 07:52:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经仔细阅读了Mayavi文档和Google,但是我找不到任何关于IsoSurface类使用什么算法的声明。如果有帮助,我的源数据来自传递给mayavi.mlab.pipeline.scalar_field函数的3D NumPy数组。以下是在包含三维立方体的图像上使用iso_surface函数的代码:

import numpy as np
from mayavi import mlab
img = np.pad(np.ones((5,5,5)), 1, mode='constant')
src = mlab.pipeline.scalar_field(img, figure=False)
iso = mlab.pipeline.iso_surface(src, contours=0.5)

iso_surface函数生成IsoSurface的实例。mayavi\modules\iso中的代码_表面.py显示出mayavi.components.contour被使用。mayavi\components中的注释\轮廓.py声明它包装轮廓滤波器. 从tvtk\tvtk找到的代码_类.zip\tvtk U类\轮廓_过滤器.py在本地安装中,我在ContourFilter类的__init__方法中发现了这一点:

^{pr2}$

查看vtkContourFilter的源文件code以及与{a2}相关的文档,我没有看到对出版物的引用或在那里实现的算法的名称。在


Tags: 函数代码文档py算法声明pipelinenp
1条回答
网友
1楼 · 发布于 2024-04-19 07:52:44

正如您已经发现的,Mayavi的iso_surface模块使用(最终)VTK的vtkContourFilter。在“可视化工具包:三维图形的面向对象方法,第四版”(Schroeder,Martin和Lorensen)一书中有几句话是关于vtkContourFilter使用的算法的。这是那本书的第198页:

Contouring in VTK is implemented using variations of the marching cubes algorithm presented earlier. [...] For example, the tetrahedron cell type implements "marching tetrahedron" and creates triangle primitives, while the triangle cell type implements "marching triangles" and generates line segments.

还有一个vtkMarchingCubes过滤器,它是针对图像数据(1d、2d或3d网格上有规则间隔的数据)的情况;本书继续比较3d卷的vtkMarchingCubes和{}之间的执行时间。在

相关问题 更多 >