isosurfaceGenerator.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:pytorch_fnet 作者: AllenCellModeling 项目源码 文件源码
def generate_mesh(image, isovalue=0, channel=0):
    """
    Creates and returns a Mesh object
    :param image: an AICSImage object
    :param isovalue: The value that is used to pick the isosurface returned by the marching cubes algorithm
                     For more info: https://www.youtube.com/watch?v=5fNbCFjqWao @ 40:00 mins
    :param channel: The channel in the image that is used to extract the isosurface
    :return: A Mesh object
    """
    if not isinstance(image, AICSImage):
        raise ValueError("Meshes can only be generated with AICSImage objects!")
    if channel >= image.size_c:
        raise IndexError("Channel provided for mesh generation is out of bounds for image data!")
    image_stack = image.get_image_data("ZYX", C=channel)
    # Use marching cubes to obtain the surface mesh of the membrane wall
    verts, faces, normals, values = measure.marching_cubes(image_stack, isovalue, allow_degenerate=False)
    return Mesh(verts, faces, normals, values)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号