等值面的计算面积

时间:2016-04-22 14:17:12

标签: python 3d mesh marching-cubes scikit-image

我正在分析包含报告为高斯多维数据集文件格式的体积数据的多个文件(点击here了解说明)。

我在Python中创建了这个脚本,使用numpy和skimage来计算和表示isosurfaces:

    import numpy as np
    import matplotlib.pyplot as plt
    from mpl_toolkits.mplot3d.art3d import Poly3DCollection
    from skimage import measure
    from skimage.draw import ellipsoid
    import load_cube

# create an object and read in data from file 
    cube=load_cube.CUBE(gaussian_cube_file.cube)

# Obtain the surface mesh setting a specific isovalue (0.2)
    verts, faces = measure.marching_cubes(cube.data, 0.2)

# Display resulting triangular mesh using Matplotlib. 
    fig = plt.figure(figsize=(10, 12))
    ax = fig.add_subplot(111, projection='3d')

# Generate triangles
    mesh = Poly3DCollection(verts[faces])
    ax.add_collection3d(mesh)

    ax.set_xlabel("x-axis: a = 6")
    ax.set_ylabel("y-axis: b = 10")
    ax.set_zlabel("z-axis: c = 16")

    ax.set_xlim(0, 100)  
    ax.set_ylim(0, 100)  
    ax.set_zlim(0, 100) 

    plt.show()

Results from the previous script

问题是:如何计算得到的图中显示的所有等值面的总面积?我如何根据其价值为每个三角形着色?

0 个答案:

没有答案