How to use the fury.window.ShowManager function in fury

To help you get started, we’ve selected a few fury examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fury-gl / fury / docs / tutorials / 02_ui / viz_ui_listbox.py View on Github external
def display_element():
    hide_all_examples()
    element = example[values.index(listbox.selected[0])]
    element.set_visibility(True)


listbox.on_change = display_element

###############################################################################
# Now that all the elements have been initialised, we add them to the show
# manager.

current_size = (800, 800)
show_manager = window.ShowManager(size=current_size,
                                  title="DIPY UI ListBox_Example")

show_manager.scene.add(listbox)
show_manager.scene.add(welcome_text)
show_manager.scene.add(bye_text)
show_manager.scene.add(fury_text)
interactive = False

if interactive:
    show_manager.start()

window.record(show_manager.scene,
              size=current_size, out_path="viz_listbox.png")
github fury-gl / fury / docs / experimental / viz_shader_square.py View on Github external
from fury import actor, window
from viz_shader_canvas import cube, square


import numpy as np
import vtk


scene = window.Scene()
# scene.add(actor.axes())
# scene.background((1, 1, 1))
showm = window.ShowManager(scene, size=(1920, 1080),
                           order_transparent=True,
                           interactor_style='custom')

obj = 'cube'

if obj == 'square':

    canvas_actor = square(3)
    canvas_actor.GetProperty().BackfaceCullingOff()
    scene.add(canvas_actor)
    mapper = canvas_actor.GetMapper()

if obj == 'cube':

    # rec.SetPosition(100, 0, 0)
    canvas_actor = cube()
github fury-gl / fury / docs / tutorials / 02_ui / viz_buttons.py View on Github external
def change_icon_callback(i_ren, _obj, _button):
    _button.next_icon()
    i_ren.force_render()


button_example.on_left_mouse_button_clicked = change_text_callback
second_button_example.on_left_mouse_button_pressed = change_icon_callback

###############################################################################
# Now that all the elements have been initialised, we add them to the show
# manager.

current_size = (800, 800)
show_manager = window.ShowManager(size=current_size,
                                  title="DIPY Button Example")

show_manager.scene.add(panel)

interactive = False

if interactive:
    show_manager.start()

window.record(show_manager.scene, size=current_size,
              out_path="viz_button.png")
github fury-gl / fury / fury / window.py View on Github external
>>> r = window.Scene()
    >>> lines=[np.random.rand(10,3),np.random.rand(20,3)]
    >>> colors=np.array([[0.2,0.2,0.2],[0.8,0.8,0.8]])
    >>> c=actor.line(lines,colors)
    >>> r.add(c)
    >>> l=actor.label(text="Hello")
    >>> r.add(l)
    >>> #window.show(r)

    See also
    ---------
    fury.window.record
    fury.window.snapshot

    """
    show_manager = ShowManager(scene, title, size, png_magnify, reset_camera,
                               order_transparent, stereo=stereo,
                               multi_samples=multi_samples,
                               max_peels=max_peels,
                               occlusion_ratio=occlusion_ratio)
    show_manager.initialize()
    show_manager.render()
    show_manager.start()
github fury-gl / fury / docs / tutorials / 02_ui / viz_combobox.py View on Github external
def change_color(combobox):
    label.color = colors[combobox.selected_text]


# `on_change` callback is set to `change_color` method so that
# it's called whenever a different option is selected.
color_combobox.on_change = change_color

###############################################################################
# Show Manager
# ==================================
#
# Now we add label and combobox to the scene.

current_size = (400, 400)
showm = window.ShowManager(size=current_size, title="ComboBox UI Example")
showm.scene.add(label, color_combobox)

# To interact with the UI, set interactive = True
interactive = False

if interactive:
    showm.start()

window.record(showm.scene, out_path="combobox_ui.png", size=(400, 400))
github fury-gl / fury / docs / tutorials / 01_introductory / viz_earth_animation.py View on Github external
##############################################################################
# Next, alter the position and scale of the moon to correctly size it in
# comparison to the Earth using ``actor.SetPosition()`` and
# ``actor.SetScale()``, and rotate the Earth using ``utils.rotate`` to
# correctly align the texture.

moon_actor.SetPosition(1, 0.1, 0.5)
moon_actor.SetScale(0.25, 0.25, 0.25)
utils.rotate(earth_actor, (-90, 1, 0, 0))

##############################################################################
# The ShowManager class is the interface between the scene, the window and the
# interactor.

showm = window.ShowManager(scene,
                           size=(900, 768), reset_camera=False,
                           order_transparent=True)

##############################################################################
# Next, let's focus on creating the animation.
# We can determine the duration of animation with using the ``counter``.
# Use itertools to avoid global variables.

counter = itertools.count()

##############################################################################
# Use ``set_camera`` to ensure the camera is in the optimal position for the
# scene.

scene.set_camera(position=(0.24, 0.00, 4.34), focal_point=(0.00, 0.00, 0.00),
                 view_up=(0.00, 1.00, 0.00))
github fury-gl / fury / docs / experimental / viz_shader_wave.py View on Github external
from fury import actor, window
from viz_shader_canvas import cube, disk, rectangle, square


import vtk


scene = window.Scene()
scene.add(actor.axes())
# scene.background((1, 1, 1))
showm = window.ShowManager(scene, size=(1920, 1080), order_transparent=True)

obj = 'square'

if obj == 'square':

    canvas_actor = square()
    scene.add(canvas_actor)
    mapper = canvas_actor.GetMapper()

if obj == 'rectangle':

    canvas_actor = rectangle(size=(100, 100))
    scene.add(canvas_actor)
    mapper = canvas_actor.GetMapper()

if obj == 'cube':
github fury-gl / fury / docs / tutorials / 04_others / viz_timers.py View on Github external
from fury import window, actor, ui
import itertools

xyz = 10 * np.random.rand(100, 3)
colors = np.random.rand(100, 4)
radii = np.random.rand(100) + 0.5

scene = window.Scene()

sphere_actor = actor.sphere(centers=xyz,
                            colors=colors,
                            radii=radii)

scene.add(sphere_actor)

showm = window.ShowManager(scene,
                           size=(900, 768), reset_camera=False,
                           order_transparent=True)

showm.initialize()

tb = ui.TextBlock2D(bold=True)

# use itertools to avoid global variables
counter = itertools.count()


def timer_callback(_obj, _event):
    cnt = next(counter)
    tb.message = "Let's count up to 100 and exit :" + str(cnt)
    showm.scene.azimuth(0.05 * cnt)
    sphere_actor.GetProperty().SetOpacity(cnt/100.)