python - mayavi.mlab.pipeline.iso_surface.IsoSurface 使用什么算法?

标签 python vtk enthought mayavi

我一直在筛选 Mayavi 文档和 Google,但找不到任何有关 IsoSurface 类使用什么算法的说明。如果有帮助的话,我的源数据来自传递给 Mayavi.mlab.pipeline.scalar_field 函数的 3D NumPy 数组。以下是在包含 3D 立方体的图像上使用 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_surface.py 中的代码显示使用了 mayavi.components.contour。 mayavi\components\contour.py 中的注释表明它包装了 tvtk.ContourFilter。从本地安装中的 tvtk\tvtk_classes.zip\tvtk_classes\contour_filter.py 中找到的代码中,我在 ContourFilter 类的 __init__ 方法中找到了这一点:

tvtk_base.TVTKBase.__init__(self, vtk.vtkContourFilter, obj, update, **traits)

查看源码code vtkContourFilter 以及 www.vtk.org 上的相关文档我没有看到对出版物的引用或其中实现的算法的名称。

最佳答案

正如您已经发现的,Mayavi 的 iso_surface 模块(最终)使用 VTK 的 vtkContourFilter。 《可视化工具包:面向对象的 3D 图形方法,第 4 版》(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 体积的 vtkMarchingCubesvtkContourFilter 之间的执行时间。

关于python - mayavi.mlab.pipeline.iso_surface.IsoSurface 使用什么算法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24852687/

相关文章:

python - Traitsui 阻止 txt-box 实时更新

python - 获取特质听众列表——谁在听我的特质?

python - EPD Python 和 MacPorts Python 可以在 OS X (matplotlib) 上共存吗?

python - Python 分析器测量的 CPU 时间与实际用户和系统时间之间的关系是什么?

python - 如何使用 Python 计算目录中的文件数

python - 用于科学 3D 绘图的 Mayavi 替代品

c++ - VTK:在每个模拟时间步更新 renderWindow 中的数据点

python - 如何从具有向量列的 DataFrame 创建 tensorflow 数据集?

python - 为 pytesseract 设置 psm 时出错

python - 为 Python 安装 VTK