import k3d
import numpy as np
import os
import SimpleITK as sitk
from k3d.headless import k3d_remote, get_headless_driver


def generate():
    filepath = os.path.join(os.path.abspath(os.path.dirname(__file__)),
        '../../../reference/assets/factory/heart.mhd')
    im_sitk = sitk.ReadImage(filepath)
    img = sitk.GetArrayFromImage(im_sitk)
    plt_volume = k3d.volume(img.astype(np.float32))
    plot = k3d.plot(screenshot_scale=1, grid_visible=False, axes_helper=0)
    plot += plt_volume
    headless = k3d_remote(plot, get_headless_driver(), width=800, height=800)
    headless.sync(hold_until_refreshed=True)
    headless.camera_reset(1)
    screenshot = headless.get_screenshot()
    headless.close()
    return screenshot

9c56cb5d34db20638c38e26994e01c27f352e67e
<mask token>

<mask token>


def generate():
    filepath = os.path.join(os.path.abspath(os.path.dirname(__file__)),
        '../../../reference/assets/factory/heart.mhd')
    im_sitk = sitk.ReadImage(filepath)
    img = sitk.GetArrayFromImage(im_sitk)
    plt_volume = k3d.volume(img.astype(np.float32))
    plot = k3d.plot(screenshot_scale=1, grid_visible=False, axes_helper=0)
    plot += plt_volume
    headless = k3d_remote(plot, get_headless_driver(), width=800, height=800)
    headless.sync(hold_until_refreshed=True)
    headless.camera_reset(1)
    screenshot = headless.get_screenshot()
    headless.close()
    return screenshot

import k3d
import numpy as np
import os
import SimpleITK as sitk
from k3d.headless import k3d_remote, get_headless_driver


def generate():
    filepath = os.path.join(os.path.abspath(os.path.dirname(__file__)),
        '../../../reference/assets/factory/heart.mhd')
    im_sitk = sitk.ReadImage(filepath)
    img = sitk.GetArrayFromImage(im_sitk)
    plt_volume = k3d.volume(img.astype(np.float32))
    plot = k3d.plot(screenshot_scale=1, grid_visible=False, axes_helper=0)
    plot += plt_volume
    headless = k3d_remote(plot, get_headless_driver(), width=800, height=800)
    headless.sync(hold_until_refreshed=True)
    headless.camera_reset(1)
    screenshot = headless.get_screenshot()
    headless.close()
    return screenshot
